In this Instructable, we will learn how to make a Solar-powered wireless weather station by using an ESP32 Wifi Module and few common weather sensors available in the market. The weather station is fully solar-powered, so no need to worry about the external power supply. You can install it in a remote place without laying long cables to provide power.
I have earlier posted two Instructables on Weather Stations ( Version -1.0 and Version-2.0) that were based on Wemos ( ESP8266) and are very popular on the internet. Based on the user’s feedback, I tried my best to make a more powerful weather station by including some new features.
This Weather Station is such compact weather station that consists of several meteorological sensors that measure the following parameters:
1. Internal Temperature (BME280)
3. Barometric Pressure (BME280)
4.External Temperature (DS18B20)
5. Wind Speed ( Sparkfun Weather Meter )
6. Wind Direction ( Sparkfun Weather Meter )
7. Rain Gauge ( Sparkfun Weather Meter )
8. UV Index ( SI1145)
9. Lux Level ( BH1750 )
I have designed a customized PCB for this project. It is designed in such a way that you can conveniently integrate different combinations of sensors according to your actual application needs.
Full Video Tutorial:
Why a Weather Station?
Imagine you are residing at a place that is far away from the meteorological department. In such a case, the weather predictions you get may not be the most precise. This is where home weather stations become more advantageous. This small weather station can provide accurate data regarding the weather parameters of where you live.
Today, data on localized weather, known as microclimates, is the new frontier for more precise and accurate weather forecasting. As a result, the collection of weather data is becoming increasingly smaller and gridded.
The applications of this type of small portable weather station are vast in the area of smart agriculture, smart city, solar power plants, construction site, etc.
8. MCP1700-3.3V ( Amazon)
12. TVS Diode – DT1042-04SO ( Amazon ) – Optional
13. RJ11 Connector ( Amazon )
17. Screw Terminal -3P -3.5mm pitch ( Sparkfun )
19. 18650 Battery ( Banggood )
24. PCB ( PCBWay )
Step 1: Selecting the Power Supply
Here, I have used a 18650 Li-Ion battery. The battery is charged from a Solar panel through a TP4056 charging module. The TP4056 module comes with a battery protection chip or without the protection chip. I will recommend buying a module that has a battery protection chip included.
The 18650 battery outputs 4.2V when fully charged. The battery voltage is further step down to 3.3V by using a low dropout voltage regulator(MCP1700-3302E).
The output from the voltage regulator will power the ESP32 through the 3.3V pin.
Step 2: Power Supply Circuit
The solution to the above problem is to use a low-dropout or LDO regulator. A low-dropout or LDO regulator is a DC linear regulator which can regulate the output voltage even when the supply voltage is very close to the output voltage. Here we will use an MCP1700 LDO for efficiently powering the Circuit.
A ceramic capacitor ( 0.1uF) and an electrolytic capacitor (100uF) are connected in parallel to the GND and Vout pin of the LDO ( MCP1700 -3.3V ) to smooth the voltage peaks.
The output of the MCP1700 is connected to the ESP32 3.3V pin through a slide switch.
MCP1700 Data Sheet: Download
Step 3: Wind Vane ( Wind Direction Sensor)
An external resistor can be used to form a voltage divider, producing a voltage output that can be measured with an analog to digital converter, on your the microcontroller allows you to determine the direction of the wind vane pointer.
To measure voltage output, I have used a 10kohm external resistor to form a voltage divider with the wind vane resistor ( Rvane). The 10K resistor is connected to 3.3V as shown in the above figure. Then, I connect the middle of the divider to the ESP32 ADC pin (GPIO 35), measure the voltage, and by referring to the table shown above, convert to the wind direction.
The reed switches and resistors arrangement are shown in the above picture. Resistance values for all 16 possible positions are given in the table.
When the wind vane pointer falls in between two switches, the resistance value is considered as the equivalent resistance between the two adjacent resistances. In this situation, the vane’s magnet activates two switches simultaneously, as result they are connected in parallel.
When the wind vane pointer falls in between the Switches S1 and S2, the equivalent resistance is determined by the following formula:
Rvane = R1x R2 / ( R1+R2 ) = 33 x 8.2 / ( 33 +8.2 ) = 6.57K
Since the values outputted by the wind vane are based on degrees, you can, in theory, have any value represent any direction. However, it is recommend having the value at degree 0 represent North for ease of use.
Step 4: Anemometer ( Wind Speed Sensor)
The Anemometer is connected to the ESP32 GPIO pin 14 and GND. After that, all we need to do then is to monitor for button presses which is pretty straightforward. We can use the pin interrupts method to monitor the button press ( tips). When the reed switch closes the circuit (pressing the button), it triggers a software event.
If you want to make your own wind sensor, then read this nice Instructable
These are few more 3D printed Wind Sensors:
Step 5: Rain Gauge ( Rain Fall Sensor )
Much like the wind speed gauge, the rainfall gauge generates ticks to tally the amount of rain that has fallen. Count ticks to determine how much rain has fallen recently. Each tick represents 0.011″ ( 0.28mm ) of rainfall. This sensor is connected to pin 25 of the ESP32.
The rain gauge that I have used here is from Sparkfun. It has an RJ-11 plug on the end, you can directly plug it into the Weather Station V3.0 PCB.
You can make your 3D printed Rain Gauge by following this article
Step 6: Measuring the Rainfall
In the previous step, we have discussed that each time the bucket tips, it passes a magnet over a reed switch making a momentary electrical connection. Here each tip of the bucket in the rain gauge can be assumed as a button press. We can easily then connect the gauge as if it were a button.
The rain gauge is connected to the ESP GPIO pin 25 and GND. After that, all we need to do then is to monitor for button presses which is pretty straight forward. We can use the pin interrupts method to monitor the button press ( tips). When the reed switch closes the circuit (pressing the button, the bucket tipping), it triggers a software event.
Here I am using attachInterrupt()to monitor the number of tips. You can find the details from Arduino Page.
Step 7: Monitoring Pressure ,Temperature and Humidity by BME280
In this project, we will use BMP280 / BME280 sensor.
BMP280: BMP280 is a sophisticated sensor that very accurately measures barometric pressure and temperature with reasonable accuracy. The BME280 is the next-generation of sensors from Bosch and is the upgrade to the BMP085/BMP180/BMP183 – with a low altitude noise of 0.25m and the same fast conversion time. The advantage of this sensor is that it can use either I2C or SPI for communication with the microcontroller. For simple easy wiring, I will suggest buying the I2C version board.
BME280: The new BME280 sensor, an environmental sensor with temperature, barometric pressure, and humidity. The BME280 is the next-generation of sensors from Bosch and is the upgrade to the BMP280. This precision sensor from Bosch is the best low-cost sensing solution for measuring humidity with ±3% accuracy, barometric pressure with ±1 hPa absolute accuracy, and temperature with ±1.0°C accuracy. It can be used in both I2C and SPI.
Note:BME280 can measure humidity but BMP280 can’t. In the market, BMP280 is also available by the name of BME280. So be sure whether it is a BMP280 or BME280.
You can read this nice article on BME280 for a better understanding.
Step 8: Monitoring UV Index – SI1145 Sensor
The Si1145 is a sensor with a calibrated UV sensing element that can calculate the UV Index. It can communicate via I2C communication (address 0x60). You can hook up this sensor with I2C port in the PCB which is located at the bottom left of the ESP board.
The SI1145 sensor really doesn’t have an actual UV sensor! Instead, it looks at the amount of visible and IR light it receives from the Sun and uses a formula to calculate the UV index, right down to two decimal points.
You can read this article to know more about the UV sensor.
If you need a more accurate measurement of UV Index, you may use the VEML6070 sensor. Unlike the Si1145, this sensor will not give you UV Index readings. However, the Si1145 does UV Index approximations based on light level, not true UV sensing. The VEML6070 in contrast does have a real light sensor in the UV spectrum.
You can read this tutorial for writing the code and using its library.
Read more: Solar Powered WiFi Weather Station V3.0