I am trying to minimize battery drain after putting the microcontroller to sleep. I am using this thread:
which shows that after powering down the ADC and brown out detector, and then entering SLEEP_MODE_POWER_DOWN, the mega328 should draw about .355uA. I am using this schematic:
but I don't have anything connected to the ISP6 header or the SD Card connector, and I don't have the GPS Module soldered in yet. In addition, I dropped the 8MHZ resonator when I was trying to solder it in and it is lost so I burned the arduino bootloader for an 8MHZ internal oscillator breadboarded mega328. The 3.3V buck/boost converter and the LiPo charging circuit are soldered up. This is my test sketch:
#include <avr/sleep.h>
byte mode = 1;
volatile boolean switchPress = false;
volatile boolean lastSwitchPress = false;
unsigned long modePress;
void setup()
{
//Serial.begin(115200);
pinMode(6, OUTPUT);
pinMode(9, OUTPUT);
digitalWrite(2, HIGH); //enable pull up
attachInterrupt (0, buttonPress, LOW);
sleepCPU();
}
//function to put everything to sleep
void sleepCPU()
{
// disable ADC
ADCSRA = 0;
set_sleep_mode (SLEEP_MODE_PWR_DOWN);
sleep_enable();
// will be called when pin D2 goes low
attachInterrupt (0, buttonPress, LOW);
// turn off brown-out enable in software
MCUCR = _BV (BODS) | _BV (BODSE);
MCUCR = _BV (BODS);
sleep_cpu ();
}
void loop()
{
}
Doing the math for everything that should be working on the board, it would be .355uA for the mega328, 50uA for the 3.3V converter, and it looks like about 2 - 5uA for the charge controller. In addition, with a battery voltage of 4.2V and VCC of 3.3V, I believe about 90uA((4.2 - 3.3)/10000) should be passing through resistor R8 and there is probably some current flowing through resistor R3 but I am not sure about that. Regardless, the amount of battery drain should be around 140uA or so but when I plug everything into my multimeter it reads 4.6mA when running the above sketch. Can anyone spot on my schematic or sketch where I may be draining the battery faster than expected?
LarryD:
You could quickly find out by using a razor knife.
Cut a power trace, insert the ammeter across the cut, then solder the trace.
Darn.....I was hoping to not have to start cutting into stuff. I bypassed the 3.3V converter and the battery charging circuit by just applying 5V to Vcc and I get a current draw in sleep mode of 170uA. I can't believe the converter or charger are sucking up 4.4mA. This is kind of disappointing to say the least. The whole thought process was that with everything asleep, the battery drain would be negligible. According to the datasheet for the converter, the quiescent current is less than 50uA and for the charger it should be less than 5uA. What could I be missing here?
I can't believe the converter or charger are sucking up 4.4mA. This is kind of disappointing to say the least. The whole thought process was that with everything asleep, the battery drain would be negligible.
DC-DC converters suck power (albeit, very little), even when there's no load.
According to the datasheet for the converter, the quiescent current is less than 50uA and for the charger it should be less than 5uA. What could I be missing here?
Maybe the 50uA is when the DC converter is not enabled?
I see an ENABLE pin on the converter hardwired in your schematic. Maybe you should connect this ENABLE pin to your microprocessor and enable/disable it when not needed.
How do you calculate the current for the 3.3V converter as 50uA? I can't find that on the datasheet. You have the PS pin tied to +5v, so you're not even using its power save mode.
[EDIT: OK I found the 50uA figure on the datasheet. It's measured at 3.6V input, however it doesn't say whether it is measured with PS tied high or low.]
Device Enable
The device is put into operation when EN is set high. It is put into a shutdown mode when EN is set to GND. In
shutdown mode, the regulator stops switching, all internal control circuitry is switched off, and the load is
disconnected from the input. This also means that the output voltage can drop below the input voltage during
shutdown. During start-up of the converter, the duty cycle and the peak current are limited in order to avoid high
peak currents flowing from the input.
Ahhhh.....I always manage to miss something. Well not the end of the world. I assume that I can't disable the converter without fouling the power supply to the mega328? I guess I can just keep it plugged into a charger when not in use.