I made the decision to switch platforms after trying WiFi solutions based on the CC3000 chipset tied to the Arduino UNO and being very disappointed by their reliability. I noticed that the Arduino development environment had started to support the ESP8266 chipset and initial reports seemed to indicate they ran for long periods of time without issues.
With more and more 3.3 Volts parts being made available on breakout boards, it also seemed like the right time to make the shift to a 3.3V microcontroller.
Fortunately I have side-stepped any issues with drivers for the on-board serial to USB chips by using Linux as a development environment. Unfortunately I can't offer any suggestions for other operating systems such as Windows or Mac OS/X.
My first project was a temperature and humidity sensor using the DHT11 sensor. Using the WiFi connection, through my home router, the sensor information was sent out to ThingSpeak every 10 minutes. After sending the MCU was put into deep sleep mode until another ten minutes had passed, at which point the MCU was reset and the cycle started again. The code I used for this is available for download here: thingspeak_data-logger.ino (Arduino 1.6.7)
Since I ultimately wanted to run the sensor from a rechargeable battery I needed to be able to read the voltage being supplied to the ESP8266. This function is built into the ESP8266 but it took some time to figure out the right incantation to get it to work. For the record this is documented below:
In the initial header of your project you need to specify "ADC_MODE(ADC_VCC);" to enable analog 0 (A0) to read VCC.
Once that is complete, in the main body of the code, you can read VCC using "float vcc = ESP.getVcc();" to read the current VCC*1024. Dividing by 1024 should yield a figure representing VCC in volts.
Using the NodeMCU with deepsleep I was able to power the sensor from a USB power-pack for approximately 20 days before the powerpack shutdown to protect the Lithium-ion batteries.
Later, cruising around the online Chinese supplyhouse AliExpress, I discovered a smaller form factor version of the ESP8266 breakout board that had a healthy collection of shields containing most of the electronics I was interested in. The Wemos D1 Mini is about the size of a postage stamp but still contains all the support electronics including serial-to-USB and 5V to 3.3V regulator.
When using the WiFi sensor code on the Wemos D1 Mini I have been able to run for at 15 days on the same USB battery pack before it showed any sign of discharging (three out of four battery level lights lit) so I'm assuming that the D1 Mini draws much less power in deep sleep and is therefore a better choice for battery powered projects.
|Shield Name||Device Type||Pin Used||Pin Definition|
|DHT Shield||DHT11||Pin D4||Data Out|
|DHT ProShield||DHT22||Pin D4||Data Out|
|OLED Shield||OLED using SSD1306 driver||Pin D1, D2||SCL, SDA|
|1-Button Shield||Momentary push button||Pin D3||Button|
|Relay Shield V2||5VDC Relay||Pin D1||Relay Enable|
|Micro SD Shield||Micro SD adapter||Pin D5,D6,D7,D8||CLK,MISO,MOSI,CS|
|ProtoBoard Shield||Proto Area||All Pins||Proto Area|
|Dual Base for D1 mini||Stack D1, shields side-by-side||Pins are duplicated|