AD22100 Temperature Sensor - Formula required simplifying

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

AD22100 Temperature Sensor - Formula required simplifying

Post by medelec35 »

I have a AD22100 temperature sensor.
According to data sheet Temperature coefficient of 22.5mV/ deg C
Since it has o/p at 0.25V (which would be the offset) at -50 deg C therefore
formula derived form that is Vout = (Measured temp +50)*0.0225+0.25
Transposing for measure temp (T)
T=50*(8*Vout-11)/9
With variable asigned as Int. If I replace Vout with ADC count I get
T = 50*(8*(5/1023*ADC Count)-11)/9
This works great on excel or a calculator, just not in a formula for a micocontroller. :cry:
To test
at 4.75V = ADC of about 971 Temp Approx 150 deg C
at 1.87V = ADC of about 382 Temp Approx 22 deg C

Edit Ive just worked out :
T=(2000*ADC)/9207-(550/9).....Getting better, any one can help please?
I would be really greatful.
Thank you.
Martin

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: AD22100 Temperature Sensor - Formula required simplifying

Post by medelec35 »

Worked out what is going wrong!
If result of any of calculations (including intermediate results) is greater than maximum 32767 or less than -32767 in case of integers, then results are not as expected.
I believe this is very easily overlooked (or me being dumb :p. Should set up a vote 1=Me dumb or 5= easily overlooked :lol: )

What does work is:
Temperature = ((20*ADC_Count)/92)-60
Phew!
Martin

Post Reply