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.
Thermometer & ADC
- 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
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
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
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 19
- Joined: Fri Jul 17, 2009 10:40 pm
Re: Thermometer & ADC
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
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
-
- Valued Contributor
- Posts: 548
- Joined: Tue Jun 26, 2007 11:23 am
- Has thanked: 6 times
- Been thanked: 44 times
Re: Thermometer & ADC
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.
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.
- Dan81
- Valued Contributor
- Posts: 268
- Joined: Sun Jan 15, 2006 4:07 pm
- Location: Albi France
- Been thanked: 60 times
- Contact:
Re: Thermometer & ADC
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
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