 # Voltage divider - power usage improvements?

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 :)

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.

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

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.

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?

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.

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.

cjcj1949: 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

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

strykeroz: 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.

dc42: 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

strykeroz:

dc42: 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.

Thanks retrolefty - I think I get how that comes about. Thanks for the explanation.

Geoff

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:

This looked like a viable solution: http://n0m1.com/2012/01/28/adc-battery-voltage-divide-match-and-measure/

Michael