Battery slow drain

I have a Micro Arduino that’s driving some LED strips. At the moment, the Atmel is powered by my computer’s USB while the LED strips are driven by a single Li-Ion battery that’s providing the necessary Amps for the LEDs. Ground is common across the whole circuit. At the same time, I have a single wire that’s going from the battery’s + terminal through a 10K series resistor to an ADC pin configured as an INPUT on the Atmel. That’s so I can measure the battery’s voltage. This measuring only happens ONCE, when the unit is first turned on. After that, it won’t ever go through that routine to check the battery again, not till the unit’s turned off and back on again. So, this all works great … except for one tiny issue: the battery tends to drain faster.

Here’s what I’m noticing:

  • with a fully charged battery, with the MCU NOT driving the LEDs (as in, it has them turned off, and its loop() is doing nothing but exiting every time), if I leave it sitting overnight, by morning the battery will be at about 80-75%.

  • now with the same scenario, MCU not doing anything, but I disconnect the wire that connect the battery to the ADC pin, the battery will be fully charged still by morning.

So it makes me wonder if it’s draining through the ADC pin. Ultimately the entire circuit will be powered by the battery. The Atmel will get 5V from a boost circuitry while the LEDs will continue getting raw power from the battery (4.2V down to 3.0V). I don’t know if the change will affect the battery drain.

If the battery is indeed getting drained through the ADC pin, how do I stop that? Or at least minimize it.

disable the ADC - leaving the ADC enabled may be quite thirsty

make the pin a digital input - analog inputs can also be thirsty

measure the current into the ADC pin - it should always be negligible

-mark

Ok, I’ll need some guidance then. I don’t know how to measure the battery’s current that would actually make sense to me. Reading the battery voltage I understand. And I also use that number. If I measure below 3.0V, I disable the unit entirely so it can no longer run its program to drive the LEDs (the LED drivers quit at 2.7V). Instead it starts flashing a single red LED which will be used as the indicator that the battery needs charging.

I don’t know how to translate current measurement to do the same. Especially since the battery can get all the way down to 2V while still providing full Amp drain.

What if I simply disable the ADC and input buffers after setup() has run? The only time A0 and A5 are used are during the setup(). A0 is being used to read the battery voltage, and A5 is used once to seed random. Once I’m out of the setup() loop, those pins aren’t used again … not till the unit gets restarted again.

So what if, at the very end of the setup(), I do something like this:

  // Disable ADC by setting ADEN bit to zero
  ADCSRA = ADCSRA & B01111111;
  // Disable analog comparator by setting ACD bit to one
  ACSR = B10000000;
  // Disable digital buffers on ADC0, ADC1, ADC4, ADC5, ADC6, ADC7
  DIDR0 = DIDR0 | B11110011;
  // (DIDR2 Register)ADC8, ADC9, ADC10, ADC11, ADC12, ADC13 are all used as digital pins

kirash4:

  • with a fully charged battery, with the MCU NOT driving the LEDs (as in, it has them turned off, and its loop() is doing nothing but exiting every time), if I leave it sitting overnight, by morning the battery will be at about 80-75%.

  • now with the same scenario, MCU not doing anything, but I disconnect the wire that connect the battery to the ADC pin, the battery will be fully charged still by morning.

So it makes me wonder if it’s draining through the ADC pin.

Your test would seem to leave little doubt that the [u]conclusion above[/u] is correct. And yet the makes little sense to me. Normally you make pins inputs to reduce power usage *by the MCU*. This also places the pin in a "high" impedance state, so I'd expect that it would minimize drain through the pin. And I correct in understanding that in both cases above the Arduino is left powered up via the USB connection ?

What’s the battery being used by the LEDs (mAh, type, size, etc) ? When you say 80%, what are the starting and ending voltages ?

I’ll have to read some on the Atmel pin topology but IIRC there’s no true tri-stating of them. Once pinMode has set it to be an input, I’m not sure if analog vs digital makes a difference to the world outside of the MCU ?? :?:

Do your experiment but I’ll be surprised if it helps now. Later, when everything is run off the same battery, it’ll be needed.

Mee_n_Mac:
Your test would seem to leave little doubt that the conclusion above is correct. And yet the makes little sense to me. Normally you make pins inputs to reduce power usage by the MCU. This also places the pin in a “high” impedance state, so I’d expect that it would minimize drain through the pin. And I correct in understanding that in both cases above the Arduino is left powered up via the USB connection ?

Yep, USB remains connected. Which also brings up another question: once this whole unit is powered only from the battery, I have an ON/OFF switch that cuts power from the battery to the VCC pins on the MCU. But what about the ADC pin? Should I be cutting that too so it doesn't backfeed back into the MCU? Right now it's not and would require a small redesign in the circuit (and PCB) to fix that.

Mee_n_Mac:
What’s the battery being used by the LEDs (mAh, type, size, etc) ? When you say 80%, what are the starting and ending voltages ?

18650 single cell Li-Ion, 1500mAh. Max discharge rate 15A (by datasheet and tested.) It charges up to 4.2V and when left alone it remains at that for a rather long time. I left one sitting for over a month and it barely budged ... went down to 4.18V. But when I leave it connected to the ADC (and only the ADC, I disconnected the LED drivers for that test), it went from 4.2V the night before down to 3.18V the next morning. When I disconnected the battery from the ADC pin, it was still 4.2V by morning.

Mee_n_Mac:
I’ll have to read some on the Atmel pin topology but IIRC there’s no true tri-stating of them. Once pinMode has set it to be an input, I’m not sure if analog vs digital makes a difference to the world outside of the MCU ?? :?:

Your guess is probably better than mine right now ...

Mee_n_Mac:
Do your experiment but I’ll be surprised if it helps now. Later, when everything is run off the same battery, it’ll be needed.

Yeah ... I think I need to go revisit the circuit and change the way the ADC gets to the battery since right now it's always feeding into it, regardless of whether the whole unit is turned on or not.

kirash4:
But when I leave it connected to the ADC (and only the ADC, I disconnected the LED drivers for that test), it went from 4.2V the night before down to 3.18V the next morning.

Wow, just wow ! That's a huge discharge in just 8-10 hours. I'll have to check an 18650 discharge curve but I'd have said that's well over 50% of the batt's energy, a rate of more than 75 mA ! That's hard (for me) to grok !!

ETA : Look at the mA vs time/voltage data here.

http://lygte-info.dk/info/Batteries18650-2011%20UK.html

The only way I see this happening is if you’re actually back-powering the whole MCU (and some) via the pin. Is the MCU a 3.3v device, running off a 5v->3.3v regulator ?

That’s why it caught my attention too, when I power cycled the unit and the battery level indicator flashed a little over 75% my brain screeched to a halt. I thought for sure I needed more coffee. So I tried it again, this time with a completely different battery, in case the first one was acting up. Same result. Then I tried it without the ADC wire connected and it stayed at full capacity. So yes, something’s up … I’m almost ready to add a cutoff circuit that only enables that connection when I need it, then severs the connection when I don’t. Another pair of MOSFETs, just like I’m already doing with VCC to the LED strings themselves. I cut power to them when the unit is “idling” or if it’s left turned on accidentally, but not running anything. The LED drivers will continue to suck ghost amps (which is why, for this specific drain test, I disconnected them.)

Mee_n_Mac:
The only way I see this happening is if you’re actually back-powering the whole MCU (and some) via the pin. Is the MCU a 3.3v device, running of a 5v->3.3v regulator ?

Remember, the MCU is running off of USB power right now (and running at 5V, no regulator to 3.3V). In the final design, the MCU will run off of 5V coming from a boost circuit, powered from the same battery.

kirash4:

Mee_n_Mac:
The only way I see this happening is if you’re actually back-powering the whole MCU (and some) via the pin. Is the MCU a 3.3v device, running of a 5v->3.3v regulator ?

Remember, the MCU is running off of USB power right now (and running at 5V, no regulator to 3.3V). In the final design, the MCU will run off of 5V coming from a boost circuit, powered from the same battery.
OK. This is something more than "leakage" into the MCU pin. It's way off the beaten trail and so should be 'easy' to figure out. Might take a coupke of MaiTais though. Too bad it's not Friday. :mrgreen:

Yeah, I’m going to let it sit over night tonight, with the ADC disabled.

kirash4:
Yeah, I’m going to let it sit over night tonight, with the ADC disabled.

More data is moar good.

Any chance your PC is sleeping overnight and turning off USB power ?

Mee_n_Mac:

kirash4:
Yeah, I’m going to let it sit over night tonight, with the ADC disabled.

Any chance your PC is sleeping overnight and turning off USB power ?
Not a chance, not unless the whole house loses power and the UPS dies (20 minutes later) which hasn't happened. But you do bring up a good test scenario: disconnect the USB cable, leave the battery connected to the ADC pin and see what happens ...

kirash4:

Mee_n_Mac:

kirash4:
Yeah, I’m going to let it sit over night tonight, with the ADC disabled.

Any chance your PC is sleeping overnight and turning off USB power ?
Not a chance, not unless the whole house loses power and the UPS dies (20 minutes later) which hasn't happened.
So you're not saying it's impossible ? :mrgreen:

I will predict that if you took the Arduino away, leaving only the LEDs and their circuitry and tied the MCU end of the 10k to ground … that the battery will show little to no discharge. Another experiment, if you can.

The discharge rate needed to deplete the batt to that voltage in 10- hours is more than can “fit” through a 10k resistor, 5+v to ground. Somehow something (?LEDs?) is coming (partially) on.

Mee_n_Mac:
So you’re not saying it’s impossible ? :mrgreen:

More like it hasn't happened. :)

Mee_n_Mac:
I will predict that if you took the Arduino away, leaving only the LEDs and their circuitry and tied the MCU end of the 10k to ground … that the battery will show little to no discharge. Another experiment, if you can.

The discharge rate needed to deplete the batt to that voltage in 10- hours is more than can “fit” through a 10k resistor, 5+v to ground. Somehow something (?LEDs?) is coming (partially) on.

I removed the LEDs from the circuit last night, so they wouldn't have affected the battery. The final design will cut VCC to the strips whenever the system is idling, again to prevent the phantom current that the drivers pull.

Battery’s charged up. No LED strings connected, ADC turned off after the initial measurement. Voltage is at 4.21V after sitting out of the charger for the last 30 minutes, not connected to anything. Let the testing commence.

There’s another reason I suspect the ADC is at fault here. Before I added the battery voltage check, I could play with the setup for a few days before needing to recharge the battery. After adding the battery voltage check, I’m recharging every night. Hrm. Maybe I need to research another way of checking battery voltage …

How sure are you about that 10k sense resistor ? If you grounded the ADC end you’d only load the battery with 0.42 mA max. Over 10 hours that’s 4.2 mAh out of your 1500 mAh battery. That’s less than 1% of it’s capacity. The voltage can’t have dropped that much as a result.

I assume the voltages cited were measured w/a DVM. The other thing to be aware of is bad A/D conversions w/high source impedance’s. The analogRead() function doesn’t give enough time btw switching the internal MUX and starting the conversion for the internal capacitances to become fully charged. A 2’nd consecutive read of the same pin is advised, tossing away the 1’st read.

How sure? As sure as me reading the colors, and measuring it now that you asked. As of this morning, with the ADC turned off, the battery measured 4.19V from last night’s 4.21V. That’s 0.02V over the course of ten hours which is what it was doing prior to me introducing reading the voltage through the ADC. Before I left the house, I turned the ADC back on and left it to see what it will read when I get home later this evening.

As for the voltages, yes they are measured with a meter. And when using the ADC, I take 20 samples over the course of 2 seconds before calculating an average.

kirash4:
How sure? As sure as me reading the colors, and measuring it now that you asked.

Hmmmm ....

Do you agree that from the battery discharge data (and commonsense, 4 mAh out of a 1500 mAh battery) that a load of <400 uA on average couldn’t drain that battery that much over 10 hours ?

That the worst load the ADC could present to the battery through the 10k resistor is 420 uA (4.2/10k) to start and 320 uA at end, and that would be by grounding the ADC end (not normal operation) ?

I have an Arduino Micro (not SFE ProMicro) as well. And an 18650 battery (3000 mAh), which is presently charging. I’ll try to replicate your experiments tonight and see what I get for a discharge curve (obviously less due to the 3000 mAh capacity).

Oh absolutely, in my mind there is no reasonable explanation as to why it got drained that fast, none. The one possible explanation is if the battery itself was having a psychotic episode and decided to drain itself. But I tried a second one and got the same result. That’s when I realized something else was wrong.

I’m hoping that when I get home later this evening I WILL see the same drain on the battery as I saw yesterday, with the ADC left on.That would at least prove it to be consistent and I’m not chasing a ghost. On the other hand if it isn’t, I’m back to square one in trying to figure out what happened. I know for sure I did not leave the LEDs plugged in, I’m purposely disconnecting them because I know they will pull a few microamps each (per driver, there are 96 of them) even when they’re not doing anything. So I really don’t know what else could be happening.