How to Build a Simple Arduino Temperature Sensor for Under

How to Build a Simple Arduino Temperature Sensor for Under $20


Building your own Arduino temperature sensor is a great way to get started with electronics and microcontroller programming. With just a few simple components, you can make a sensor that detects ambient temperature for less than $20. In this guide, I'll walk you through the entire process step-by-step.

What You'll Need

To build the temperature sensor, you'll need just a few parts:

All of these components can be purchased for well under $20 total. I recommend getting a starter kit that includes the Arduino, breadboard, jumper wires, and various electronic components.

Circuit Diagram

Here is the circuit diagram showing how to connect the components:

The temperature sensor gets connected to analog pin A0, the LCD display to digital pins 11-13, and the 10k ohm resistor connects between the sensor and power.

Assembling the Circuit

With your components gathered, it's time to build the circuit:

  1. Insert the Arduino into the breadboard. Make sure it straddles the center trench with pins on each side.

  2. Connect the VCC and GND pins of the TMP36 sensor to power (5V) and ground respectively.

  3. Connect the VOUT pin of the sensor to analog pin A0 on the Arduino.

  4. Connect one leg of the 10K resistor to VOUT and the other leg to 5V. This creates a voltage divider.

  5. Connect the LCD display pins to Arduino pins 11-13. Make sure to line up the GND and VCC pins correctly.

Once all the connections are made, double check that everything is correct before powering on.

Loading the Code

With the hardware built, it's time to load the Arduino sketch. This code reads the temperature sensor input and prints to the LCD display.

To load the code:

  1. Download the Arduino IDE software on your computer.

  2. Copy the code from the sketch below and paste it into a new Arduino sketch.

  3. Upload the code to your Arduino board.

// LCD & TMP36 Temperature Sensor Connections


const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
const int tempPin = 0;

void setup()
lcd.begin(16, 2);
lcd.setCursor(0, 1);

void loop() {
// Read voltage from TMP36
int reading = analogRead(tempPin);

// Convert to temperature in Celsius
float voltage = reading * 5.0 / 1024.0;
float temperature = (voltage - 0.5) * 100;

// Print temperature
lcd.setCursor(0, 1);
lcd.print(" C");


This code handles initializing the LCD display, reading the sensor, converting the input to Celsius, and printing the temperature.

Testing It Out

After uploading the code, the Arduino temperature sensor should be complete!

The LCD screen will display the current temperature in Celsius. Try breathing on the sensor or putting it in the fridge/outside to see the numbers change.

To improve accuracy, you can calibrate the readings by comparing them to a known thermometer. Adjust the conversion formula if needed.

Some ways to expand on this project include logging readings to a computer, adding an LED indicator, or connecting to the internet to publish data. But the simple version still makes an easy to build and educational introduction to DIY electronics!


Building your own temperature sensor with an Arduino is a straightforward electronics project that can be completed in an afternoon for under $20. All it takes is a few standard components and some basic code to read and display sensor input.

Not only do you end up with a useful tool, but you gain valuable skills in working with microcontroller platforms like Arduino. This project is a great starting point before moving onto more advanced sensors, IoT devices, robotics applications and more.