Here’s a project by one of our members, James Dinsmore. It shows his experimenting with a completely off grid, solar powered, wifi enabled, remote sensor package. It would be useful for things like monitoring temperatures and humidity around a yard or small orchard for example. Other sensors could be used as well such as moisture detectors, microphones, wind anemometers and other weather related things. His blog post follows below:
My NodeRed system has sensors in my office, the utility room, living room and bedroom; this project stretched my network to my back yard with a solar-powered node. There are a lot of considerations that go into a solar project: how much solar panel, the battery storage, the charging circuit, the WiFi telemetry and something new for me; deep sleep mode for the ESP8266. My aim was to build a minimal system with just enough daily solar power to top off its battery.
I used the Adafruit panel, LiPo battery and charger since they had been designed to work together.
While my ‘go-to’ microcontroller has been the NodeMCU, I went with the Huzzah because it has a built-in LiPo charger (though I did not use it in this project; I plan on seeing if I can eliminate the external charging circuit in the next).
TMP102 I2C Temperature Sensor
The ESP8266 only has 1 analog port, which I was using to monitor battery voltage; so I could not use an analog temperature sensor. The TMP102 is inexpensive and easy to work with; with the added advantage of being addressable if I wanted to monitor up to 3 sensors in series.
The system code was setup to run for 40 seconds and sleep for 3 minutes. In that 40 seconds it measured temperature, checked 2 digital logic levels for charging/charged and power present; measured the battery voltage and then sent MQTT messages to my Raspberry Pi NodeRed server in the house. The average current for that 40 seconds on was 120mA; the 3 minutes of deep sleep around 9mA. That resulted in an 18% duty cycle. I could have brought that down much more (but I am impatient to see new readings). I just need the system to be able to survive through several cloudy days in a row.
The ESP8266 Code
This was the toughest aspect for me. I already worked out the MQTT code for my interior sensor modules and my NodeRed system; but the big difference is that deep sleep has an empty main loop and simply restarts every time it wakes up and only goes through the setup loop. I also had to make a lot of changes for the TMP102 temperature sensor and for the logic of recognizing when the system was charging, charged and when it was dark (no power). Has to add a 30 second delay before it went to sleep or the MQTT messages would not get out. ESP8266 “Don’t Use” pins: GPIO 0-3, 6-11, 15 or 16 or your module might not boot. OMG!
It gets hot in the box! 130F makes me fear for the long-term life of the LiPo battery and for the efficiency of the solar panel and battery. I should have mounted the solar panel on stand-offs so air could circulate below it. Maybe the LiPo battery should be buried in the ground? Over-all, I am happy the system works; there is always room for improvement but I learned so much actually doing it versus just reading about someone else’s project.