Go Down

### Topic: Voltage divider - power usage improvements? (Read 5981 times)previous topic - next topic

##### Apr 19, 2013, 02:05 am
Hi all,

I've setup a voltage divider to provide low voltage warnings on a 12V battery powering my project.
Can you see any improvements to my method of monitoring a (solar charged) battery?
Power usage is more of a concern than accuracy so would higher value resistors be preferable?

I setup two resistors (10K & 4.7K), tested the voltage and recorded the corresponding analogRead(A0) number

analogRead = 858 | multimeter = 12.44v for the battery (4.0v at A0)

I then divide the analogRead value by 68.9 (1 volt with the above resistors)

Serial.println(sensorValue/68.9); //Gives 12.48

Thanks

#### MarkT

#1
##### Apr 19, 2013, 02:12 am
Yes higher value resistors are a good idea - however above 10k impedance the ADC accuracy
will be reduced - however you can fix this with a 100nF capacitor from the divider mid-point to
ground, then resistors can be much higher value (the capacitor is low-impedance at AC).  Something
like 1M and 470k plus the 100nF should work I think.
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

#### tobyb121

#2
##### Apr 19, 2013, 10:09 am
If you are calibrating your resistors for each setup, like you have done here, then this method would be fine, but remember that most resistors have a 5% tolerance, so your measurement affected

#### dc42

#3
##### Apr 19, 2013, 11:03 pm
There are two issues with using higher valued resistors in a voltage divider used to feed an analog input:

1. The input resistance of the ADC is about 100Mohms. So a high enough source resistance will degrade the accuracy.

2. The analogRead call doesn't include any delay between switching the multiplexer to the desired input and starting the ADC conversion (I regard this as stupid). This means that the sample capacitor has only about 1.5us to charge through the source resistance. I sometimes patch the wiring_analog.c code to fix this. However, if you are monitoring a fixed voltage, there is an alternative hardware fix, which is to connect a 0.1uF capacitor between the analog input and ground.

In one project that ran from a 9V battery and had no on/of switch, in order to monitor the battery voltage I used a voltage divider comprising two 4.7M resistors (and the 0.1uF capacitor), so as to keep the current consumption of the voltage divider to less than 1uA. This arrangement introduced a source resistance of about 2.35Mohms and hence degraded accuracy by about 2%, but that was acceptable.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

#### cjcj1949

#4
##### Apr 20, 2013, 12:56 am
How much current does the rest of your circuit use? What accuracy do you want? How much current will the alarm consume? Is this a one off or part of a production run. What is the purpose of the low voltage alarm?

#5
##### Apr 23, 2013, 02:34 am
This for a chicken coop project with many sensors and a few motors - unsure of the current usage yet. Accuracy is not important, I just require an early warning if the battery is running low (as the door must open or alert that this has not happened) So I can intervene and charge the battery (Winter for example, may not be enough light even though the solar panel is excessively large)

This project uses a 12V 12AH battery charged by an 80W solar panel.

#### cjcj1949

#6
##### Jun 17, 2013, 06:39 pm
The potential divider circuit only needs to be connected when you are taking a measurement. The bottom of the divider could be an output which is only taken low just before a measurement. Sleep modes may also be useful.

#### retrolefty

#7
##### Jun 17, 2013, 08:20 pm

The potential divider circuit only needs to be connected when you are taking a measurement. The bottom of the divider could be an output which is only taken low just before a measurement. Sleep modes may also be useful.

The problem with that is if you let the bottom resistor 'float' free then the analog input pin will 'see' the total voltage that is applied to the divider circuit which would then exceed the maximum safe voltage that can be applied to an AVR pin and puts the AVR's internal protection clamping diode at risk.

Lefty

#### strykeroz

#8
##### Jun 17, 2013, 11:31 pm
Could you control the GND at the bottom end of the divider with an N-channel 2N7000 MOSFET or similar, such that the divider only makes a circuit when another output is held HIGH?

Geoff
"There is no problem so bad you can't make it worse" - retired astronaut Chris Hadfield

#### dc42

#9
##### Jun 18, 2013, 12:01 am

Could you control the GND at the bottom end of the divider with an N-channel 2N7000 MOSFET or similar, such that the divider only makes a circuit when another output is held HIGH?

That wouldn't help, because current would still flow from the +12V source through the upper resistor and into the pin protection diode of the mcu. However, you could use a P-channel mosfet to interrupt the top end of the potential divider,  driven from an N-channel mosfet or NPN transistor, which is turn is driven from the microcontroller. But unless high accuracy is needed, I'd just use a voltage divider made from a 4M7 upper resistor and 2M2 lower resistor (with a 0.01uF or 0.1uF capacitor connected in parallel with the lower resistor). That combination will only draw about 2uA @ 12V, which I expect is acceptable in this application.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

#### strykeroz

#10
##### Jun 18, 2013, 11:49 am

That wouldn't help, because current would still flow from the +12V source through the upper resistor and into the pin protection diode of the mcu...
Good point.  What if you combined it with setting the pull-up resistor in the input pin on the MCU?

Geoff
"There is no problem so bad you can't make it worse" - retired astronaut Chris Hadfield

#### retrolefty

#11
##### Jun 18, 2013, 04:43 pm

That wouldn't help, because current would still flow from the +12V source through the upper resistor and into the pin protection diode of the mcu...
Good point.  What if you combined it with setting the pull-up resistor in the input pin on the MCU?

Geoff

That would not change the fact that the input pin's positive protection clamping diode inside the AVR would still 'see' the +12vdc source voltage if the negative lead of the divider was 'floated' from ground.

#### strykeroz

#12
##### Jun 18, 2013, 05:01 pm
Thanks retrolefty - I think I get how that comes about.  Thanks for the explanation.

Geoff
"There is no problem so bad you can't make it worse" - retired astronaut Chris Hadfield

#### gardner

#13
##### Jun 18, 2013, 05:13 pm
I have a similar battery monitoring requirement for a sealed lead-acid battery that charges through a solar panel.  What I do is drop the battery  voltage through a zener diode and then feed that into analog input.  The down-side is that you need a reasonable current -- on the order of 1ma -- to get the zener voltage to stabilize.  I just have a 10K resistor to ground.

There was quite a long thread not long ago, covering a lot of this:
http://forum.arduino.cc/index.php?topic=127544.60

#### mrmonteith

#14
##### Jun 18, 2013, 05:59 pm
Working on instrumentation amplifier for experimental rocketry to measure thrust and chamber pressure.  Could be used where instrumentation

Go Up