Arduino Project How to Measure Room Temperature


How to Measure Room Temperature


Table of Contents




Arduino



<img src="arduino.png" alt="arduino">


Arduino is a simple microcontroller board. It is an open source computing platform and has an environment for developing software for the Arduino board. It can be used to make an interactive project. It takes input from sensors or switches and controls the outputs. Arduino boards are inexpensive compared to other microcontroller based devices. It can stand-alone or can communicate with the software of the computer. Arduino software can run on Windows, Linux, and Macintosh OSX. It provides an Integrated Development Environment (IDE) which is written on Java for programming microcontrollers. It supports C and C++. So anyone who knows the basic programming C can easily access Arduino IDE. It is very simple. Arduino has built-in functions. It can access serial port. It does not need to access the register details. It can simply call the functions and easily perform the functions. So the coding and debugging are fast and efficient. Arduino IDE displays the data which is into and out of the serial port.

LM35



<img src="lm35.png" alt="lm35">


LM35 (TO-92 Package) is a precision integrated-circuit temperature sensor, whose output voltage is linearly proportional to the Celsius (Centigrade) temperature (Linear + 10.0 mV/°C scale factor). As it draws only 60 μA from its supply, it has very low self-heating, less than 0.1°C in still air. The LM35 is rated to operate over a −55°C to +150°C temperature range.

Wiring Diagram



<img src="arduino_lm35.png" alt="arduino_lm35">


  • LCD Enable pin to Arduino's digital pin 11
  • LCD RS pin to Arduino's digital pin 12
  • LCD D4 pin to Arduino's digital pin 5
  • LCD D5 pin to Arduino's digital pin 4
  • LCD D6 pin to Arduino's digital pin 3
  • LCD D7 pin to Arduino's digital pin 2
  • Vout LM35 to Arduino's analog pin A0


Source Code


Here is the source code for measuring room temperature.

/*
Program aplikasi pengukur suhu
Arduino LM35

Loki Lang
*/

#include <LiquidCrystal.h>

LiquidCrystal lang(12, 11, 5, 4, 3, 2);

int lm35 = A0;
int val = 0;
float temp;

void setup()
{
  pinMode(A0, INPUT);
  lang.begin(16, 2);
  lang.setCursor(0,0);
  lang.print("Arduino");
  lang.setCursor(0,1);
  lang.print("Pengukur Suhu");
  delay(1000);
}

void loop()
{
  lang.clear();
  val = analogRead(lm35); // nilai ADC terbaca
  delay(100);
  lang.setCursor(0,0);
  lang.print("Suhu celsius:");
  lang.setCursor(0,1);
  temp = val * 5;
  temp *= 100;
  temp /= 1024;
  lang.print(temp);
}


Read also in Bahasa Indonesia.