decimal point accuracy for analog read in arduino

Thread Starter

denison

Joined Oct 13, 2018
137
Hi All, I am working with a narrow range of voltages and hence a narrow range in the 0-1023 digital returns in arduino. I need more precision in the digital returns. 1 decimal place would be good. e.g 510.5.
This may not be possible. This is nothing to do with speed and averaging out. The returns are constant over long periods.
If this is possible can anybody suggest how?
 

Sensacell

Joined Jun 19, 2012
2,631
A 10 bit ADC resolves one part in 1024, adding a "decimal place" implies a resolution 10X finer or at least 14 bits.

The first thing to consider- are you making the best use of the 10 bits now? can you scale or offset the signal to solve the problem?

Otherwise, consider an external ADC chip.
 
Another problem is where your measuring. At the low end, you get what's called a quantization error. 5 bits+-1bit is a lot different that 1024+-1 bit.

Dual slope converters, like used in DVM's are slow and reject the power line frequency.

There are sigma-delta converters and flash converters. I know nothing about sigma-delta converters.

Then there is #bits in the converter.

The dual-slope converter is based on time, a capacitor and a precision reference.
 

s14rs4

Joined Sep 15, 2016
41
You have not said what your signal range is or what analog reference voltage you are using, For best accuracy use the internal analog ref, which for example is 1.1v in the Uno. (See analogReference() function in Arduino reference). For a smaller input signal use an opamp to scale and offset your signal. If you need greater resolution then it is an external ADC.
 

djsfantasi

Joined Apr 11, 2010
6,962
The Arduino ADC on a 5V scale returns a 5mV accuracy. If that is insufficient, then @s14rs4 ‘s methods can be used.

I had an application where I wanted more accuracy but the 1.1V internal reference wasn’t large enough. I used an op amp to scale the input.

Warning! The Arduino ADC will return values around the input value. 2V, 2.01V, 1.995V etc... I implemented a rolling average in code.
 

Thread Starter

denison

Joined Oct 13, 2018
137
You have not said what your signal range is or what analog reference voltage you are using, For best accuracy use the internal analog ref, which for example is 1.1v in the Uno. (See analogReference() function in Arduino reference). For a smaller input signal use an opamp to scale and offset your signal. If you need greater resolution then it is an external ADC.
the voltage range is 1v-2.558. the reference is the default 5v. I am using the nano board with the atmega 328. So 1.1v would be no good to me as the top of the range is then 1.1v. I take it that when you use a reference voltage this becomes 1023 when converted to digital. then anything under the reference becomes a lower digital value. is that right?
I see a pin marked ' ref' next to the analog pins. This would be for external ref voltages. also on the board is a 3.3v reference. so it seems to me all I need to do for better resolution is to connect the 3.3 to the ref pin. do you agree?
 

Thread Starter

denison

Joined Oct 13, 2018
137
The Arduino ADC on a 5V scale returns a 5mV accuracy. If that is insufficient, then @s14rs4 ‘s methods can be used.

I had an application where I wanted more accuracy but the 1.1V internal reference wasn’t large enough. I used an op amp to scale the input.

Warning! The Arduino ADC will return values around the input value. 2V, 2.01V, 1.995V etc... I implemented a rolling average in code.
the input voltage range is 1v-2.558. I will try first using the 3.3v source on my nano board as a ref voltage. this will improve the resolution. if not good enough can you tell me how to scale the input with an op amp? I am quite familiar with op amps but can't quite see how to do what you suggest.
 

ericgibbs

Joined Jan 29, 2010
11,122
hi den,
Using OPA's it is possible to convert 1V thru 2.558V to say 0V thru 3.3V.
I see that in your opening post a figure of 510.5. , would a resolution of +/- 0.5 be acceptable eg: 510.0 > 510.5 > 511.0

E

Update.
One option.
 

Attachments

Last edited:

jjw

Joined Dec 24, 2013
555
Hi All, I am working with a narrow range of voltages and hence a narrow range in the 0-1023 digital returns in arduino. I need more precision in the digital returns. 1 decimal place would be good. e.g 510.5.
This may not be possible. This is nothing to do with speed and averaging out. The returns are constant over long periods.
If this is possible can anybody suggest how?
If the conversion speed is not an issue and the signal is not changing (DC), adding some random noise and averaging is one method.
Here is a lengthy article.
https://thecavepearlproject.org/201...nos-adc-resolution-by-dithering-oversampling/
 

Thread Starter

denison

Joined Oct 13, 2018
137
Eric what is an OPA? do you mean an operational amplifier. I could add a differential amplifier to amplify the analog input signal. This just means more hardware to my design. Actually my circuit is not too bad as it is. It would have been good if you could get decimal point accuracy on the analog input to digital signal instead of just digital integers. ie 0-1023
 

djsfantasi

Joined Apr 11, 2010
6,962
What are you using as a sensor and what are you measuring?

The sensor usually represents what it’s measuring as so many millivolts per measurement. Thus, it’s usually easy to write an equation or function that converts 0-1023 to a floating point value representing in native units what you’re measuring.

Each unit in the range 0-1023 represents 4.88mV with a 5V reference voltage (default on an Arduino).
 
A 3.3 V or 5V power supply is not usually a reference, but can be.

I know that's a confusing statement, so lets try again.

Some sensors, particularly, automotive should not use a 5.0000000 V reference. I use lots of precisin there for a reason but don't really mean it. They use a 5 V reference (no decimal point for a reason).

The sensor outputs a value relative to the sensors power supply. So, you put a DVM on it, the output will be different if the voltage happens to be 4.95, 5.00 or 5.05 volts. If you make the reference the supply, then the output will be correct doing the math right.

You have absolute and ratiometric.

Automotive sensors don;thave an output at 0V and 5V, they are usually referenced to 1/2 the supply voltage. You can;t get 0.000 and 5.000V output with a single 5V power supply from a sensor. The 5V supply is usually +-10% too.
 

ericgibbs

Joined Jan 29, 2010
11,122
hi den,
Did you see my post #9, a ready to go circuit.?
OPA == Operational Amplifier
for future info
IA == Instrumentation Amplifier.

E
 

Thread Starter

denison

Joined Oct 13, 2018
137
Eric what is an OPA? do you mean an operational amplifier. I could add a differential amplifier to amplify the analog input signal. This just means more hardware to my design. Actually my circuit is not too bad as it is. It would have been good if you could get decimal point accuracy on the analog input to digital signal instead of just digital integers. ie 0-1023
hi den,
Did you see my post #9, a ready to go circuit.?
OPA == Operational Amplifier
for future info
IA == Instrumentation Amplifier.

E
got the circuit schematic. thanks Eric
 
Top