Let's start with the hardware components that we need to build the weather station. Below in the table, I gave you the names of the components, together with the links where you can buy the components.
There are plenty of other microcontrollers as well as sensors available, but in terms of cost and ease of use, those above are very practical. For example, I found all the components on Amazon, and together they cost around 30$.If you want to reduce costs, instead of this microcontroller, you can buy one without display.
Tip
If you’re a complete beginner in the area of hardware and embedded systems, I would recommend to buy the same components as me.
ESP32 Microcontroller
Vehicles, medical devices, vending machines, home appliances, and weather stations all use microcontrollers. They are small, low-cost computer-on-a-chip designed to control how the objects work and respond to the environment. It means that our sensors, whose task is to measure something from the environment, e.g., temperature, are meaningless without a microcontroller connected to them. ESP32 is a microcontroller developed by the Chinese company Espressif Inc. It’s a very affordable solution for use in commercial products, especially considering its high level of performance and extensive features such as WiFi and Bluetooth.
Info
For more information about the ESP32 microcontroller, check out the official website of the company.
Sensors
Sensors are like the senses for our electronic projects, allowing devices to observe and interact with the world around them. Just as humans use their senses to understand their environment (seeing, hearing, touching, etc.), sensors give machines the ability to detect and measure various physical conditions. These conditions can include temperature, humidity, pressure, light, motion, and much more. In the context of our project, sensors are crucial because they collect data from the environment. This data could be anything from how hot or cold it is, to how humid the air feels, or even how high above sea level a place is. The sensors we use are small electronic components that can detect these specific conditions and convert them into data that our main controller, in this case, the ESP32, can understand and process. Using sensors, our devices can make decisions, take actions, or simply record information based on what they 'sense.' For example, a weather station uses sensors to monitor conditions like temperature and pressure to predict the weather.
Temperature and humidity sensor: DHT11
When someone asks you what’s the weather and you reply: “It’s so hot and humid”; it means that the temperature and the humidity are high.
Alert
This can vary depending on the geographical location and personal perception, but generally, temperatures above 30°C (86°F) are considered hot.
Alert
Humidity levels of 60% or higher are typically considered humid. However, the discomfort level increases significantly as humidity levels reach 70% or higher, especially in combination with high temperatures.
There are numerous reasons why it is important for a weather station to have sensor to measure temperature and humidity:
Energy Efficiency: Knowing the temperature and humidity can help in managing home heating and cooling systems more efficiently, leading to energy savings.
Scientific Research: Accurate records of temperature and humidity are necessary for climate studies and research into global weather patterns.
Comfort and Health: High humidity can make it feel hotter than it is, while low humidity can cause dry skin and respiratory irritation.
The DHT11 is an ultra-low-cost digital temperature and humidity sensor made of two parts, a capacitive humidity sensor and a thermistor. It also includes a built-in chip that takes the physical measurements of temperature and humidity and translates them into a digital format that a microcontroller can understand. This process, known as analog-to-digital conversion, allows the sensor to communicate precise data in a form that's easy to work with using simple programming.
Air pressure sensor: BMP180
Another key feature of the weather station is measuring air pressure. Air pressure, also known as atmospheric pressure, is the force exerted by air on any surface in contact with it, whether compressed or unconfined. Air pressure is expressed in several different systems of units, including millibars, pounds per square inch, millimeters (or inches) of mercury, standard atmospheres, or kilopascals.
Info
Increasing high pressure (above 1000 millibars) corresponds with clear, sunny weather. Decreasing pressure (below 1000 millibars) corresponds with cloudy, rainy weather.
The BMP180 sensor from Bosch is the best low-cost solution for measuring air pressure. You can also use it to measure temperature and altitude! It's precise and uses very little power, making it suitable for portable weather stations.
Warning
The BMP180 is sensitive to moisture, as moisture can damage the sensor and affect its accuracy. Do not submerge or spray the sensor with water or solvents.
Air quality sensor: MQ135
Air quality sensors are not standard components of every weather station, yet they extend the functionality of the weather station beyond just weather prediction. It allows us to assess the health and safety of their environment, providing valuable insights into pollution levels. This is particularly relevant in urban areas or places with higher industrial activity, where air quality can significantly impact health and well-being.
Alert
According to the World Health Organization, air pollution is associated with 7 million premature deaths annually.
The MQ135 sensor is commonly used for detecting a wide range of air pollutants, including ammonia, nitrogen oxides, benzene, smoke, and carbon dioxide, making it essential for monitoring air quality in environments ranging from homes to industrial sites. One of its key advantages is its sensitivity to a broad spectrum of harmful gases, combined with its affordability, fast response, and ease of use.