Temperature probe readings

Forum for problems or queries regarding other Flowcode Components. Eg LEDs, Switches, LCD, Gfx LCD etc

Moderators: Benj, Mods

Post Reply
True
Posts: 7
Joined: Wed Mar 04, 2009 11:56 am
Contact:

Temperature probe readings

Post by True »

Hello,

I'm not sure if I have posted this on the right board :?:

I am trying to obtain a temperature reading from a temperature probe I have just purchased from your website. I wish to simply display the reading on an LCD in degrees celsius.

I am using the Wide range stainless steel temperature probe (HSTMP) with an E-blocks sensor interface (EB003). I am using the E-blocks Atmel AVR Mega32 multiprogrammer and flowcode V3.

Currently I have set up the E-blocks with the LCD in port B and the sensor interface in port C with the temperature probe in the analogue port of the sensor interface.

The sensor interface is in it's default state with none of the jumpers changed etc.

I have written a program in flowcode to collect a temperature reading from the sensor interface and display it on the LCD, however the only reading that is displayed on the LCD is "1" and I am not sure what I am doing wrong.

Attatched is the flowcode program I have written to obtain the reading and display it on the LCD.

Thanks in advance.

Richard

P.S. I have tried the sensor interface test program mentioned in the sensor interface datasheet, the one that obtains a light sensor reading from the sensor interface, and that works perfectly.
Attachments
Sensor test.fcf_avr
Flowcode to obtain Temperature reading
(3.5 KiB) Downloaded 598 times

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: Temperature probe readings

Post by Benj »

Hello

You are reading the sensor via a digital input icon. If you go back to the other sensor example you will notice that it is reading the value from an ADC component. This ADC component must be connected to an Analogue pin (normally AN3 on PortA to match the sensor board and the analogue pins.)

True
Posts: 7
Joined: Wed Mar 04, 2009 11:56 am
Contact:

Re: Temperature probe readings

Post by True »

Hey,

Thanks for the reply! I now have a reading from the temperature sensor and am able to display it to the LCD so I am very happy! :mrgreen:

I have however run into a new problem. The reading is not in degrees celsius, infact its not in anything I recognise, it also goes up the colder it is and down the hotter it is. I am guessing it is a voltage reading of some sort. At room temperature it displays a reading of about 600.

Is there anyway of converting this reading into degrees celsius? Preferably within flowcode as I have no experience with any programming language. I have attatched the flowcode program I have written just incase it has an error in my code.

Thank you for your time!

Richard
Attachments
Sensor test.fcf_avr
Temperature Sensor
(4.5 KiB) Downloaded 505 times

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: Temperature probe readings

Post by Benj »

Hello Richard

Sean is looking into this for you. We should be able to provide you with a working example for the AVR later on today.

True
Posts: 7
Joined: Wed Mar 04, 2009 11:56 am
Contact:

Re: Temperature probe readings

Post by True »

Thank you very much! Looking forward to a solution! :mrgreen:

Richard

True
Posts: 7
Joined: Wed Mar 04, 2009 11:56 am
Contact:

Re: Temperature probe readings

Post by True »

Any news on the solution yet?

Sorry for being impatient! :oops:

Richard

User avatar
goldwingers
Posts: 118
Joined: Wed Sep 06, 2006 1:22 pm
Location: London
Been thanked: 1 time
Contact:

Re: Temperature probe readings

Post by goldwingers »

Hi There,
It looks as though your reading the (600) direct value from the ADC port, You need to do a calculation on the ADC port which would be from 0 - 1024. This would give you a rudementary figure for Deg C or F..
As the temp probe is inverse proportional to voltage, the cooler it gets the higher the value will become. You will need to find a way of inverting the value.

Ian

True
Posts: 7
Joined: Wed Mar 04, 2009 11:56 am
Contact:

Re: Temperature probe readings

Post by True »

Thanks for the reply Ian. I am lost as to how to calculate this and convert the direct value from the ADC port into a value that is in Deg C or F. I was hoping that Ben or Sean would be able to provide me with a working example, however it seems as if they are busy with other things, or maybe I am trying to do something that is impossible!

I am a little confused as to what use the temperature probe is when it doesn't tell you what the actual temperature is though. I was thinking that the temperature probe would have least come with a datasheet telling you how to translate the value into a readable temperature value. I have spent hours looking on the internet for some sort of equation or help of some sort, but it seems I am out of luck. :cry:

Maybe I should stay away from such complex things! :P

Richard

User avatar
Steve
Matrix Staff
Posts: 3421
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: Temperature probe readings

Post by Steve »

The formula for the voltage-to-temperature conversion for this sensor is quite complex (I don't think it's simply inversely proportional), but you should be able to convert it using the floating point routines within Flowcode. The formula should be in the datasheet for the sensor.

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: Temperature probe readings

Post by Sean »

Here are some files that allow AVR devices to provide full floating-point support. Flowcode for AVR can access these features via C code blocks.
AVR float files.zip
(1.53 KiB) Downloaded 524 times
Copy the avra.bat and avrb.bat files to the Tools\MX_bats\ folder of your Flowcode_AVR installation (save backups of the original files)

The ThermoCalcDisplay.fcf_avr file is a demonstration program that performs the temperature probe conversion calculations.

It was originally written to provide floating-point timing information so the inputs and outputs are not currently in a useable state.
  • The input is currently the FCV_R floating-point variable.
    The output is the FCV_T floating-point variable. This is copied to the FCV_TEMP char variable that can be accessed by Flowcode as Temp.
The target device and clock speed can be changed to match any supported ATmega target.

The new floating point support should allow this program to be converted to read the temperature probe and display the results on an LCD. I will post the completed program shortly.

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: Temperature probe readings

Post by Sean »

Here is the finished temperature probe program.
ThermoCalcDisplay.fcf_avr
(6 KiB) Downloaded 634 times
The calculations and display string conversion are performed using floating-point arithmetic within C-code blocks.
The calculations can be simplified slightly and combined into a single C-code block, but have been kept separate to indicate the individual steps.

The temperature probe used was a 20K NTC thermistor connected to 0V, with a 15K resistor connected to 5V.

Post Reply