7 years, 10 months ago.

analog in values sparatic...

I'm trying to read the voltage across a battery using a simple voltage divider.

Vbat (11V) -> 1k Ohm resistor -> p20 -> 270 Ohm resistor -> GND (Battery and mbed)

I've used this circuit before the measure the value of the battery and when I place my multiplier on p20 and ground I do not see the value fluxuating, it stays at around 2.6 V. However the readings from the analog in pin are all over the place and most of the time much lower than they should be. What could case this?

1 Answer

7 years, 10 months ago.



Note: Keep in mind that most microcontroller's analog-to-digital convertors have very low input impedance (low resistance). This means that connecting your voltage divider to a microcontroller directly will likely negatively affect the measurement value. It would be better to connect a non-inverting buffer between the middle node of the voltage divider and your ADC input pin to reduce loading effects.

Using a voltage divider is really only for when you are drawing almost to no current eg. to the gate of a CMOS transistor or to the terminals of an op amp.

In this case he is right, and what you are seeing is the loading effects. What is happening is that the load you are connecting's impedence is put in parallel with the 270 ohm resistor, which changes the outcome.

The LPC1768 has at least compared to atmels a fairly low input impedance. However it is still much larger than 270 ohm, so that shouldn't be causing it.

posted by Erik - 11 Jan 2013

I found that grounding the battery with the mbed solved the problem. My actual wiring was this:

Vbat (11V) -> 1k Ohm resistor -> p20 -> 270 Ohm resistor -> GND (mbed)

Vbat (0V) -> x

By connecting the battery 0V output to the mbed ground it solved the problem. I'm unsure why though.

posted by Tyler Weaver 11 Jan 2013