The weather station kit and other Wi-Fi-based projects use the ESP8266 system on a chip. This chip supports 2.4GHz Wi-Fi but not 5GHz. If your Wi-Fi works on both bands you probably have two SSIDs. The 5GHz band SSID often ends in 5G like this – “BlackCat-5G”. When you set up the config.h file for the D1M-WX1 weather station make sure you choose the SSID for the 2.4GHz band.
Our first kit, the D1M-WX1 Solar Powered Weather Station, is very easy to build because it uses only “through hole” components. Although the breakout or daughter boards mounted to the printed circuit board do contain surface mount devices (SMDs), they are all pre-soldered. Only a few basic electronic shop tools are needed to assemble the kit. You probably have all the suggested tools if you have built kits before. For the new kit builder, this list is a good place to start acquiring the tools you will be using time and again when you build more kits. See the list at Tools Needed on the D1M-WX1 projects page.
The key to using solar power in an Internet of Things project is to put the microcontroller unit into sleep modeafter the sensors are read and the data posted to your IoT server. The NodeMCU and the Wemos D1 WiFi, a larger profile that mimics the Arduino UNO form, reliably woke from deep sleep. So far, the Adafruit HUZZAH fails to wake after 20 or 30 sleep cycles. I’m still working on the HUZZAH but the letter carrier just brought a package with three Wemos D1 Mini ESP8266 devkits and an OLED display shield.
Would the D1 Mini also work well with deep sleep? Answering that question had to wait until I checked out the OLED display.
The D1 Mini devkits are supplied with both male and female headers. You must install the female headers if you want to use the OLED shield as a plug-in unit. Make sure you install the headers on the correct side so that the shields will stack with correct connections.
Both Adafruit and Sparkfun have Arduino libraries for this display. The Sparkfun library loaded easily and the examples brought up bright, clear images.
The next step was to make a DIY shield to mount BMP180 and HT21D sensors. The BMP180 measures atmospheric pressure and temperature. The HTU21D measures temperature and humidity. [I will post some photos in a week.] It makes a nice compact little cube with the sensor shield stacked between the D1 Mini and the OLED.
Having proven the OLED display, I removed it and set about to put the D1 Mini and sensor shield into deep sleep. There were some problems doing this. When the ESP8266 wakes up, it needs to be reset to restart execution of the firmware. The ESP8266 provides a signal on pin D0 to do this so D0 must be connected to the Reset pin. However, this connection sometimes interferes with putting the ESP8288 into programming mode and must be opened to reprogram the chip.
I also ran into some problems when power was removed while the chip was in deep sleep.
After getting the chip to sleep and wake up I ran some current tests. The D1 Mini drew an average of 80mA when awake and 2.4mA when asleep. The D1 Mini has a small red LED that lights when the board is powered. I pulled the LED off the board with a pair of pliers. That dropped the sleep current down to 70µA. This makes the D1 Mini look like a very good choice for solar powered IoT projects.
Recently the local Institute of Electrical and Electronic Engineers (IEEE) held two “hands-on” sessions to build an Internet of Things (IoT) weather station. We built it on a breadboard so that the attendees would not have to solder wires. Several of the participants have kept their stations on-line and two have placed the unit outdoors.
Finding a suitable outdoor enclosure for the sensors is difficult. There are several available for relatively large sensors with costs from $30 to hundreds. Fortunately, a scrounging mission to Walmart turned up a nice little box for 88¢!
The box is 88 x 60 x 50mm (3.25 x 2.38 x 2.00-in). The box is transparent and has a lid the fits over the sides of the box. There is some play between the lid and the box so it allows some air movement. This can be “enhanced” by drilling four 6mm (1/4-inch) holes in the bottom of the box.
The box neatly holds a BME280 barometric pressure/temperature/humidity sensor and a BH1750 light intensity sensor. A piece of stripboard mounts the sensor breakout boards. Since the sensors are I2C devices they need four wires (two I2C and 2 power) to connect to the “control unit”. I cut the ends off a flat USB cable from the dollar store. It requires a lot of careful patience to solder the very small wires to the stripboard. I am looking for a better method.
My box is mounted to a second-floor window frame with clear packing tape. The window is above a small shingled roof. This is not an ideal location because solar heating of the roof probably affects the temperature reading. In practice, the temperature accurately tracks the local WeatherBug station reading.
The unit has been outside since 10 November 2016. It has been through several rain storms with no problems.
A solar power supply would be a really neat addition to any Internet of Things project. The ultimate goal would be to have a self-sufficient IoT device that could be remotely reprogrammed with the Over The Air (OTA) feature.
A key to using solar power is to reduce the average power requirement of the IoT device. The ESP8266 can be put in several levels of sleep but dev kits (development kits) like the NodeMCU have other power hungry support devices that swamp out the ESP8266 power draw. The two main consumers are the voltage regulator and the USB converter chip. In deep sleep mode, the ESP8266 draws about 70μA while the total draw of the NodeMCU is about 15mA. Several people have “fixed” this issue by removing the regulator and cutting traces to the USB chip. Removing the regulator is easy, cutting traces on the USB is difficult. It was even more difficult in my case because the particular NodeMCU I was attempting to modify uses the CH340G chip rather than the CP2102. Theoretically, the same process of lifting the Vcc connection should work. For the CH340G, this is pin 16, however, I found there is no direct connection between pin 16 and 3.3V. Not having a schematic, I decided to look for other options.
I had hoped that the Adafruit HUZZAH is a good choice for sleep mode experiments. After days of experimentation, the HUZZAH fails to wake after about 20 or 30 sleep cycles. Others have experienced the same problem and offered solutions. To date, none have worked for me.
Using the exact same software, the Wemos D1 WiFi has worked perfectly. Unfortunately, the D1 has similar parasitic loads like the NodeMCU so is not a good choice for a solar-powered project. Since the same software fails on the HUZZAH there must be some hardware solution. I drew up the circuits for both dev kits with the objective of building the same circuit around the HUZZAH using external components.
Since the same software that works on the D1 fails on the HUZZAH, there must be some hardware problem. I drew up the circuits for both dev kits with the objective of building the same circuit around the HUZZAH using external components.
The suspiciously missing components from the D1 are circled in orange. The most significant are:
- C11 – a 100nF capacitor from the Reset pin to ground. This value is suggested by Expressif. It probably provides some time delay on the wake-up pulse. Added this between GND and RST on the HUZZAH.
- C10 – a 100nF bypass capacitor on Vcc. Probably not too important but easy to add between 3V and GND on the HUZZAH.
- R13 – a 10K pull-up resistor on GPIO0. The HUZZAH has an LED in this line that may introduce too much voltage drop and leave GPIO0 in an indeterminate state. Added a 10K between 3V and #0 on the HUZZAH.
- The logic circuit of Q1 and Q2 is driven by the DTR and RTS lines from the USB chip to automatically put the ESP8266 into programming mode. I do not think their omission from the HUZZAH is the problem. But I could be wrong!
Sadly, the HUZZAH still fails to come out of deep sleep after about 20 cycles of 120 second sleep duration.