Weather Station
Creation of a weather station equipped with a rain gauge, a temperature and humidity sensor and an air quality measurement device. The data collected is sent via http to a Domoticz server.
The assembly is made with two PCB boards. I am using a power supply board already tested in a previous project.
Description of the Module
All the project files (Arduino programs, EsayEDA schematics and PCB files) can be downloaded here.
The heart of the system is a Wemos mini D1 pro controller. It takes care of the reading the sensors and the communication through its Wifi interface and the internet.
A TPL5110 timer regulates the activity of the assembly. When it is active, it powers the assembly components. In active mode the Wemos controller is powered up and its program starts. This program reads the peripherals and sends the collected values. At the end of the program, it gives a pulse via D3 to port D0 of the TPL5110 circuit which goes into standby. The resistor R1 gives the timer's standby time and therefore the time when the circuit is powered down.
A filter consisting of an inverter and a capacitor connected between the D3 port of the Wemos and the D0 port of the timer avoids spurious pulses when the Wemos is started.
This filter is necessary because when the Wemos starts up the GPIOs go through the LOW state before they can be controlled by the program. Without the RC filter the TPL5110 would go back to the standby state without the Wemos program running.
The time of inactivity of the timer is set by the resistor R1 (The value of 94k corresponds to a standby state of about 32 minutes. The internal resistor of the TPL5110 circuit must be disconnected as shown in the picture).
Special Features of the Assembly
Power consumption
This assembly is characterized by its low power consumption. During the standby state the consumption is around 20µA.
In active mode the consumption increases to 130mA for a few seconds.
Rainfall
The rain gauge is based on two buckets that are filled with rainwater in turn. When a bucket is filled it tilts to empty. This triggers an impulse that is transmitted to a CD4040 counter circuit. This circuit is permanently powered and consumes very little current. Every 32 minutes the Wemos circuit reads the counter using the PCF8574 circuit (parallel to serial converter). The counter is reset at the end of the day.
Temperature/Humidity
I use two DHT22 sensors. One is responsible for measuring the outside temperature and the other for measuring the internal temperature of the box. The latter allows me to monitor, out of curiosity, the temperature inside the box. The DHT22 sensors are more accurate than the DHT11 sensors and work with negative temperatures.
Power Supply
The power supply is provided by a 16850 battery, a solar charging circuit and a DC-DC converter which provides a stable voltage of 5V (essential to ensure the stability of the Wemos circuit!).
To monitor the battery level, an LM10 circuit is used. This is an amplifier with an internal reference voltage of 0.2V.
A bridge divider (R2, R3, RP1) provides a voltage that is compared to this reference voltage. The bridge divider provides 0.2V when the battery voltage reaches 3.5V. As soon as the battery voltage falls below 3.5V the output of the circuit switches from 0 to 5V. Potentiometer RP1 is used to adjust the threshold voltage to 3.5V.
The battery level measurement is controlled by an optocoupler that connects the circuit to the battery. An optocoupler also transmits the battery status.
This principle electrically decouples the battery from the circuit to be powered to reduce power consumption.
The solar panel with its charging interface supplies the battery.
Programs
The Arduino program is based on the libraries "SdS011", "ESP8266WiFi.h", "DHT.h", "ESP8266HTTPClient.h", "arduino.h" and "PCF8574.h"
The application consists of two files: the main program, and for the sake of clarity, a file grouping the Wifi and data processing functions. I was inspired by the examples provided with the libraries.
In the main program the declarative part gathers the library calls and the variables. In particular the URLs intended for Domoticz.
The setup part is simple. It initializes the peripherals and starts the Wifi connection. The first transmissions with Domoticz concern the strength of the WiFi signal as well as the time to connect.
The "loop" part processes the sensors sequentially and sends the values in http to the Domoticz server. A call to the "worldtimeapi.org" server allows to know the time to reset the CD4040 counter at the end of the day.
At the end of the program the port D3 passes to LOW. Thus, port D0 of the TPL5110 circuit switches to HIGH which cuts off the power for 30 minutes.
Domoticz
The collected information is sent to a Domoticz server located at a different location than the weather station. The internet network is used to transport the information to the Domoticz hosting site.
The configuration of Domoticz is simple and can be seen on the screenshots. Apart from the temperature readings, “dummy devices/virtual sensor creation/custom sensor” are used to store the data.
It is possible to use other home automation servers by adapting the URLs.virtual sensor creation.
Conclusion
In this project I designed the schematics with the EasyEDA software and the generation of the PCB files as well as the jlcpcb.com website for the manufacturing of the PCBs. The manufacture is not very expensive. To make the cost of transport more profitable, I placed a group order of different PCBs. The result is of very good quality and the delivery time is fast (10 days). The PCB files are at your disposal for a possible order.
I have already published a weather station. This one seems to me to be the most successful.
A modification has been added to the assembly (as shown on a picture above). A reset button for the CD4040 meter has been added (between the +5 and the reset pin). On initial power up (battery change or program modification) the counter must be set to zero because on power up it takes a random value.
If this can give you ideas, I would be delighted. "Enjoy it”.