As many on this forum and in general at IoT, I'm looking for a way to extend the battery life, or... to not use a battery at all.
I do have a technical background, but not in electronics. I don't have a lot of requirements about when or if the Espruino should work, because I was thinking about this:
Hi! What you're planning sounds fine - the nice thing about microcontrollers is they really don't care if they lose power halfway through something (although you should avoid writing to their flash memory).
The only gotcha is that WiFi really does burn an awful lot of power when on, and it takes a few seconds to connect while using all that power - so you may struggle with power usage unless you have a good supercapacitor.
If you don't need WiFi then I'd suggest Bluetooth LE - it's way lower power, and you can realistically run off harvested energy quite easily.
Thanks for your reply. I want to use wifi mainly for sniffing every 2 hours. So some writing to flash would be needed for a short amount of time.
Maybe a lightsensor could help to get an indication about the ambient light and thus the solar cell / supercapacitor.
But when it sees a trusted network, like office or home it should calculate if there is/was enough light and if a trusted network is within reach to upload the log of wifi sniffing. The device will be outside, so logging light every 2 hours will also give an indication if it is morning or evening. In the evening the supercapacitor should have enough power to run for 5 seconds or something like that.
If that won't work, the device will be at the office or at home, at a trusted location, so we can pick it up, power it and upload the log as well.
What type of capacitor should work in this case? How easy can the circuit be?
Yes, I'd think that would work fine - the processor can detect the voltage on itself so if the voltage is below 3.3v it knows that the capacitor has discharged past that point. It'll run until about 2v I believe so as long as you have over 3v on the capacitor and WiFi is off you could be pretty confident there'd be enough power to write to flash.
There have been a few posts about powering from solar. Personally I've found the supercapacitors I tried a bit of a mixed bag and I don't really feel confident recommending anything.
However what I'd suggest is you just buy a cheap solar USB battery bank. While you can't run directly off USB since the USB power supply in the bank will use too much power, you can just crack it open and connect the Espruino directly to the battery inside - then you have a neat solar + battery solution in a decent case.
If you really wanted to go for something neat you could pull the big battery out of the solar USB charger, and replace it with a smaller battery and fit the Espruino WiFi in the remaining space.
Thanks for your feedback. Measuring voltage is a very good idea. If it's low: go back to sleep/idle and safe energy for a later moment. Using a solar battery charger is a good idea, maybe those solar powered garden light can be useful as well, just to see what circuit they have.
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem