Node-Red, MQTT and the new Weather Station (Part 3)

The circuit

The circuit is very simple thanks to the I2C component.


Noted with the NodeMCU dev board, when configuring for deep sleep, one will need to connect GPIO16 to RST. More, GPIO2 must be keep High while GPIO15 must keep Low. This is not explicitly mentioned anywhere but in their design doc. Looks like a lot of people ran into unreliable wake up if these pins are not connected correctly, 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.

You can find the software in my git repository here.

//Ed Wios