The hardware
The NodeMCU dev board is used to provide all the functionalities of a weather station including measuring the sun light, reading the temperature and relative humidity sensor readings, publishing to the MQTT broker the measure sensor values. It is designed so that it will wake up from deep sleep every 10 minutes to measure, connect and publish, then go back to deep sleep. According to the dev board manufacturer, it’s current in deep sleep mode uses only a few micro-Amps of current, ideal for battery operations like this one.
As for the temperature and relative humidity sensor, I have chosen to use Silicon Labs' SI7021. It gives I2C output so it is extremely easy to integrate to almost any micro-controller available, and it is very accurate (-10~40 +/- 0.3 degC).
The Light sensing part is only a normal CdS sensor that when shine upon, gives a low resistance of <300kohm depends on how bright the light is, otherwise, a high resistance of >1Mohm in total darkness.
The ESP8266 on the NodeMCU dev board only has a resolution of 10-bit, giving a 1024 different scale, and there is only One ADC on this chip. It fits perfectly well to this project as we only need one analog input and there is not much value added by measuring the light level of more than 1024 different shades.
The circuit
The circuit is very simple thanks to the SI7021 I2C integrated sensor.
Particular attention must be paid that with the NodeMCU dev board, when configuring for deep sleep, one will have to connect GPIO16 to REST. Moreover, GPIO2 must be kept High while GPIO15 must be kept Low. This is not explicitly mentioned anywhere but in their design document. A lot of people did run into unreliable wake up simply because these pins were not connected as required, like left floating, for example.
A 10µF capacitor is used to smooth out any short disruption in the power rail, and a 1000pF capacitor was placed in parallel to the CdS light sensor to chip away some high frequency noise that may affect the not-so-accurate ADC built in to the ESP8266.
The SI7021 module has built-in pull up resistors for the I2C bus, therefore, the 1kΩ pull ups are not necessary. Just connect the I2C bus to two available GPIO pins (here I have used GPIO 12 and GOPI 14) and adjust the code accordingly.
The brightness is obtained from the CdS sensor through the one and only one ADC on the ESP8266. The ESP8266 only have one 10-bit ADC, giving the resolution of 1024 levels. It is more than enough for a weather station, 1024-bit resolution already give a lot of information about how bright the sky is. I would recommend to use a black tube to surround the CdS so that it will not be affected from the reflected light from the environment.
Once the hardware is constructed, you can load up the software into the ESP8266 and go.
//Ed Wios
Comments
Please log in or sign up to comment.