readadc10 and "jumping" values

juve021

Member
Hi all, I have an 18x reading signals from an ad595 via a type-k thermocouple. The 18x is doing fine reading and reporting the values however these values (converted into temperature obviously) sometimes vary by +- 8 degrees! For example, the display might read: 145, 148, 144, 152, 153, 149 etc. I believe I need a simple smoothing or averaging forumla. Does anyone have some simple code to smooth out these temperature values?
 

BeanieBots

Moderator
Code wise, just accumulate the readings into a word (up to 64 readings) and then divide by however many readings you took.

eg
w1=0
for b0=1 to 5
readadc10 pin,w2
w1=w1+w2
next b0
w1=w1/5

Hardware wise, simply fit a cap close to the ADC input.
(fit a resistor between the 595 ouput and adc input if you don't already have one)
 

juve021

Member
Code wise, just accumulate the readings into a word (up to 64 readings) and then divide by however many readings you took.

eg
w1=0
for b0=1 to 5
readadc10 pin,w2
w1=w1+w2
next b0
w1=w1/5

Hardware wise, simply fit a cap close to the ADC input.
(fit a resistor between the 595 ouput and adc input if you don't already have one)
Seems simple enough, ok I'll give it a shot! Thanks!
 
Top