Thermometer & ADC

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
bodexchrist
Posts: 19
Joined: Fri Jul 17, 2009 10:40 pm
Contact:

Thermometer & ADC

Post by bodexchrist »

Hello,

I am quite new to programming with flowcode,can somebody write a flowcode program that uses ADC to control temperature and how do i go about it.

Thanks.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Thermometer & ADC

Post by Benj »

Hello

If you are wanting to read an analogue value from a thermistor and disply the temperature in degrees then the easiest way is to use a look up table.

Basically the incoming analogue voltage is converted into an 8-bit number 0-255.

This 0-255 can be used as the index for an array of results.

For example if you know that when you read 56 on the ADC this gives you 12.5 degrees then in array location 56 you would store the following.

whole_array[56] = 12
real_array[56] = 50

Sean has written an article on how to do this and it is available from here.
http://www.matrixmultimedia.com/mmforum ... =26&t=4869

bodexchrist
Posts: 19
Joined: Fri Jul 17, 2009 10:40 pm
Contact:

Re: Thermometer & ADC

Post by bodexchrist »

Thanks Benj i got the idea now.

RobOnk
Posts: 37
Joined: Mon Jan 11, 2010 12:16 am
Been thanked: 1 time
Contact:

Re: Thermometer & ADC

Post by RobOnk »

I,m working on the digital thermometer project, but instead of using an NTC I'm using a temperature sensor (lm34DZ).
Works ok except that the output from the temp sensor seems to be very erratic. ie. varying by 5-6 degrees for no apparent reason.

The sensor output change as per temp change is 10mV/degrees F (yes Fahrenheit).

Thanks, Rob

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times
Contact:

Re: Thermometer & ADC

Post by Sean »

The low output voltage of the LM34 can lead to problems with the resolution of the microcontroller ADCs and the calculations performed on the results.

A 5V ADC performing an 8-bit conversion has a resolution of 20mV, or 5mV from a 10-bit conversion. Integer calculations may also introduce further rounding errors.

If possible, an op-amp circuit should be used to match the expected operating range of the signal to the ADC conversion range. In some cases it is possible to re-order calculations to avoid rounding errors.

User avatar
Dan81
Valued Contributor
Valued Contributor
Posts: 268
Joined: Sun Jan 15, 2006 4:07 pm
Location: Albi France
Been thanked: 60 times
Contact:

Re: Thermometer & ADC

Post by Dan81 »

Hello Rob

For the same price (but not the same package) you can use a digital device : MCP9800 (or DS1631 more expensive, or others manufacturers ).
There is no calculation to do, only a I2C bus to manage. There are also SPI devices.

Good luck

Daniel

Post Reply