Components and supplies
Arduino UNO
Capacitor 470 µF
Power Supply 12VDC 2.0A - US
Resistor 10k ohm
Capacitor 100 nF
Metalfilm resistor 10k tolerance 0,1%
Standard LCD - 16x2 White on Blue
Precision temperature sensor TS-NTC-103, 10 kΩ
push button (normally off)
Rotary potentiometer (generic)
Project description
Code
Downloadable files
precision_thermometer_schematics_v2_4UersrA8Y8.pdf
precision_thermometer_schematics_v2_4UersrA8Y8.pdf
Comments
Only logged in users can leave comments
arsanchez
2 years ago
Hi, Peter. Interesting project, Thank you for sharing. arsanchez
Anonymous user
2 years ago
I have errors termometr:131: error: expected constructor, destructor, or type conversion before ';' token PrintPG() { // if errors at this point write "float" before PrintPG() ^ C:\\Users\\OWNER\\Documents\\Arduino\ ermometr\ ermometr.ino: In function 'void loop()': termometr:85: error: 'PrintPG' was not declared in this scope PrintPG(); ^ termometr:117: error: 'PrintPG' was not declared in this scope PrintPG(); ^ Multiple libraries were found for "LiquidCrystal.h" Used: C:\\Users\\OWNER\\Desktop\\183\\arduino-1.8.3\\libraries\\LiquidCrystal Not used: C:\\Users\\OWNER\\Documents\\Arduino\\libraries\\Newliquidcrystal_1.3.5 Using library LiquidCrystal at version 1.0.5 in folder: C:\\Users\\OWNER\\Desktop\\183\\arduino-1.8.3\\libraries\\LiquidCrystal exit status 1 expected constructor, destructor, or type conversion before ';' token
Anonymous user
2 years ago
Hi Peter asterisk I have them in my program, they are converted to forward slash when I click on POST button. Can you post corrected code ?
Anonymous user
2 years ago
error termometr:147: error: expected constructor, destructor, or type conversion before ';' token PrintPG() { // if errors at this point write "float" before PrintPG() ^ C:\\Users\\OWNER\\Documents\\Arduino\ ermometr\ ermometr.ino: In function 'void loop()': termometr:98: error: 'PrintPG' was not declared in this scope PrintPG(); ^ termometr:130: error: 'PrintPG' was not declared in this scope PrintPG(); ^ Multiple libraries were found for "LiquidCrystal.h" Used: C:\\Users\\OWNER\\Desktop\\183\\arduino-1.8.3\\libraries\\LiquidCrystal Not used: C:\\Users\\OWNER\\Documents\\Arduino\\libraries\\Newliquidcrystal_1.3.5 Using library LiquidCrystal at version 1.0.5 in folder: C:\\Users\\OWNER\\Desktop\\183\\arduino-1.8.3\\libraries\\LiquidCrystal exit status 1 expected constructor, destructor, or type conversion before ';' token
Anonymous user
2 years ago
//Function declarations float SteinHart(float R) { float logR = log(R); float result; result = (1.0 / (A + B*logR + C*logR*logR*logR)); //Calculation of current temperature in Kelvin with Steinhart - Hart approximation of NTC R-T curve result = result - 273.15; //T in degrees Celcius return result; }
Anonymous user
2 years ago
Peter is a great guy, he corrected the code and program is working very good. I like this program very much and I going to implement it for various applications. Thanks Peter Redards Ted
Anonymous user
2 years ago
Thanks for a quick response. This is what I did and the error. /* https://www.hackster.io/Groeneveld64/outside-thermometer-with-trend-max-and-min-temperature-4a714f Precisionthermometer with minimum and maximum temperature and trend based on the B+B precision temperature sensor TS-NTC-103. 26 x 2 display based on Hitachi HD44780 driver. This thermometer uses the B+B precision temperaturesensor TS-NTC-103 (10kohm at 25 °C. For information see https://shop.bb-sensors.com/en/Temperature-measurement/Temperature-sensors/Precision-temperature-sensor-TS-NTC-103-10-k.html */ #include <LiquidCrystal.h> // include library code const int ThermistorPin = 0; int Vo; //voltage on analog input representing current temperature (integer from 0 to 1023) float R1 = 10000; float R2, T , Tprevious, h = 0.2, Tmin, Tmax; //T is current temperature, Tprevious is previous temperature measurement, h is hysteresis, Tmin is minimum measured temperature since last forced temperature reset, Tmax is maximum... float A = 0.8947436999e-03, B = 2.502218459e-04, C = 1.978768315e-07; //Steinhart-Hart coefficients see http://www.thinksrs.com/downloads/programs/Therm%20Calc/NTCCalibrator/NTCcalculator.htm const int ResetPin = 8; // resets Tmin and Tmax both to current temperature T int interval = 300; // time between two successive temperature measurements is this number multiplied with 10 in milliseconds, eg 300 means 3 seconds between two measurements int counter; const int numReadings = 100; //number of measurements used for the calculation of the running average of the temperature int readings[numReadings]; //array to contain measurements from which the average is calculated int readIndex = 0; long total; //total of all measurements in the array float average; //average of all measurements in the array byte trend = ' '; //trend of temperature measurements, up or down const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2; LiquidCrystal lcd(rs, en, d4, d5, d6, d7); // initialize the library by associating any needed LCD interface pin with the arduino pin number it is connected to byte up[8] = { //defines upward arrow character B00100, B01110, B10101, B00100, B00100, B00100, B00100, }; byte down[8] = { //defines downward arrow character B00100, B00100, B00100, B00100, B10101, B01110, B00100, }; byte degree[8] = { //defines degree character B00010, B00101, B00010, B00000, B00000, B00000, B00000, }; ////////////////////////////////// //Function declarations float SteinHart(float R) { float logR = log(R); float result; result = (1.0 / (A + B*logR + C*logR*logR*logR)); //Calculation of current temperature in Kelvin with Steinhart - Hart approximation of NTC R-T curve result = result - 273.15; //T in degrees Celcius return result; } /////////////////////////////////////// void setup() { counter = interval; lcd.createChar(0, up); //creates custom character (gylph) number 0 following definition "byte up[8]" lcd.createChar(1, down); //creates custom character (gylph) number 1 following definition "byte down[8]" lcd.createChar(2, degree); //creates custom character (gylph) number 2 following definition "byte degree[8]" lcd.begin(16, 2); // set up the LCD's number of columns and rows: pinMode(ResetPin, INPUT); Serial.begin(9600); Vo = analogRead(ThermistorPin); //reads voltage representing current temperature (integer from 0 to 1023) R2 = R1 * (1023.0 / (float)Vo - 1.0); //calculation of R2 (resistance of NTC at current temperature); (float) converts the integer to a floating value T = SteinHart(R2); for (int thisReading = 0; thisReading < numReadings; thisReading++) {readings[thisReading] = Vo;} //fills all positions of the array "readings" with voltage Vo representing current temperature (integer from 0 to 1023) Tmin = Tmax = Tprevious = T; total = numReadings * Vo; //calculation of the sum of all numbers in the array } void loop() { if (digitalRead(ResetPin)==LOW) //if the reset button is pushed Tmin, Tmax and Tprevious are reset to current temperature T { Tmin = Tmax = Tprevious = T; counter = 0; trend = ' '; PrintPG(); delay(5000); } else if (counter>0) { counter--; delay(10); } else { total = total - readings[readIndex]; // subtract the last reading: readings[readIndex] = analogRead(ThermistorPin); // read from the sensor: total = total + readings[readIndex]; // add the reading to the total: readIndex = readIndex + 1; // advance to the next position in the array: if (readIndex >= numReadings) { // if we're at the end of the array... readIndex = 0; // ...wrap around to the beginning: } Vo = total / numReadings; // calculate the average: R2 = R1 * (1023.0 / (float)Vo - 1.0); T = SteinHart(R2); if (T<Tmin) {Tmin=T;} if (T>Tmax) {Tmax=T;} if (T > Tprevious+h) //temperature is increasing {trend = byte(0); Tprevious = T;} //remember current measurement if (T < Tprevious-h) //temperature is decreasing {trend = byte(1); Tprevious = T;} //remember current measurement PrintPG(); counter = interval; //resets counter } } /* ////////////////////////////// //Function declarations float SteinHart(float R) { float logR = log(R); float result; result = (1.0 / (A + B*logR + C*logR*logR*logR)); //Calculation of current temperature in Kelvin with Steinhart - Hart approximation of NTC R-T curve result = result - 273.15; //T in degrees Celcius return result; } */ PrintPG() { // if errors at this point write "float" before PrintPG() lcd.clear(); lcd.print("Temp = "); lcd.print(T, 1); lcd.write(byte(2)); // write degree character lcd.print("C "); lcd.write(trend); // write upward or downward arrow lcd.setCursor(0, 1); lcd.print("Mi "); lcd.print(Tmin, 1); lcd.print(" Ma "); lcd.print(Tmax, 1); }
Groeneveld64
2 years ago
Hi Ted, Try putting the function declarations before void setup() instead of at the end of the script.
Groeneveld64
2 years ago
Hi Ted, I checked your code. You have to use an asterisk between the multiplication factors Not result = (1.0 / (A + BlogR + ClogRlogRlogR)); but result = (1.0 / (A + B*logR + C*logR*logR*logR)); I uploaded your code to my thermometer and it works ok
Anonymous user
2 years ago
Hi Peter, I'm looking to monitor and record the temperature of compost heaps to understand the best time to turn them. I need something that can be placed in the center of a heap, send temps via a mobile or WiFi signal to a computer or terminal and for that terminal to log the temps. It seems like your design could be adapted to do this. There's a few practical issues to deal with, water proofing, spades etc but I'd value your thoughts on this. Thanks Mark Ps I'm a new to all this, so don't go to technical too quick.
Anonymous user
6 years ago
Zou je me kunnen vertellen welke temperatuur waardes je hebt gebruikt om de Steinhart-Hart coefficient te bepalen. De tabel met weerstanden heb ik gevonden op https://shop.bb-sensors.com/out/media/Datenblatt_Kennlinie_103AP-2_pdf.pdf Is dit het juiste datablad. Groetjes uit Belgie Louis
arsanchez
7 years ago
Hi, Peter. Interesting project, Thank you for sharing. arsanchez
ted
7 years ago
I have errors termometr:131: error: expected constructor, destructor, or type conversion before ';' token PrintPG() { // if errors at this point write "float" before PrintPG() ^ C:\\Users\\OWNER\\Documents\\Arduino\ ermometr\ ermometr.ino: In function 'void loop()': termometr:85: error: 'PrintPG' was not declared in this scope PrintPG(); ^ termometr:117: error: 'PrintPG' was not declared in this scope PrintPG(); ^ Multiple libraries were found for "LiquidCrystal.h" Used: C:\\Users\\OWNER\\Desktop\\183\\arduino-1.8.3\\libraries\\LiquidCrystal Not used: C:\\Users\\OWNER\\Documents\\Arduino\\libraries\\Newliquidcrystal_1.3.5 Using library LiquidCrystal at version 1.0.5 in folder: C:\\Users\\OWNER\\Desktop\\183\\arduino-1.8.3\\libraries\\LiquidCrystal exit status 1 expected constructor, destructor, or type conversion before ';' token
Groeneveld64
2 years ago
Hi Ted, I checked your code. You have to use an asterisk between the multiplication factors Not result = (1.0 / (A + BlogR + ClogRlogRlogR)); but result = (1.0 / (A + B*logR + C*logR*logR*logR)); I uploaded your code to my thermometer and it works ok
Groeneveld64
2 years ago
Hi Ted, Try putting the function declarations before void setup() instead of at the end of the script.
ted
2 years ago
Peter is a great guy, he corrected the code and program is working very good. I like this program very much and I going to implement it for various applications. Thanks Peter Redards Ted
ted
2 years ago
Thanks for a quick response. This is what I did and the error. /* https://www.hackster.io/Groeneveld64/outside-thermometer-with-trend-max-and-min-temperature-4a714f Precisionthermometer with minimum and maximum temperature and trend based on the B+B precision temperature sensor TS-NTC-103. 26 x 2 display based on Hitachi HD44780 driver. This thermometer uses the B+B precision temperaturesensor TS-NTC-103 (10kohm at 25 °C. For information see https://shop.bb-sensors.com/en/Temperature-measurement/Temperature-sensors/Precision-temperature-sensor-TS-NTC-103-10-k.html */ #include <LiquidCrystal.h> // include library code const int ThermistorPin = 0; int Vo; //voltage on analog input representing current temperature (integer from 0 to 1023) float R1 = 10000; float R2, T , Tprevious, h = 0.2, Tmin, Tmax; //T is current temperature, Tprevious is previous temperature measurement, h is hysteresis, Tmin is minimum measured temperature since last forced temperature reset, Tmax is maximum... float A = 0.8947436999e-03, B = 2.502218459e-04, C = 1.978768315e-07; //Steinhart-Hart coefficients see http://www.thinksrs.com/downloads/programs/Therm%20Calc/NTCCalibrator/NTCcalculator.htm const int ResetPin = 8; // resets Tmin and Tmax both to current temperature T int interval = 300; // time between two successive temperature measurements is this number multiplied with 10 in milliseconds, eg 300 means 3 seconds between two measurements int counter; const int numReadings = 100; //number of measurements used for the calculation of the running average of the temperature int readings[numReadings]; //array to contain measurements from which the average is calculated int readIndex = 0; long total; //total of all measurements in the array float average; //average of all measurements in the array byte trend = ' '; //trend of temperature measurements, up or down const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2; LiquidCrystal lcd(rs, en, d4, d5, d6, d7); // initialize the library by associating any needed LCD interface pin with the arduino pin number it is connected to byte up[8] = { //defines upward arrow character B00100, B01110, B10101, B00100, B00100, B00100, B00100, }; byte down[8] = { //defines downward arrow character B00100, B00100, B00100, B00100, B10101, B01110, B00100, }; byte degree[8] = { //defines degree character B00010, B00101, B00010, B00000, B00000, B00000, B00000, }; ////////////////////////////////// //Function declarations float SteinHart(float R) { float logR = log(R); float result; result = (1.0 / (A + B*logR + C*logR*logR*logR)); //Calculation of current temperature in Kelvin with Steinhart - Hart approximation of NTC R-T curve result = result - 273.15; //T in degrees Celcius return result; } /////////////////////////////////////// void setup() { counter = interval; lcd.createChar(0, up); //creates custom character (gylph) number 0 following definition "byte up[8]" lcd.createChar(1, down); //creates custom character (gylph) number 1 following definition "byte down[8]" lcd.createChar(2, degree); //creates custom character (gylph) number 2 following definition "byte degree[8]" lcd.begin(16, 2); // set up the LCD's number of columns and rows: pinMode(ResetPin, INPUT); Serial.begin(9600); Vo = analogRead(ThermistorPin); //reads voltage representing current temperature (integer from 0 to 1023) R2 = R1 * (1023.0 / (float)Vo - 1.0); //calculation of R2 (resistance of NTC at current temperature); (float) converts the integer to a floating value T = SteinHart(R2); for (int thisReading = 0; thisReading < numReadings; thisReading++) {readings[thisReading] = Vo;} //fills all positions of the array "readings" with voltage Vo representing current temperature (integer from 0 to 1023) Tmin = Tmax = Tprevious = T; total = numReadings * Vo; //calculation of the sum of all numbers in the array } void loop() { if (digitalRead(ResetPin)==LOW) //if the reset button is pushed Tmin, Tmax and Tprevious are reset to current temperature T { Tmin = Tmax = Tprevious = T; counter = 0; trend = ' '; PrintPG(); delay(5000); } else if (counter>0) { counter--; delay(10); } else { total = total - readings[readIndex]; // subtract the last reading: readings[readIndex] = analogRead(ThermistorPin); // read from the sensor: total = total + readings[readIndex]; // add the reading to the total: readIndex = readIndex + 1; // advance to the next position in the array: if (readIndex >= numReadings) { // if we're at the end of the array... readIndex = 0; // ...wrap around to the beginning: } Vo = total / numReadings; // calculate the average: R2 = R1 * (1023.0 / (float)Vo - 1.0); T = SteinHart(R2); if (T<Tmin) {Tmin=T;} if (T>Tmax) {Tmax=T;} if (T > Tprevious+h) //temperature is increasing {trend = byte(0); Tprevious = T;} //remember current measurement if (T < Tprevious-h) //temperature is decreasing {trend = byte(1); Tprevious = T;} //remember current measurement PrintPG(); counter = interval; //resets counter } } /* ////////////////////////////// //Function declarations float SteinHart(float R) { float logR = log(R); float result; result = (1.0 / (A + B*logR + C*logR*logR*logR)); //Calculation of current temperature in Kelvin with Steinhart - Hart approximation of NTC R-T curve result = result - 273.15; //T in degrees Celcius return result; } */ PrintPG() { // if errors at this point write "float" before PrintPG() lcd.clear(); lcd.print("Temp = "); lcd.print(T, 1); lcd.write(byte(2)); // write degree character lcd.print("C "); lcd.write(trend); // write upward or downward arrow lcd.setCursor(0, 1); lcd.print("Mi "); lcd.print(Tmin, 1); lcd.print(" Ma "); lcd.print(Tmax, 1); }
ted
2 years ago
error termometr:147: error: expected constructor, destructor, or type conversion before ';' token PrintPG() { // if errors at this point write "float" before PrintPG() ^ C:\\Users\\OWNER\\Documents\\Arduino\ ermometr\ ermometr.ino: In function 'void loop()': termometr:98: error: 'PrintPG' was not declared in this scope PrintPG(); ^ termometr:130: error: 'PrintPG' was not declared in this scope PrintPG(); ^ Multiple libraries were found for "LiquidCrystal.h" Used: C:\\Users\\OWNER\\Desktop\\183\\arduino-1.8.3\\libraries\\LiquidCrystal Not used: C:\\Users\\OWNER\\Documents\\Arduino\\libraries\\Newliquidcrystal_1.3.5 Using library LiquidCrystal at version 1.0.5 in folder: C:\\Users\\OWNER\\Desktop\\183\\arduino-1.8.3\\libraries\\LiquidCrystal exit status 1 expected constructor, destructor, or type conversion before ';' token
ted
2 years ago
//Function declarations float SteinHart(float R) { float logR = log(R); float result; result = (1.0 / (A + B*logR + C*logR*logR*logR)); //Calculation of current temperature in Kelvin with Steinhart - Hart approximation of NTC R-T curve result = result - 273.15; //T in degrees Celcius return result; }
ted
2 years ago
Hi Peter asterisk I have them in my program, they are converted to forward slash when I click on POST button. Can you post corrected code ?
MichDragstar
7 years ago
Hi Groeneveld64, very nice project, thank you for sharing!! Kind regards, MichDragstar
Groeneveld64
1 Followers
•2 Projects
22
MichDragstar
2 years ago
Hi Groeneveld64, very nice project, thank you for sharing!! Kind regards, MichDragstar