I'm trying to measure single-cell li-ion voltage using a voltage divider and an analog pin on a Mega. That is fine, but in order to reduce the standby current, it would be great to be able to switch the voltage divider off completely.
I believe a FET could be used to switch the circuit on/off (taking into account the resistance across the FET), but would it be ok to connect the circuit so that the ground is into a digital pin on the Mega instead?
That way, can the pin be set as a sink to turn the circuit on, then the voltage measurement can be taken after waiting a millisecond or so, and then the pin turned off again.
Sure, just don't exceed 20mA of sink current, and calibrate what the voltage is at the "ground" pin, as it won't be Zero, but could be as high as 0.9V (current dependent).
I think you'd have better results with an external MOSFET such as AOI510 with its very low Rds.
About as close to just having a wire as you can get.
AOI514 would also be good, 30 cents less, but back ordered (& overdue) at the moment.
Yes, you can do that. But keep in mind the Arduino pin and the mosfet option does not reduce the current to 0 when disabled. This is because the measurement pin (and the on/off gnd if you go with that as well) is still connected. And the pins of the Arduino are clamped to Vcc.
So when you disable the divider you still have a resistor between the battery and the Arduino pin which can't rise above 5,5V (is Vcc is 5V). So you have a current of (Vbat - 5,5V) / R when it's turned off. And that current may not be to high as well. That should be less then 1mA. But you probably don't want a battery voltage voltage divider that takes more than 1mA anyway.
But is your application that critical? You can't miss a few some uA?
I was thinking a P_channel MOSFET between the battery and resistor chain would eliminate that problem. Pull the gate low to turn it on for a measurement, let the battery pull the gate high to turn it off.
Can get a 0.048 ohm SMD part for 38 cents.
Get a little SOT-23 adapter board to wire it up on.
You can indeed do that. But without a sinking only output (aka n-mos of NPN) you still have a problem with the gate. Yeay, you can pull it up to battery voltage but there still is a connection between the pulled up gate and a Arduino pin.
Is this single cell permanently connected to the Mega.
Is it used to supply something.
Why are you using a divider for a single cell.
What are the resistor values now.
Too many questions to give a proper answer.
Post the diagram, with parts values.
And the code, inside code tags.
Leo..
Thanks for the responses everyone I have my own PCB but it's through-hole only (Seeedstudio). I'm happy with some surface mount stuff and can add footprints to it easily enough.
septillion:
But is your application that critical? You can't miss a few some uA?
It's critical to us! Are you suggesting we just use high-value resistors in the divider and live with the small leakage? We could do - I just thought using a pin would be a simple solution to stop the leakage when not measuring.
Wawa:
Is this single cell permanently connected to the Mega.
Yes - it's looking that way. We were considering a mini-pro to control a 5V boost that powers the mega, but we're now just looking at using a mega-pro at cell voltage (we'll limit to 3.3V at the bottom end) or regulated to 3.3V and living with 8MHz.
Wawa:
Is it used to supply something.
Not sure what you mean? There are some peripherals on the mega (modem, SD cards, RTC, screen), but no motors or anything heavy.
Why are you using a divider for a single cell.[/quote]
For accuracy initially. My understanding is that the comparison source voltage has to be higher than the voltage being tested, and also that the 2.5V internal source is more stable than an external 5V supply, hence the voltage divider to get the lithium-ion voltage divided below 2.5V for measurement. Now we're leaning towards a 3.3V mega, but still planning on using the 2.5V internal source (assuming it is stable - we could add an external reference voltage).
Wawa:
What are the resistor values now.
There aren't any - they're still theoretical. 1M top and bottom maybe? We don't need the measurement to be particularly quick.