I am new to Cayenne and am using a tektelic industrial transceiver with Lora. I have hooked up a 10kΩ thermistor to the transceiver the readings I get are in the 3.xxx to 4.xxx range and are inverse to the actual temperature. How can I set up cayenne to translate these values to temperatures in degrees C and display the temperature in a widget?
Thermistors are variable resistors that change their resistance with temperature. They are classified by the way their resistance responds to temperature changes.
The Arduino will measure the voltage at a point between the thermistor and a known resistor. This is known as a voltage divider. The equation for a voltage divider is:
Vout = Vin (R2/(R1+R2))
Not knowing about the Arduino specifically and following from shramik_salgaonkar, the voltage applied the resistor chain should be the same as the vref of the ADC. This way the measured voltage will be ratio-metric, ie if the applied voltage (vref) changes then the voltage will change by the same ratio and the adc reading will stay the same.
From Vout = Vin (R2/(R1+R2))
R2 = Vo R1/(Vin-Vout) given that R2 is the thermistor.
Also R1 is best to be the same value as R2 at the most useful temperature ie if reading a fridge the choose R1 to be the same the thermistor at say +5Deg C.
There are two ways of converting this resistance to temperature,
- is to use the Steinhart-Hart equations using the parameters of the thermistor you have used (info on the web)
- use a lookup table generated from the data for the thermistor for the Arduino to convert the resistance to a temperature.
it is voltage resistor configuration, so there is change in voltage on change in varying resistance.
the arduino does not have the ability to measure the resistance and i dont know why you want to measure it.
I agree the the Arduino cannot measure resistance directly, it’s calculated by the voltage ratio to give a resistance ratio. This is the way I’ve been doing it for many years.
You need to know the resistance of the thermistor to know the temperature.
The thermistor will have a table of resistance vs temperature in the data sheet or the Steinhart-Hart constants so you can calculate the table.
Also https://github.com/YuriiSalimov/NTC_Thermistor appears to be a library for the Arduino which looks like what the OP needs.
this can be done using the formula i provided above.
shramik and Andy
Thank you for your replies. I am not using an arduino but rather a Tektelic transceiver and sensor. The documentation for this sensor suggests using a 10k ohm thermistor. I appreciate your help in explaining how to convert the ohm reading of the thermistor into temperature.
What I am really wanting to do though is make this conversion inside of the Cayenne application so that I have a dashboard widget that reads in degrees C. It is very clunky to have to use a chart to convert the resistance reading to temperature every time I check the sensor, particularly when I am out working in the field.
If this cannot be done in Cayenne is it possible that the conversion should be done in my Senet Network Server?
Sorry, don’t know enough about Cayenne etc to help further.
If you had been implementing in an Arduino the table could have implemented in code and the conversion would be transparent.
You have me thinking - Thanks
i am just giving an example on how to read temperature from an 10k thermistor. For tektelic transceiver it will be same.
you cannot do it on cayenne dashboard but can be done on the device side as @andy_cleeves mentioned.
Once you get the Vout, from the analog pin. you can use this formula to get the temperature in degree.
float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07; Vo = analogRead(ThermistorPin); R2 = R1 * (1023.0 / (float)Vo - 1.0); logR2 = log(R2); T = (1.0 / (c1 + c2*logR2 + c3*logR2*logR2*logR2)); Tc = T - 273.15; Tf = (Tc * 9.0)/ 5.0 + 32.0;
Well, i have dont much idea on how to add this on the tektelic transceiver, maybe if you any documentation on how to do it, i can help you.
Just one comment on the above
float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;
These values will depend on the thermistor used. Should be on the data sheet.