Building a Simple Thermometer with Arduino

Hey, let’s builda simple Arduino based thermometer! If you want to start playing around right away, start with simulation link given at the bottom.

Parts:

  1. Arduino Uno
  2. TMP 36
  3. LCD 16x2

Diagram:
Circuit Diagram (Click to Enlarge)

Code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <LiquidCrystal.h>
int sensorPin = 0;
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(0, 1, 8, 9, 10, 11); //REGISTER SELECT PIN,ENABLE PIN,D4 PIN,D5 PIN, D6 PIN, D7 PIN
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
}

void loop() {
//getting the voltage reading from the temperature sensor
int reading = analogRead(sensorPin);

// converting that reading to voltage, for 3.3v arduino use 3.3
float voltage = reading * 5.0;
voltage /= 1024.0;

// now print out the temperature
float temperatureC = (voltage - 0.5) * 100 ; //converting from 10 mv per degree with 500 mV offset
//to degrees ((voltage - 500mV) times 100)



// set the cursor to column 0, line 1
lcd.print(temperatureC);//print temperature

lcd.setCursor(0, 0);// set the cursor to column 0, line1
delay(1000);
lcd.clear();
}

Simulation:
Tinkercad

Author

Devji Chhanga

Posted on

2023-08-24

Updated on

2023-08-25

Licensed under

Comments