Electronics > Beginners

Measure voltage and current with a micro??

(1/3) > >>

Christopher:
I'm looking to accurately measure voltage and current, to then display on an LCD (Either be boring and use an HD44780 or use a large 7 segment LCD panel http://www.lumex.com/specs/LCD-S401C52TR.pdf), for the output of my bench power supply.

I'm looking for 10 or 100 mV/mA accuracy, probably 100. From what I can see, Dave's rev C board steps down the voltage and passes it to an ADC.   Can anyone shed some light onto this? Current is probably not needed, but voltage is a must.

IanB:
You can buy digital panel meters that will measure and display voltage for you just like analog panel meters do. They don't start out super accurate, but you can probably trim them to improve the accuracy somewhat. How accurate do you want the display to be?

Christopher:
To the hundred milli-volt  or similar, like 5.1V or 6.34V. The problem with the panel meters is the fact they're so expensive £15-20. I'm sure that some digital circuit can reduce this cost.

bingo600:
Whats the measured Range ?

A voltage divider and an AVR would give 10 bit resolution (1024 steps)

/Bingo

Christopher:
Let's say about 20v max or something? I see how a potential divider could be used, because the Aref max is Vcc which happens to be 5v,

Aref=5v so we have to step down the input voltage to something between 0 and 5v.

R1 = 30k
R2 = 10k

If Vin = 20v, Vout = 5v
If Vin = 15v, Vout = 3.75v
If Vin = 10v, Vout = 2.5v
If Vin = 5v, Vout = 1.25v
If Vin = 0v, Vout = 0v

This is a really neat solution! One that I wouldn't have thought of in a billion years! I'd probably use an aref of something divisible by 1.024v so it'd make the calcumalations simple, but that's not really important.

Is this very accurate? I'd say it depends on the resolution of the ADC (May use internal 10 bit, but external 12 bit could be used.)

EDIT: 2.048*(2^-8) gives a resolution of 8mV. Very nice! Hopefully going to lay down a schematic soon, seems rather simple!
EDIT AGAIN: Math simplifying fail, 2.048/2^8 seems "cleaner" to me.