Electronic – How to a micro controller turn off itself by closing the VCC line when battery is low

batterieslithium ionmicrocontroller

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 ?

Best Answer

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.