Power consumption, 4 "C"-batteries


I’m powering my electric imp with 4 “C”-batteries connected in series. My program is really simple and only triggers code on a interrupt. I wonder how long I could expect the electric imp to work before the batteries run out. The wifi is online at all time.

My knowledge regarding batteries and current draw is very bad. I know that threads with very basic questions could be annoying. I understand that there are a lot of variables for example which type o C-battery but I just wan’t to know what I should expect very roughly.

Best regards, Hannes

The answer depends very much on what the imp is doing after an interrupt.

If you just let it run out of Squirrel commands (reach the end of the interrupt handling function), the wireless will stay on and the current draw will stay up in tens of milliamps.

But you can also send the imp into deep sleep after handling the interrupt, only to wake up on pin 1 high, then the current draw will drop to microamps, and the batteries will probably last for months. In this scenario, when you wake the imp up with the interrupt pin it will first take a second or so to reconnect to wireless before running you interrupt function. Also don’t just test for pin 1 high to confirm the interrupt state, but check the wakeup reason for pin1 wakeup. If you can afford a delay of a second, this will give the longest battery life by miles.

Something like:

`// pin 1 is digital input and wakeup from deep sleep
button <- hardware.pin1;

// did pin 1 just wake us up?
if (hardware.wakereason()==WAKEREASON_PIN1) {
agent.send(“button”, “Doorbell pressed”);
imp.onidle(function() { imp.deepsleepfor(600); });

Stage One of the process is to work out how much energy is in the battery to start with. Battery manufacturers deliberately (fraudulently?) don’t make this easy to determine, but there are rough values at http://www.allaboutbatteries.com/Energy-tables.html, so let’s assume your batteries are “alkaline long-life” with about 30kJ in each – so with four you have 120kJ, or 120,000J.

With WiFi on but not doing anything, and with imp.setpowersave(true), the imp draws about 10mA at 3.3V, or 33mW, or 0.033W. A watt is a joule per second, so the imp should last 120,000J/0.033W or about 3,600,000 seconds, which is 42 days. (A more accurate calculation would include the power loss in the power-supply chip that converts the batteries’ voltage to the imp’s 3.3V, but if we’re being approximate then we can ignore that.)

As Dr Jack says, though, if you can arrange that your imp is only powered-on by your interrupt event happening, then you can do much better than that: if the imp is mostly in deep sleep, where it draws about 20uW or 0.00002W, then your battery life would be enormous.



Thank you very much for your answers. This helps me alot.

Funny thing is that this is a doorbell application :slight_smile:

I will start with using the wifi power save and put the imp in deepsleep during the night and see what battery lifetime it gives me.

Best regards, Hannes

Aha - for my doorbell, I let it deep sleep all the time but wake it on a PIR detector on pin 1 whenever anybody approaches the door. Then it is awake and responds immediately to a doorbell on another pin (or mail in the mailbox). Just pick a PIR with low current drain, mine is about 20 microamps. And you can send an SMS to your phone via Twilio for any combination of these events.

Maybe a “buffer elco” on the input like tombrew suggested here would help your battery life
Tom: "When the imp turns on its WiFi transmitter, it can draw a lot of current (up to 400 mA, during initial calibration) from your power supply. To keep this sudden current draw from “drooping” the power supply and browning out your tempBug, we’ve got a BIG HONKING CAP"

edit link (better copy paste it in new window, forum hates my links :slight_smile: )

Yes, a capacitor will definitely help (eg 220uF 16v electrolytic). This will help supply the higher current peaks that the April board will draw when supplying the imp.

Alkaline batteries have a lot of capacity, but also a high internal resistance (imagine there’s a resistor in series with a perfect battery and you’ll get the idea). This means that if you draw a large amount of current from one, the voltage will droop due to the losses form the internal resistance. This is why if you run down alkalines in a high draw application, when you take them out of the product you’ll notice they’re warm - this is due to the power being dissipated within the battery itself.

Adding a cap allows the capacitor to supply these short peaks itself, which means less power lost in the battery.