7 years, 2 months ago.

Measure Voltage level at Vin?

Is there a built in way to measure the voltage level at the Vin pin?

Initially I built up a voltage divider circuit to measure my battery voltage on a ADC pin, but then it seemed that my math was off until I realized there is about 1.38k Ohms resistance from the Vin to Ground pin, that being in paralell with my voltage divider was screwing with my numbers.

1 Answer

7 years, 2 months ago.

There is no direct built-in function for that, you will need to use a voltage divider. But an impedance parallel to your voltage divider shouldn't matter: it is just about the voltages at both ends of the voltage divider and the ratio.

As a random guess: did you use very large resistors? The official max is 7.5kOhm according to the LPC's datasheet. The slower the ADC works the higher you can probably choose it. For an AVR my solution would then be placing a capacitor between ground and the input of the ADC, but apparently the LPC's aren't big fans of that, 15pF max according to specs.

So still assuming those resistors are indeed large, two solutions: either use an opamp to buffer the voltage, or use smaller resistors.

Accepted Answer

I used a 47.5 kOhm and 100 kOhm. I will try smaller resistors, thanks.

posted by Tyler Weaver 15 Oct 2012