Introduction: TMP36 + LCD + Arduino: Indoor Temperature Monitor and Display

Picture of TMP36 + LCD + Arduino: Indoor Temperature Monitor and Display

Hello World!

I'm Unicorn Clockworks and I'm back with another instructables. Here, we will make a temperature indicator and display using the TMP36 IC. This is a very cheap and accurate temperature sensor -- about 2 bucks (CAD). This can be used both indoor and outdoor, but I'm focusing on indoor applications so no weather proofing is necessary.

You can also use this for other micro controller besides the Arduino, namely NodeMCU and ESP8266, apart from a small change in code that I will highlight with italics in that step.

Step 1: Materials

Picture of Materials

  • Arduino or any Arudino-compatible microcontroller
  • TMP36
  • LCD Display
  • Potentiometer
  • Breadboard
  • Jumper Wires

Step 2: LCD Connections

Picture of LCD Connections
I made a very detailed instructable for this particular step previously which can be found here: https://www.instructables.com/id/Temp-1/ , but you can also follow the steps below without missing out on the details.

The connections are labeled in the picture and the wires correspond to the images are noted below.

1a

  • Connect the Brown wire (pin 16) to the GND pin on the Arduino
  • Connect the Red wire (pin 15) to the 3.3V VCC pin on the Arduino
  • Connect the Orange, Yellow, Green, Blue (pins 14-11) to pins 2 to 5 on the Arduino

2

  • Connect the White wire (pin 1 on the LCD) to the common ground (pin 16)
  • Connect the Grey wire (pin 2 on the LCD) to the common VCC source (pin 15)
  • Connect the Purple wire to the signal pin of the potentiometer (pin 2 on the potentiometer)

3

  • Connect the Purple wire (pin 1 on the potentiometer) to the common ground (pin 16)
  • Connect the Grey wire (pin 3 on the potentiometer) to the common VCC source (pin 15)

4

  • Connect the Yellow wire (pin 4 on the LCD) to pin 12 on the Arduino
  • Connect the Black wire (pin 5 on the LCD) to the common ground (pin 1 on the potentiometer or pin 16 on the LCD, either works)
  • Connect the Green wire (pin 6 on the LCD) to pin 11 on the Arduino

Step 3: TMP36 Connections

Picture of TMP36 Connections
5
  • Connect the ground pin of the TMP36 -- pin 3 -- (as shown on the picture) to the any common ground (pin 1 on the potentiometer or GND on Arduino)
  • Connect the VCC pin of the TMP36 -- pin 1 -- to any common VCC source (pin 1 on the potentiometer or pin 2 on the LCD)
  • Connect the signal pin of the TMP36 -- pin 2 -- to pin A0 on the Arduino.

Step 4: Coding

Picture of Coding

Keep in mind that this line of code is only for the Arduino board specifically and if you are using other Arduino-core-compatible micro controller, delete it.

volts = tempVal * 3.3;

Other than this minor change, it works on any micro controller device.

#include <LiquidCrystal.h>	// built in arduino library<br>
<liquidcrystal.h>
LiquidCrystal lcd(12,11,5,4,3,2);</liquidcrystal.h>
int tempVal;  //raw reading variable
float volts;
float tempC;
float tempF;
void setup()
{
  lcd.begin(16, 2);
  // clear old screen data
  lcd.clear();
  // text to be dispalyed on the screen
  lcd.print("UnicornClockworks");
  Serial.begin (9600);
}
void loop()
{
 //read the temp sensor and store it in tempVal
 tempVal = analogRead(A0);
 
 //converting that reading to voltage by multiplying the reading by 3.3V 
 volts = tempVal * 3.3;
 volts /= 1023.0;
 //calculate temperature celsius from voltage
 tempC = (volts - 0.5) * 100 ;
  // Convert from celcius to fahrenheit
 tempF = (tempC * 9.0 / 5.0) + 32.0;
 Serial.println(tempC);
 
 // (column 0) of the second line (line 1):
 lcd.setCursor(0,1);
 lcd.write ("Temp: ");
 lcd.setCursor (7, 1);
 lcd.print (tempC, 2);
 lcd.setCursor (13, 1);
 lcd.write ("C");
 // for farenheit temperatures
 /*
 lcd.setCursor(0,1);
 lcd.write ("Temp: ");
 lcd.write (tempF);
 lcd.setCursor (10, 1)
 lcd.write ("F");
 */
 
  delay(1000);
}

Step 5: It Works!

Picture of It Works!

Upload the code to the Arduino and watch the display change. Test the sensor by touching it (make sure you have the polarity right so you don't burn your fingers.

Try it out yourself and have fun!

Unicorn Clockworks Out!

Comments

UnicornClockworks (author)2017-08-17

Here's another application of the LCD screen!

About This Instructable

485views

10favorites

License:

Bio: I love to make projects based on microcontrollers including robots and IoT technologies. Absolutely, truly, madly, deeply in love with planes. I also dabble in ... More »
More by UnicornClockworks:Billy the Biped Robot - 3D Printed HC-SR04 + Buzzer + Arduino: Parking Assist SensorServo Motor + Potentiometer + Arduino: Potentiometer-Controlled Servo
Add instructable to: