82Views8Replies

Author Options:

Having trouble measuring accurate voltage with arduino. Answered

For a week now I’m trying to get very precise voltage readings with no luck so far. I’m using a voltage shunt regulator (LM431) for reference but still. My goal is to read values low as a 1mv change. I’m using a voltage divider to convert 38 volts to 4v (According to my vref). I've read that 10 bit ADC in atmega328 is enough for this job. Is it or am I doing something wrong?
Thanks

P.S i have made a lot on changes to my circuit so please go over to my new link to get up to date. Ive read all of your feedback and tried to implement it. Thanks a lot for all your answers. 
LINK: https://www.instructables.com/answers/Having-trouble-measuring-voltage-with-arduino/

Tags:Arduino

8 Replies

user
Downunder35m (author)2017-12-31

You did the wrong approach.
The guys already pointed to the basic problem at ahnd but I think there is more to it once we see some code you used.
You don't need a lot of fancy stuff, just something accurate enough ;)
A precision shunt will be good for measuring amps in the direct comparison way.
But with a fixed reference voltage and a comparator IC you can get get quite accurate measurements for voltages too.
The trick is to know what the CPU can provide and where you need to compensate externally.
You would need to create a precise circuit to give you a reference voltage between 0 and 5V for you measurement range.
This can then be mapped to a normal input but only with the "spacing" available from 1024 different values which will bring you back to 0.004V...
There is an old computer trick that back in that day worked with low and high bits, a simple way to get more resolution by using two inputs instead of just one.
Still you would need at least 4 inputs for this to get what you desire.

Before we did any further:
Do you need a voltmeter or do you need the Atmega to use whatever input you get to do weird things?
For the first I would just invest in a multimeter....

Select as Best AnswerUndo Best Answer

user
iceng (author)Downunder35m2017-12-31

Well pointed out... A software guru can coax out an extra bit by doing a hundred car running average..

Select as Best AnswerUndo Best Answer

user
steveastrouk (author)iceng2017-12-31

Precision, but not accuracy

Select as Best AnswerUndo Best Answer

user
iceng (author)steveastrouk2017-12-31

+1

A lot of my soft work is to make an area sensor read the same 4 digits on the same target..

Select as Best AnswerUndo Best Answer

user
iceng (author)iceng2017-12-31

For accuracy you use a 14 bit serial ADC with its own reference and throw away the bottom two LSB.. Then you profile that NON-Linear ADC and use the lookup table adjust... Take a real long look at your voltage divider for stability too...

Select as Best AnswerUndo Best Answer

user
Downunder35m (author)2017-12-31

Maybe this will help a bit.

http://www.skillbank.co.uk/arduino/measure.htm

If you use this info with a precision reference voltage that is quite low, e.g. 1.1V you get a really high resolution.
Only problem is that, like on a normal old school multimeter you will need to create a switch system to cater for different input ranges.
E.g.: 0 - 1.5V, 0 - 5V, 0 -12V, 0 - 100V
But in either case you won't get a 0.001V accuracy using high input voltages (max input devided by 1024).

Select as Best AnswerUndo Best Answer

user
iceng (author)2017-12-31

Let's do two simple ratios and compare.. You desire to measure with a precision of 1mv = o.001 volt out of 4 volts which is resolving one part in 4000... While a 10 Bit ADC barely resolves one part in 2^10 = 1024..

In this situation you cannot measure better then 4mv +-2mv BUT There's More ..

Adding to this the LM431 can only promise a maximum stability 2495mv and has a tendency to oscillate..

Select as Best AnswerUndo Best Answer

user
steveastrouk (author)2017-12-31

4v= 4000mV. Resolution of the ADC is 10 bit, or 1023 levels = 4000/1022 = 4mV.

That's your fundamental problem, right there.

What do you mean by "precision" ? The 10 bit ADC in the Atmega has a resolution of 10 bits, or 1024 levels, that does NOT mean it as an ACCURACY of 1 part in 2^10. A voltage regulator is NOT a voltage reference by the way.

Select as Best AnswerUndo Best Answer