Javatpoint Logo
Javatpoint Logo

Arduino temperature sensor

The temperature sensor in Arduino converts the surrounding temperature to voltage. It further converts the voltage to Celcius, Celcius to Fahrenheit, and prints the Fahrenheit temperature on the LCD screen.

We will use a temperature sensor (TMP 36) of low voltage. Such sensors are also stable while dealing with large capacitive loads. It is also suitable for automotive applications.

The temperature sensors TMP 35, TMP 36, and TMP 37 are the sensors with the same features.

The operating voltage of the TMP 36 sensor ranges from 2.7V to 5.5V.

The sensor will look like the image shown below:

Arduino temperature sensor

It has three terminals, which are listed below:

  • Pin 1: DC voltage

Here, we will connect the DC voltage pin to 5V on the Arduino UNO board.

  • Pin 2: Analog voltage output

We will consider the Analog voltage output pin as the output.

  • Pin 3: GND

We will connect the GND pin to Ground on the Arduino UNO board.

Let's start the project.

Hardware Required

The components required for the project are listed below:

  • 1 x TMP 36 sensor (Temperature sensor)
  • 1 x LCD display
  • Arduino UNO R3 board (We can take any Arduino board).
  • Jump wires

Principle

We will connect the LCD Display and TMP 36 temperature sensor with the Arduino UNO R3 board. The sensor detects the surrounding temperature and converts it into volts, to Celsius to Fahrenheit, and displays Fahrenheit temperature on the LCD screen.

We need to open the URL: Arduino LCD display for details about LCD display.

Connection

The steps to set up the connection are listed below:

  • Connect the RS pin of LCD to pin 13 of the Arduino board.
  • Connect the Enable pin of LCD to pin 12 of the Arduino board.
  • Connect the D4 pin of LCD to pin 6 of the Arduino board.
  • Connect the D5 pin of LCD to pin 4 of the Arduino board.
  • Connect the D6 pin of LCD to pin 3 of the Arduino board.
  • Connect the D7 pin of LCD to pin 2 of the Arduino board.
  • Connect the Vo pin of LCD to pin 8 of the Arduino board.
  • Connect the middle terminal to a sensor to A0(analog pin).
  • Connect one end of the sensor to GND and another end to 5V.
  • Connect one end of a resistor to the A and K of the LCD and another end to 5V.

Sketch

Consider the below code:

We will show the connection using the Simulator because the connections become clearer and more precise.

We can make the same connection using the hardware devices.

Arduino temperature sensor

Output

The output is now visible on the LCD screen.

For better understanding, let's consider the output on the Serial Monitor.

Arduino temperature sensor

It is the temperature in Fahrenheit.






Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA