Analog Temperature Sensor Calibration
-
- Member
- Posts: 7
- Joined: November 4th, 2019, 3:08 pm
- Division: C
- State: OH
- Has thanked: 0
- Been thanked: 0
Analog Temperature Sensor Calibration
Hi, I am new to this event, and I would like to ask how you are calibrating the temperature snesing device.
What we have decided to do is use the TI Analog Temperature Sensor (LM19) and the TI Innovator Hub and calibrate the formula using the hot and cold water samples.
What we did was get the analog reading for 55°C (call it H) (could be any hot temeprature, that is just what we decided for testing purposes) and the analog reading for 0°C (call it C). And we found a linear function using y=mx+b.
m = (55-0)/(H-C)
b = 55 - (m * H)
however, when testing this, even though theoretically it should produce an accurate linear function since the LM19 produces analog out that is linear to temperature, it does not seem to be accurate.
Testing temperature might be 25°C but we are getting sometimes 40°C or -10°C.
Can anyone please help us out, and if you could guide us in the right direction or give suggestions or examples of how you did this.
Thank you.
What we have decided to do is use the TI Analog Temperature Sensor (LM19) and the TI Innovator Hub and calibrate the formula using the hot and cold water samples.
What we did was get the analog reading for 55°C (call it H) (could be any hot temeprature, that is just what we decided for testing purposes) and the analog reading for 0°C (call it C). And we found a linear function using y=mx+b.
m = (55-0)/(H-C)
b = 55 - (m * H)
however, when testing this, even though theoretically it should produce an accurate linear function since the LM19 produces analog out that is linear to temperature, it does not seem to be accurate.
Testing temperature might be 25°C but we are getting sometimes 40°C or -10°C.
Can anyone please help us out, and if you could guide us in the right direction or give suggestions or examples of how you did this.
Thank you.
-
- Member
- Posts: 50
- Joined: December 26th, 2017, 6:41 pm
- Division: C
- State: MI
- Has thanked: 0
- Been thanked: 0
Re: Analog Temperature Sensor Calibration
Hi, You have the correct approach and equations. What values of m and b did you calculate? 'm' should be around -0.0201 and 'b' around 175 (for that sensor with the TI innovator hub). If not close to those values, you must be reading incorrect values. For ex. around 2 degrees C, it should read approx 8550. Are those what you are getting?
Also, make sure your wires are correctly inserted in the hub and the sensor.
Also, make sure your wires are correctly inserted in the hub and the sensor.
"Success is not final, failure is not fatal: it is the courage to continue that counts." - Winston Churchill
2019 Nationals:
Wright Stuff: 3rd
Protein Modeling: 4th
Geologic Mapping: 5th
2019 Nationals:
Wright Stuff: 3rd
Protein Modeling: 4th
Geologic Mapping: 5th
-
- Member
- Posts: 7
- Joined: November 4th, 2019, 3:08 pm
- Division: C
- State: OH
- Has thanked: 0
- Been thanked: 0
Re: Analog Temperature Sensor Calibration
Hi, no actually our m and b values were not close to that. I do not have it currently with me but B was in the 1000s and M was a positive number. So it is a possibilty we are reading incorrect values. We did waterproof it, but not fully since it was just a first test, and so could using hot glue or some silicone sealant on it actually stop that issue from occuring? Maybe since its not fully waterproof, water is getting in from somewhere and causing incorrect data?sciencegirl03 wrote: ↑November 5th, 2019, 6:59 pm Hi, You have the correct approach and equations. What values of m and b did you calculate? 'm' should be around -0.0201 and 'b' around 175 (for that sensor with the TI innovator hub). If not close to those values, you must be reading incorrect values. For ex. around 2 degrees C, it should read approx 8550. Are those what you are getting?
Also, make sure your wires are correctly inserted in the hub and the sensor.
Because I can't think of anything else we have left to do. We built everything and coded it correctly, the only thing that was left was to waterproof it and we used a makeshift straw and some tape and thats it, and so maybe thats causing something?
-
- Member
- Posts: 50
- Joined: December 26th, 2017, 6:41 pm
- Division: C
- State: MI
- Has thanked: 0
- Been thanked: 0
Re: Analog Temperature Sensor Calibration
First thing to check would be what values are you reading from your sensor without any conversion/calculation. They should be be between 8500 and 5000 for around 0 to 70 degrees. If you are not getting those values, something is wrong with the circuit wiring or the sensor. Did you double check the connections? Is the center pin of the sensor going to the top row and you have the corerct pin number mapped in your program?
If wiring is correct, try another sensor. You don't even need to dip it in water to test. At room temperature and when you hold the sensor between your fingers, it should still read between those values. Is it even changing the readings at different temperatures?
If wiring is correct, try another sensor. You don't even need to dip it in water to test. At room temperature and when you hold the sensor between your fingers, it should still read between those values. Is it even changing the readings at different temperatures?
"Success is not final, failure is not fatal: it is the courage to continue that counts." - Winston Churchill
2019 Nationals:
Wright Stuff: 3rd
Protein Modeling: 4th
Geologic Mapping: 5th
2019 Nationals:
Wright Stuff: 3rd
Protein Modeling: 4th
Geologic Mapping: 5th
-
- Member
- Posts: 7
- Joined: November 4th, 2019, 3:08 pm
- Division: C
- State: OH
- Has thanked: 0
- Been thanked: 0
Re: Analog Temperature Sensor Calibration
yes it is changing the temperature, and the values do seem to be between 8500 and 5000. What I'll do is try to use the m and b values u suggested earlier and try it with our hands and let you know.sciencegirl03 wrote: ↑November 6th, 2019, 2:29 pm First thing to check would be what values are you reading from your sensor without any conversion/calculation. They should be be between 8500 and 5000 for around 0 to 70 degrees. If you are not getting those values, something is wrong with the circuit wiring or the sensor. Did you double check the connections? Is the center pin of the sensor going to the top row and you have the corerct pin number mapped in your program?
If wiring is correct, try another sensor. You don't even need to dip it in water to test. At room temperature and when you hold the sensor between your fingers, it should still read between those values. Is it even changing the readings at different temperatures?
The wiring seems to be correct I checked it.
Ill let you know what happens and Thank You!
-
- Member
- Posts: 34
- Joined: January 13th, 2020, 2:27 pm
- Division: C
- State: NY
- Has thanked: 0
- Been thanked: 0
Re: Analog Temperature Sensor Calibration
sorry for posting again but i am struggling with the coding because i am a beginner. i have done the coding for the LED lights but i am stuck on how i should approach the coding for temperature and voltage. does the analog input and temperature linear equation give me the voltage? i got confused on this part.
-
- Member
- Posts: 7
- Joined: November 4th, 2019, 3:08 pm
- Division: C
- State: OH
- Has thanked: 0
- Been thanked: 0
Re: Analog Temperature Sensor Calibration
The analog input determines both the voltage and the output temperature. Depending on what microcontroller board you are using: Arduino, Raspberry Pi, or TI Innovator, I could further help you figure out the process. However, to give you an idea to go about this using the TI Innovator, I suggest you look at: https://www.soinc.org/sites/default/fil ... cher_0.pdffyuan483 wrote: ↑February 2nd, 2020, 6:54 pm sorry for posting again but i am struggling with the coding because i am a beginner. i have done the coding for the LED lights but i am stuck on how i should approach the coding for temperature and voltage. does the analog input and temperature linear equation give me the voltage? i got confused on this part.
That website guides you along the process of calibration with the TI innovator, but you could easily apply this to the Arduino or Raspberry Pi.
-
- Member
- Posts: 34
- Joined: January 13th, 2020, 2:27 pm
- Division: C
- State: NY
- Has thanked: 0
- Been thanked: 0
Re: Analog Temperature Sensor Calibration
thank you so much!yashp13 wrote: ↑February 3rd, 2020, 3:16 pmThe analog input determines both the voltage and the output temperature. Depending on what microcontroller board you are using: Arduino, Raspberry Pi, or TI Innovator, I could further help you figure out the process. However, to give you an idea to go about this using the TI Innovator, I suggest you look at: https://www.soinc.org/sites/default/fil ... cher_0.pdffyuan483 wrote: ↑February 2nd, 2020, 6:54 pm sorry for posting again but i am struggling with the coding because i am a beginner. i have done the coding for the LED lights but i am stuck on how i should approach the coding for temperature and voltage. does the analog input and temperature linear equation give me the voltage? i got confused on this part.
That website guides you along the process of calibration with the TI innovator, but you could easily apply this to the Arduino or Raspberry Pi.
-
- Member
- Posts: 34
- Joined: January 13th, 2020, 2:27 pm
- Division: C
- State: NY
- Has thanked: 0
- Been thanked: 0
Re: Analog Temperature Sensor Calibration
actually, i read the example program 1 that gives the linear equation of analog input and temperature. but i am not really understanding how the voltage formula can be derived too. sorry for asking too much. thanksyashp13 wrote: ↑February 3rd, 2020, 3:16 pmThe analog input determines both the voltage and the output temperature. Depending on what microcontroller board you are using: Arduino, Raspberry Pi, or TI Innovator, I could further help you figure out the process. However, to give you an idea to go about this using the TI Innovator, I suggest you look at: https://www.soinc.org/sites/default/fil ... cher_0.pdffyuan483 wrote: ↑February 2nd, 2020, 6:54 pm sorry for posting again but i am struggling with the coding because i am a beginner. i have done the coding for the LED lights but i am stuck on how i should approach the coding for temperature and voltage. does the analog input and temperature linear equation give me the voltage? i got confused on this part.
That website guides you along the process of calibration with the TI innovator, but you could easily apply this to the Arduino or Raspberry Pi.
-
- Member
- Posts: 7
- Joined: November 4th, 2019, 3:08 pm
- Division: C
- State: OH
- Has thanked: 0
- Been thanked: 0
Re: Analog Temperature Sensor Calibration
This is where it matters what board you are using. If you are using a TI Innovator, the ADC used 14-bit, so the formula for converting the analog-in to voltages isfyuan483 wrote: ↑February 3rd, 2020, 7:37 pmactually, i read the example program 1 that gives the linear equation of analog input and temperature. but i am not really understanding how the voltage formula can be derived too. sorry for asking too much. thanksyashp13 wrote: ↑February 3rd, 2020, 3:16 pmThe analog input determines both the voltage and the output temperature. Depending on what microcontroller board you are using: Arduino, Raspberry Pi, or TI Innovator, I could further help you figure out the process. However, to give you an idea to go about this using the TI Innovator, I suggest you look at: https://www.soinc.org/sites/default/fil ... cher_0.pdffyuan483 wrote: ↑February 2nd, 2020, 6:54 pm sorry for posting again but i am struggling with the coding because i am a beginner. i have done the coding for the LED lights but i am stuck on how i should approach the coding for temperature and voltage. does the analog input and temperature linear equation give me the voltage? i got confused on this part.
That website guides you along the process of calibration with the TI innovator, but you could easily apply this to the Arduino or Raspberry Pi.
Code: Select all
(X/(2^14-1))*3.3
If you are using Arduino, it has an ADC that uses 10-bit, so its formula would be
Code: Select all
(X/(2^10-1))*3.3
Who is online
Users browsing this forum: No registered users and 11 guests