I added in the battery level code from https://code.google.com/p/tinkerit/wiki/SecretVoltmeter into my ESP8266 program and it works like a charm. The code uses a reference voltage in the Atmega328p microcontroller to get a reading of Vcc going into the ATmega328p. For the ESP8266 project, that would be the 5v output of the AMS1117 board. In my testing with the dead-ish battery yesterday, I found that the system started to fall apart once it dropped below 5v. The LCD backlight would start flickering and the sending of data seemed to fail more often.
I already have the system sending me emails if it gets bad values from the DHT22 sensor or the ESP8266 fails at sending to both ThingSpeak and my webhost in the same cycle. It was easy enough to add a little more code so it would send me emails at certain voltage levels. I’ve got it sending emails to me when it drops to 5, 4.8, 4.6, and 4.4 volts.
I got this email when I retried the battery for the third time after bringing it in from outside in yesterdays outdoor trial. If I give the battery a rest, it’ll be able to power up the system again but it’ll die after a short period. The lowest threshold email I got was for 4.6v before the battery died again.
I don’t expect this project to go battery powered again but this is definitely something I’m glad I found and I hope it finds a place in other projects.
At this point, I feel like the project is over. It’s been a great learning experience working with two programming languages, my custom PCBs, and seeing the community that has gathered around the ESP8266. It doesn’t have to be over though… Solar power, anyone? Perhaps in the future.
Like I mentioned a couple posts ago, I have other projects coming up, including some experiments with some RF transmitter and receivers, and my custom shift register PCBs that should come in next week if the postal service is consistent with the last two times I ordered from Dirty PCBs.
Thanks for reading!