DIY Arduino Digital Thermometer
by Sourya Choudhury in Circuits > Arduino
590 Views, 4 Favorites, 0 Comments
DIY Arduino Digital Thermometer
Hello everyone ! Here, I will show you how to make a simple digital thermometer using Arduino.
Parts Required.
The following parts will be required for this project:
1) Arduino Nano .
2) Nokia 5110 LCD display.
3)LM- 35 temperature sensor.
4) Jumper wires.
5) Arduino ide and u8glib library(Download from Git-hub.
Connecting the LCD to the Arduino.
Connect the following Arduino pins to the LCD:
CLK=8, DIN=4, CE=7, DC=5, RST=6.
Connect the BL and Vcc pin on the LCD to 3.3v on the Arduino.
You may use resistors if you want, but in my case, connecting the LCD directly to the Arduino pins made no difference.
Lm-35.
The Lm-35 is a low-cost temperature sensor which can be used with Arduino.
Check the Lm-35 pinout diagram from here.
Connect the output pin of the Lm-35 to the A0 pin on the Arduino.
Connect the 5v and gnd pins too.
Code:
#include "U8glib.h"
int a=0;
float x;
double m;
double s;
//Prepared by Sourya Choudhury
// Credits-Henry's Bench tutorials for lcd tutorial.
U8GLIB_PCD8544 u8g(8, 4, 7, 5, 6);
// CLK=8, DIN=4, CE=7, DC=5, RST=6
void writer()
{
x= analogRead(a);
m=x/1024.0*5000;
s=m/10;
u8g.setFont(u8g_font_profont12);
u8g.setPrintPos(0,15);
u8g.print(s);
u8g.drawStr(35,15,"*C");
delay(100);
if (s>30)
{
u8g.drawStr(15,35,"So Hot!!");
}
else if (s<30 && s>20)
{
u8g.drawStr(15,35,"Nice!!");
}
else
{
u8g.drawStr(15,35,"Cool!!");
}
}
void setup()
{
Serial.begin(9600);
pinMode(a,INPUT);
}
void loop()
{
u8g.firstPage();
do{
writer();
} while( u8g.nextPage() );
}