Pages: [1]   Go Down
 Author Topic: Can you get better than 10 bit A to D resolution from the Arduino platform.  (Read 11955 times) 0 Members and 1 Guest are viewing this topic.
Offline
Newbie
Karma: 0
Posts: 1
 « on: November 14, 2013, 03:08:53 pm » Bigger Smaller Reset

I am a total newbee to Arduino (in fact, to solid state electronics in general).  I am trying to monitor and control the temperature in an electric furnace (0 to 2400 deg. F) using a type K thermocouple connected to an AD8495 amp, connected to the Arduino (was thinking of using a Mega 2560) which would then be connected to the PC, running a C++  program to monitor furnace temperature.  The C++ program would also control the furnace temp. by sending on\ off signals back to the Arduino, which would then switch power on and off to the furnace using an SCR.  My problem is (I think)  the 10 bit resolution of the A to D in the Arduino.  I am measuring temps. from about 70 deg. F to about 2400 deg. F.   2400- 70 = 2330.  2330/1024 = 2.28.  I suppose I could live with 2.28 deg F, resolution, but is there a simple way to get 1 deg. F resolution in this scenario?   This may be (probably is) a stupid question, but like I said, I am a total newbee, and when I tried to search for an answer to this question, all I could find was a suggestion to use two A to D inputs, but it did not explain how to do this, much less how to do this seamlessly.  Any suggestions would be greatly appreciated.  I would greatly prefer staying with the Arduino platform, as any journeys off into IC individual component never-never land would leave me hopelessly lost!    Thanks much; you folks have a great thing going here and I was really lucky to have been steered onto it!
 Logged

Rapa Nui
Offline
Edison Member
Karma: 60
Posts: 2061
Pukao hats cleaning services
 « Reply #1 on: November 14, 2013, 03:14:46 pm » Bigger Smaller Reset

In practice your resolution will be lower, because of the noise and other factors.
You may do more measurements (ie. 1000), sum up all the measurements and then divide the sum by 1000 - that is called averaging. You will get better resolution. The noise helps (dithering).

Another approach is smoothing/filtering (low pass filter). You do measurements in a loop where (for example):
Code:
`..new_temp = analogRead(1);new_temp = 0.98*old_temp + 0.02*new_temp;  // =A*old_temp + B*new_temp,  where A+B=1.0do something with new_temp;old_temp = new_temp;..`
That will provide a low pass filter which gives you a better resolution. The A+B=0.98+0.02=1.0, you may use other ratio, the lower the B the longer the time constant of the filter..

 « Last Edit: November 14, 2013, 03:54:38 pm by pito » Logged

Global Moderator
Boston area, metrowest
Online
Brattain Member
Karma: 513
Posts: 26250
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
 « Reply #2 on: November 14, 2013, 03:52:43 pm » Bigger Smaller Reset

"The AD8494/AD8495/AD8496/AD8497 allow a wide variety of supply voltages. With a 5 V single supply, the 5 mV/°C output allows the devices to cover nearly 1000 degrees of a thermo-couple’s temperature range."

How are you powering the AD8495?

The AD849x achieves a linearity error of less than ±2°C, within the specified operating ranges listed in Table 7.
AD8495  K  ±2°C  0°C to 50°C  −25°C to +400°C

For temperature ranges outside those listed in Table 7 or for instructions on how to correct for thermocouple nonlinearity error with software, see the AN-1087 Application Note for additional details.

 Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Miami/Florida
Offline
Sr. Member
Karma: 14
Posts: 338
 « Reply #3 on: November 14, 2013, 04:52:28 pm » Bigger Smaller Reset

Quote
The C++ program would also control the furnace temp. by sending on\ off signals back to the Arduino, which would then switch power on and off to the furnace using an SCR

I would leave that function to Arduino instead of the computer. It will be easier, I guess.
 Logged

Perseverance is 90% of the solution. The remaining 10% is more perseverance.

Global Moderator
Netherlands
Offline
Shannon Member
Karma: 211
Posts: 13471
In theory there is no difference between theory and practice, however in practice there are many...
 « Reply #4 on: November 15, 2013, 11:38:36 am » Bigger Smaller Reset

Related to averaging, you can also use oversampling with the 10bits ADC.

4 samples gives you 1 bit extra
16 samples gives you 2 bit extra
64 samples => 3 bit extra
256 samples => 4 bit extra
1024 samples => 5 bit extra

the price is time ...
Code:
`////    FILE: analogReadN.pde//  AUTHOR: Rob Tillaart//    DATE: 2012-05-10//// PURPOSE: higher precision analogRead()//// http://www.atmel.com/Images/doc8003.pdf //void setup(){  Serial.begin(115200);  for (int b=10; b< 17; b++)  {    unsigned int val = analogReadN(A0, b);    Serial.println(val, DEC);   }}void loop(){}uint16_t analogReadN(uint8_t pin, uint8_t bits){  bits = constrain(bits, 10, 16) -10;  int samples = 1 << (bits << 1);  uint32_t sum=0;  for (int i=0; i< samples; i++) sum += analogRead(pin);       return sum >> bits;                             }uint16_t analogReadNreferenc(uint8_t pin, uint8_t bits){  bits = constrain(bits, 10, 16) -10;  int d = 1;  for (int i=0; i<bits; i++) d *= 2;  int samples = d*d;  uint16_t sum=0;  for (int i=0; i< samples; i++) sum += analogRead(pin);       return sum / d;   // rounding => return (sum + d/2) / d;                              }`
 Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

United Kingdom
Offline
Tesla Member
Karma: 223
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
 « Reply #5 on: November 16, 2013, 03:37:54 am » Bigger Smaller Reset

Have you considered using a MAX31855K instead of the AD8495? It provides a digital output with a resolution of 0.25C, so you don't need to use the Arduino ADC.

Oversampling when you use the built-in ADC only gives you increased resolution if you have the right amount of random noise on the signal.
 Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Global Moderator
Boston area, metrowest
Online
Brattain Member
Karma: 513
Posts: 26250
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
 « Reply #6 on: November 26, 2013, 10:01:00 am » Bigger Smaller Reset

Quote
The MAX31855 performs cold-junction compensation
and digitizes the signal from a K-, J-, N-, T-, S-, R-, or
E-type thermocouple. The data is output in a signed
14-bit, SPI-compatible, read-only format. This converter
resolves temperatures to 0.25NC, allows readings as high
as +1800NC and as low as -270NC, and exhibits thermocouple
accuracy of ±2NC for temperatures ranging from
-200NC to +700NC for K-type thermocouples.

degree F = 9/5 degree C + 32
so (degree F - 32) *5/9 = degree C

(2400F-32)*5/9 = 1315C

http://datasheets.maximintegrated.com/en/ds/MAX31855.pdf
From Page 3, looks like MAX31855R or MAX31855S might be a bit more sensitive,
but the overall error (-4C to +4C) is the same.

Price looks to be the same for K or S parts:
http://www.digikey.com/product-search/en/integrated-circuits-ics/pmic-thermal-management/2556560?k=max31855
 Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline
Karma: 57
Posts: 2764
 « Reply #7 on: December 07, 2013, 06:35:24 am » Bigger Smaller Reset

The accuracy of your thermocouple won't be better than 1 part in a thousand anyway.     And nor will the process of turning the heat on and then off again, to regulate the temperature.

There is no point being picky about one aspect of your process without tackling other sources of uncertainty which are much larger.

If you really want better a/d resolution,  there are plenty of external a/d chips with 12 or 14 bit resolution which are easy to use and have other benefits like faster speed.
 Logged

0
Offline
Shannon Member
Karma: 199
Posts: 11639
Arduino rocks
 « Reply #8 on: December 12, 2013, 09:59:08 pm » Bigger Smaller Reset

Related to averaging, you can also use oversampling with the 10bits ADC.

4 samples gives you 1 bit extra
16 samples gives you 2 bit extra
64 samples => 3 bit extra
256 samples => 4 bit extra
1024 samples => 5 bit extra

the price is time ...
Well its more than that, you have to ensure there's enough Gaussian noise in the
system before you average, otherwise you just average 16 identical samples,
or 256 identical samples.  Just enough noise allows the actual voltage to affect
the probability of the value being read as N or N+1 or N-1 counts on the ADC.
Then the averaging process effectively measures this probability as a proxy for
sub-LSB voltage.

To get accurate linearity in averaging lots of readings you, alas, have to inject more
noise to make the relationship between probability and voltage linear enough.

Furthermore you cannot improve upon the existing imperfect linearity of the ADC
response staircase function, so in practice don't expect to get more than 1 or 2 bits more.

If there is existing noise you have to worry about whether its correlated to the signal
or not, since correlated noise cannot be removed by averaging...

I feel averaging 8 or 16 samples is probably worth it, more is not, get a sigma-delta
 Logged

[ I won't respond to messages, use the forum please ]

Global Moderator
Netherlands
Offline
Shannon Member
Karma: 211
Posts: 13471
In theory there is no difference between theory and practice, however in practice there are many...
 « Reply #9 on: December 13, 2013, 02:04:41 pm » Bigger Smaller Reset

Many people make 16 samples and make only a 10 bit average of it, while they can make more bits out of it (including me).
I agree making 1024 samples to get 5 bits extra is "freezing" the Arduino for quite some time. And yes a dedicated high res AD chip would be better.
 Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

 Pages: [1]   Go Up