For my first actual practical project I'm looking at making a wifi doorbell. Pretty simple stuff - visitor presses button, I get a notification on my computer / phone / whatever.
I have already gotten an ESP8266 working with a remote blink sketch (switching a led on and off online) so I think I'm pretty much already there. However, this has all been running from USB power. I don't have the materials to make this run from batteries yet.
First things first - power savings! I was considering maybe wiring the reset switch to the doorbell button, and putting the device in permanent deep sleep mode after it's rung. However, I think I may have found an even better solution in the ESP8266 forum; wiring the CH_PD to the switch, like this. The button switches the esp on, GPIO0 is used to keep it on until the transmission is complete, then the system powers down. Courtesy of this post.
With that solution, I won't even need to do messy stuff like unsoldering leds or soldering the GPIO16 pin of the microchip to the reset pin. Which is a rather intimidating task for a beginner like me. What do you guys think, is there any downside to this over the deep sleep method in this case?
Right now I'm considering my battery options. I could go with 2xAA, or a 18650 LiPo, or maybe just a single AA with a step-up regulator? I saw a few tests run by someone which I found pretty helpful. My project will probably be very light on power so I could potentially run from a single AA battery, but a lipo could be just as convenient with a lot more capacity. What would you recommend?
Finally, what would be the best way to check the battery level? It seems the common method is to use ESP.getVcc(). But if I'm using a regulator, it would be showing the regulated voltage, which probably would stay relatively constant until the battery dries out? Since I still have GPIO2 free, could I perhaps use that to measure the battery voltage somehow, by using some magic IC in between that converts analog voltage level to a digital signal?
If it has a bootloader like arduino it may have a significant delay on power-on. If it boots up in less than 100-200ms then this should not be an issue.
Can't you use the analog pin instead of "magic IC"?
I don't think the bootloader delay would be an issue, compared to the time it takes to authenticate with the wifi network and send the transmission to the server which will take a couple seconds anyway.
Yeah I could use the analog pin. I'm kinda trying to avoid soldering on delicate integrated circuits though. (I have a basic ESP8266-01 so there's no analog pin on the board). I'm debating whether readVcc would be useful at all with a regulator?
My project will probably be very light on power so I could potentially run from a single AA battery, but a lipo could be just as convenient with a lot more capacity. What would you recommend?
I would recommend a LiPo instead of a AA battery.
I guess a 3.7V LiPo would eliminate the need for a regulator (as long as I make sure the battery is not overcharged above 3.7V, I hear they can go up to something like 4.3V. If I connect it directly, would I need to worry about what happens when the battery runs out? I hear "almost all" lithium batteries have a safety circuit that shuts them off when they go below 3V, but I'm not sure if that applies to the basic cylindirical batteries (that look like oversized AA batteries)?
Or I could probably use 3xNiMh cells, which conveniently start at 3.6V and go down to 3V in a pretty linear fashion, which makes it easier to get a % capacity estimate. Of course, the downside would be a bulkier build size-wise.
I guess a 3.7V LiPo would eliminate the need for a regulator (as long as I make sure the battery is not overcharged above 3.7V, I hear they can go up to something like 4.3V.
I haven't looked at 3.7 LiPos, but yes, LiPos have a higher voltage than the nominal rating when fully charged. I believe a 1S LiPo is 4.3V fully charged as you mentioned. You will need a 3.3V switching regulator for the LiPo. Even still, you are much better off than using a AA battery.
I hear "almost all" lithium batteries have a safety circuit that shuts them off when they go below 3V, but I'm not sure if that applies to the basic cylindirical batteries (that look like oversized AA batteries)?
There's no circuitry inside the battery (LiPo or otherwise). There are safety circuits you can buy separately. Check out some of the RC battery safety circuits at hobbyking.com. They have good stuff.