Complete Guide How to Creating a Quick-Read Thermometer using Arduino

Creating a Quick-Read Thermometer

In this project, I will show you a Complete Guide on How to Creating a Quick-Read Thermometer using Arduino step by step complete process.

Temperature can be realized by an analog signal. We can measure temperature utilizing the TMP36 voltage output temperature sensor made by Analog Devices, shown in Figure 1.

the TMP36 marks just like the BC548 transistor we operated on within the relay control circuit. The TMP36 outputs a voltage that is equal to the temperature, so you can discover the current temperature utilizing a simple conversion. For example, at 25 degrees Celsius, the output voltage is 750 mV, and each change in temperature of 1 degree results in a change of 10 mV. The TMP36 can measure temperatures within−40 and 125 degrees Celsius.

TMP36 temperature sensor
Figure 1. TMP36 temperature sensor

The function analogRead() will return a value within 0 and 1,023, which corresponds to a voltage within 0 and just under 5,000 mV (5 V). If we multiply the output of analogRead() by (5,000/1,024), then we will get the actual voltage returned by the sensor. Next, we subtract 500 (an offset utilized by the TMP36 to allow for temperatures below zero) and then divide by 10, which leaves us with the temperature in degrees Celsius. If you work in Fahrenheit, then multiply the Celsius value by 1.8 and add 32 to the result.

≡  Aime

we’ll utilize the TMP36 to build a quick-read thermometer utilizing Arduino. If the temperature drops below 20 degrees Celsius, a blue LED turns on. If the temperature is within 20 and 26 degrees, a green LED turns on, and If the temperature is over 26 degrees, a red LED turns on.

≡ Hardware Quick-Read Thermometer using Arduino

For this project, you have to need this component

  1. 560 Ω resistors
  2. red LED
  3.  green LED
  4.  blue LED
  5. TMP36 temperature sensor
  6. breadboard
  7. Various connecting wires
  8. Arduino and USB cable

≡ Schematic

The circuit is very easy. If you’re seeing at the labeled side of the TMP36, the pin on the left joins to the 5 V input, the middle pin is the voltage output, and the pin on the right joins to GND as shown in Figure 2.

Creating a Quick-Read Thermometer
Creating a Quick-Read Thermometer

≡ Sketch Quick-Read Thermometer using Arduino

#define HOT    6
  #define NORMAL 4
  #define COLD   2

  float voltage  = 0;
  float celsius  = 0;
  float hotTemp  = 26;
  float coldTemp = 20;
  float sensor = 0;

  void setup()
    pinMode(HOT, OUTPUT);
    pinMode(NORMAL, OUTPUT);
    pinMode(COLD, OUTPUT);

  void loop()
     // read the temperature sensor and convert the result to degrees Celsius
1   sensor = analogRead(0);
    voltage = (sensor*5000)/1024; // convert raw sensor value to millivolts
    voltage = voltage-500;        // remove voltage offset
    celsius = voltage/10;         // convert millivolts to Celsius

    // act on temperature range
2   if ( celsius < coldTemp )
      digitalWrite(COLD, HIGH);
      digitalWrite(COLD, LOW);
3   else if ( celsius > coldTemp && celsius <= hotTemp )
      digitalWrite(NORMAL, HIGH);
      digitalWrite(NORMAL, LOW);
      // celsius is > hotTemp
      digitalWrite(HOT, HIGH);
      digitalWrite(HOT, LOW);

≡ Sketch Analysis Quick-Read Thermometer using Arduino

The sketch opening shows the voltage from the TMP36 and changes it to temperature in degrees Celsius at 1. And utilizing the if-else functions at 2 and 3, the code matches the current temperature on the values for hot and cold and turns on the relevant LED. The delay(1000) statements are utilized to stop the lights from flashing on and off too fast if the temperature fluctuates quickly in two ranges.

≡ Hacking the Sketch

Although this sketch was very easy, you could utilize it as the reason for taking other sorts of readings. You might add a PowerSwitch Tail, for example, as shown in Figure 3.

A PowerSwitch Tail that switches up to 120 V AC
Figure 3 . A PowerSwitch Tail that switches up to 120 V AC

With a PowerSwitch Tail, you can carefully control any appliance that runs from the wall socket, such as a heater, lamp, or another device with a digital output from your Arduino. (For more information, visit For example, you could utilize a PowerSwitch Tail to build a temperature-controlled heater or fan, control a garage light so it runs for a time and then switches off, or remotely control outdoor Christmas lights.

All Arduino tutorial available Click here


 28 total views,  1 views today