Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Arduino on Battery: True No-Current Power-Down
#1
Need a hybrid powered Arduino - either battery, USB or wall adapter. Battery portion turned ugly - even though Atmel AVRs CPUs (like ATMEGA328P or ATMEGA2560) have good power management built-in and CPU can sleep with 1uA current, Arduino boards designers did not think of battery power and there is no easy way to power just processor without other circuitry. Other brands of CPUs have special Vbat pin that keeps CPU core powered even when Vcc is removed, unfortunately ATMEL does not have it. MEGA board takes approx 3.5mA when CPU is in 1uA power-down - 3.5mA will last approx 12 days from 1Ah battery, not good enough. I would like to be able to pick up my contraption in few months or even a year and work without having to charge battery.

Notice the title says "Arduino" not Atmega or AVR. It is easy to put barebone AVR on battery due to strong power management features, one can make a sensor that will work from button battery for years just by keeping it in power-down and transmitting actual events and periodic "i am alive" statuses only. People built their own barebone Arduinos that can go to power-down, but this is not what I am looking for. I do like to keep convenience of additional circuitry like voltage regulator, like USB/UART converter or standardized shield headers on board.

After some trial and error below is hardware solution. It is bistable switch that can be turned-on by a momentary push of POWER_ON button and can be shut-off by driving BAT_OFF high, so 1x GPIO needs to be reserved for this functionality. This can be used for any circuit that has spare output and does not require waking-up by itself periodically. It would be very useful for circuits on low capacity batteries like CR2025 (150mAh) or CR2032 (220mAh) like wireless sensors and switches.

   

Another advantage - circuit disconnects battery on short. I am using Li-Ion and they are very low internal impedance and can easily burn wires.

The Rp 3.9ohm/2W resistor is not required if you can guarantee no accidental shorts (i.e. enclosed system with no tampering). I also need this one for current sensing, so in final project it will have dual function.

How this works ?

Initially T1 and T2 are closed, the only curent flowing is transistor leakage, which is in realm of nA for modern small transistors.

When button is pressed the T1 will open and enable output, this opens T2 which will latch T1 in open state.

When BAT_OFF is activated, it closes T2, which will close T1 and power is disconnected.

When powered from external 5V source (e.g. USB or VIN regulator), T1 acts as diode preventing current back-flowing into battery. Technically there will few uA flowing back into the battery through R1, but this will not hurt it.

Code

It is very simple to shut off, just turn the output to high:

Code:
#define BAT_OFF 52

void batteryOff()
{
    pinMode(BAT_OFF, OUTPUT);
    digitalWrite(BAT_OFF, HIGH);
    delay(1000);
}

Does is work ?

I did not test it extensively, but preliminary it works as expected.

UPDATE: there has been few iterations of this circuit, as originally I planned using RESET button, but this turned out very tricky as powered down ATMEGA I/O acts as weak pull-down due to AVRs internal I/O protection diodes. That's why the picture below does not sport a power-on button from above schematic, the new version has it.

The C1 was added because originally when closing T2, the power would not drop instantly but due to capacitors it mat take few ms. As power is dropping, the CPU resets and disables BAT_OFF, which will stop the process of shutting down and returns back to powered state. The C1 will be charged by CPU and will hold the emitter high even as CPU resets, so the process of power down can complete. If the capacitance is too high, tie CPU will not have chance to charge it enough before it resets. 1uF turned out working quite well.

   
Reply
#2
Thumbs Up 
Hi Roman,
May I be the 1st to say "YES! This is the kind of thread I like best!".
This is the "engineered" part of circuit design that I lack the skills to do.
Walking through your circuit I can understand what is taking place.
Providing an explanation and supporting code also make it practical to use.
I like the case design in the picture as well...where did you get that?
Many thanks Roman,
Bob D
Reply
#3
There is still a bit of a problem with backfeeding 6.5mA to the lithium cell, hopefully it's just transistor selection.

As for the case, Bob, don't laugh. Dolarama is a goldmine for repurposable things. If you look closer, I had to cut the piece of the 18650 cell holder, but fitting it in that corner leaves me half case real-estate for an actual tester.

I am still looking for small suit-case like plastic enclosure of about that size (20x8x3.5cm) and this is closest I have found. If it did not have round corners, it would be better.

   

   
Reply
#4
Hi Roman,
That is what makes a true "Maker" ...seeing an item with one purpose and finding several more uses before you get it home.
I did a trip to the dollar store and picked up one of the Pocket Juice Super Thin 1350 mAh chargers. There are as you say so many items that can be used for very reasonable prices.
Bob D
Reply
#5
Hi Roman,
I was just wondering if you found any better transistors or solved the leakage issue?
I want to keep this as a "cheat sheet" as i am sure i will need a circuit like this someday.
Also, what transistors have you tested with so far?
Is a logic MOSFET and option in a circuit like this...possibly for the latch?
Bob D
Reply
#6
Bob, this is still TBD.

Transistor I used was S8550 and S9013 just because I have bunch of them in my drawer and they are able to do 0.5A

Btw. another thing that is needed for my portable LCD is floating contrast - seems that contrast setting is fine between 4-5V but going under 4V it's better to simply ground contrast trimpot (e.g. with GPIO). This was actually reason I made this article about measuring own voltage. When battery voltage drops under 4V, the CPU should simply do

Code:
pinMode(PIN_CONTRAST, OUTPUT);
digitalWrite(PIN_CONTRAST, LOW);

This leakage is resolvable, I did not have a chance to look at it yet. Technically, a few mA is not going to explode the Li-Ion (20mW is not enough power to overheat the cell) and I am using cheap Chinese 5000mAh fakes that cost $1 and have real capacity around 1000mAh (measured with this BT-C3100 smart charger).

NOTE: when buying 18650 keep in mind there is no such think as 5000mAh 18650. Li-Ion energy density is 250–676 Ah / L. Outside volume of 18 x 65mm 18650 is 16.5mL, inside will be closer to 15mL. Even at the highest density 676 Ah/L the theoretical limit will max at some 2900mAh (simplified calculation with constant average voltage 3.5V, should be actually continuously measured and integrated). Highest energy density 18650 seems to be currently Panasonic NCR18650B with advertised 3400mAh and this one sells for USD $60/4pcs.

Anyone is welcome to try this circuit with different transistors.
Reply
#7
I think the back-current leak is caused by 68k resistor. The PNP transistor may work even with collector and emitter swapped, it will not have much beta (h21e) but it will still leak. Without 68k resistor there is no current path from collector through base, so it should isolate battery and 5V better.

But, that circuit is also sensitive to different capacitive loads, so I was looking for different design with better repeatability.

Ultimate on/off circuit based on here Fig.6.

Short press - turns ON. Long press, turns OFF. CPU can shut itself off by shorting button with GPIO. Capacitive load does not matter in this circuit.

It needs CD4011 I currently do not have, ordered few. CD4011 should take few nA quiescent current.

74HC00 would work but higher quiescent current - approx 40uA.


Attached Files Thumbnail(s)
   
Reply
#8
Hi Roman,
Nice site link; I spent some time reading through it and bookmarked it for follow up.
Some battery operated projects may be on the horizon; this will be a great front end power control.
Bob D
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)