My board has a Li-ion battery with the capacity of 4000mAh and maximum voltage of 4.25V and minimum voltage of 3.25V . This means that the battery voltage shouldn't get lower than 3.25V.

When the adapter connector (the input 12V 3A voltage) is removed , all of the components of the circuit turn off except a micro controller that uses the battery voltage until the battery voltage reaches 3.45V and one LED to show that battery is discharging.

The micro should be apprised of the lowness of the battery when the battery voltage is 3.45V (0.2 volts higher than the minimum voltage) and copy important data to EEPROM and then turn itself off to avoid battery discharge much and become unusable.

The micro controller will be still off until the adapter connector connects to the board again and then it will recover the important data from EEPROM to SRAM and continue its work and also control charging the battery with PWM until it get fully-charged.

How can the micro controller (ATMega32A) turn off itself ?

  • \$\begingroup\$ Is this what you're looking for? \$\endgroup\$
    – user17592
    Commented Sep 10, 2014 at 9:20
  • \$\begingroup\$ @CamilStaps No, I want the micro controller to turn off it self for example by creating a pulse to a component and some thing like that. \$\endgroup\$
    – AHB
    Commented Sep 10, 2014 at 9:27
  • \$\begingroup\$ Right, otherwise you cannot copy important data first. I'm sorry. \$\endgroup\$
    – user17592
    Commented Sep 10, 2014 at 9:29
  • 4
    \$\begingroup\$ perhaps this article might help mosaic-industries.com/embedded-systems/microcontroller-projects/… \$\endgroup\$ Commented Sep 10, 2014 at 10:17
  • 1
    \$\begingroup\$ @JImDearden You should turn that into an answer (add some explanation, not just the link), I think that is actually what the OP needs. \$\endgroup\$
    – tcrosley
    Commented Sep 10, 2014 at 11:13

1 Answer 1


One simple way is just to go into low power mode. The chip can draw just 100nA in low power mode, which is pretty close to being off. Here are more details of the Arduino's low power modes.

Alternatively, supply the Arduino's power through a PNP transistor. The Base should be weakly pulled high using a 10k resistor. The Arduino holds the Base low to stay on. When it wants to turn off, it lets the Base get pulled high to shut off the power.

  • 1
    \$\begingroup\$ I think it might be unclear to the OP how to recognise the threshold. \$\endgroup\$
    – user17592
    Commented Sep 10, 2014 at 9:23
  • 2
    \$\begingroup\$ @CamilStaps - I assumed from "I don't know how can the micro controller (ATMega32A) turn off itself." That that's the thing in question. \$\endgroup\$ Commented Sep 10, 2014 at 9:24
  • 1
    \$\begingroup\$ @Rocketmagnet My English isn't very well. I meant "How can a micro controller turn off itself." \$\endgroup\$
    – AHB
    Commented Sep 10, 2014 at 9:39
  • 4
    \$\begingroup\$ better to use a P channel MOSFET \$\endgroup\$ Commented Sep 10, 2014 at 10:16
  • 4
    \$\begingroup\$ With the transistor you'd need a dedicated button to turn the Arduino on, or maybe extra circuitry to turn it on when power was disconnected then reapplied. If the low power mode really does draw less than a microamp then I'm sure this is the best way to go, as this current is probably small compared with the battery's own self-discharge rate anyway. \$\endgroup\$
    – nekomatic
    Commented Sep 10, 2014 at 11:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.