Introduction: Temperature on LCD 16x2
In my previous post, I have displayed the temperature on serial monitor. Today I will show you how to display the temperature from the thermistor to a 16x2 LCD WC1602A0. Yesterday I thought that my display is broken, but I have give him one more chance before give it away, and it was a shock for me to see that he is working.
Step 1: Make the Connections
The connections are simple. Like in the image.
You will need a display, some wires, 2 x led, 3 resistor 560 ohm, one 10k resistor, a 10k thermistor, breadboard and arduino.
Step 2: Code
The code is very simple, instate doing the serial print, you have to print your results on a LCD.I have also attached the code, because sometimes are problems by copy paste. So the code is:
/*
ADC C
250, 1.4
275, 4.0
300, 6.4
325, 8.8
350, 11.1
375, 13.4
400, 15.6
425, 17.8
450, 20.0
475, 22.2
500, 24.4
525, 26.7
550, 29.0
575, 31.3
600, 33.7
625, 36.1
650, 38.7
675, 41.3
700, 44.1
725, 47.1
750, 50.2
775, 53.7
784, 55.0
800, 61.5
850, 66.2
875, 71.5
900, 77.9
925, 85.7
937, 90.3
950, 96.0
975, 111.2
1000, 139.5
*/
#include<math.h>
#include<LiquidCrystal.h>
LiquidCrystal lcd (2, 3, 4, 5, 6, 7);//this are the lcd pins
double Thermister(int RawADC)
{
double temp;
temp = log(((10240000/RawADC) - 10000));
temp = 1 / (0.001129148 + (0.000234125 * temp) + (0.0000000876741 * temp * temp * temp)); temp = temp - 273.15; // convertire kelvin la celsius
lcd.print("Celsius=");//you print your values on your display
return temp;
}
int tempPin = 1; // conectare termistor si rezistenta de 10k
int temp; // citire analog int
LEDCool = 10; // Led temperatura joasa
int LEDHot =9; // LED temperatura peste temperatura mediului ambiant
int breakPoint = 450;
void setup(void)
{
lcd.begin(16,2);
lcd.clear();
Serial.begin(115200);
}
void loop(void)
{
temp = analogRead(tempPin);
lcd.println(int(Thermister(analogRead(1))));
lcd.print("Kelvin = ");
lcd.println(temp); // citire valori
if (temp <= breakPoint)
{
//in functie de temperatura de referinta hotaraste daca e cald sau rece
digitalWrite (LEDCool, HIGH);
digitalWrite (LEDHot, LOW);
}
else
{
digitalWrite (LEDHot, HIGH);
digitalWrite (LEDCool, LOW); delay(100);
}
}
Attachments
Step 3: Results
On the lcd you will receive the temperature and the led will be red or yellow, that depends of the temperature you measure.
red=hot
yellow=cool




