Arduino : Using "LM-35" a Termo Sensor Module

Words
849
Reading
4 min
Listen
Play
9y

What Will I Learn?


  • You will learn to use Sensor Termo (LM 35) Sensor.
  • You will learn how to integrate the Termo sensor with the arduino uno board.
  • You will learn how to make simple termometer with termo (LM 35) sensor.
Project Introduction

This project uses a temperatur sensor (LM-35) Module that is controlled by an arduino uno board. The LM-35 Module connect to analog pin as reader input termperatur and LCD connected to arduino uno board serves as Output viewer media.

Requirements


Hardware
  • Arduino Uno
  • The LM-35 Module
  • Liquid Crystal LCD ( 16 x 2 )
  • Breadboard
  • Jumper Wires Male To Male
  • USB type A to B cable
  • Personal Computer (Laptop)
Component Description

Arduino Uno - is a Atmega32-based microcontroller board.Having many digital and analog pins, the arduino can be easily programmed via a computer or laptop with USB and is designed to facilitate electronic users in various fields. As open source he comes with 2 products namely Hardware Arduino Board and Arduino IDE software.

LM-35 Module - LM35 is a sensor that can be used to measure temperature with output that is proportional to temperature (° C). Often used because it is more accurate than thermistor and easily combined with arduino board. The low price is also a major factor in the use of this tool. LM-35 has 3 pins "V (+)", "GND (-)" and signal (S).

Software
  • Arduino IDE
  • Fritzing BETA

Difficulty


  • Intermediate

Tutorial Contents

Step 1 : Prepare All Parts

3.png

Step 2 : Build Circuit Architecture

Using the fritzing software, we will create our Circuit Architecture. Open The Fritzing Beta - choose BreadBoard

  • Prepare Module

open fritzing and prepare all part you need to make the Circuit Architecture , you can make the circuit with another program , like proteus, Tinkercad etc.

1.png

  • Choose BreadBoard On the Fritzing (You can see the Image)
  • Choose Arduino uno to the project , you can search or click the arduino Label

2.png

  • Choose LM35 to the project , you can search or click the Sensor Label
  • Choose LCD 16 x 2 , you can search in the search box

After you Prepare all the part now connect the module (LCD & LM-35) on the breadBoard to the arduino board using the jumper wire. To add the wire just click the port and drag to another port.

Pin Connect LM-35

3.png

  • Connect the "GND" of the arduino uno board to "V(+)" LM-35. "Black Wire"
  • Connect the "5V" of the arduino uno board to "GND(-)" LM-35 . "Red Wire"
  • Connect the "Analog Number 0" of the arduino uno board to "Singnal" LM-35. "Purple Wire"

Pin Connect LCD

4.png

  • Connect the "GND" of the arduino uno board to "VSS" LCD .
  • Connect the "5V" of the arduino uno board to "VDD" LCD .
  • Connect the "pin number 7" of the arduino uno board to "RS" LCD.
  • Connect the "pin number 6" of the arduino uno board to "E" LCD.
  • Connect the "pin number 5" of the arduino uno board to "DB(4)" LCD.
  • Connect the "pin number 4" of the arduino uno board to "DB(5)" LCD.
  • Connect the "pin number 3" of the arduino uno board to "DB(6)" LCD.
  • Connect the "pin number 2" of the arduino uno board to "DB(7)" LCD.
Step 3 : Programing
  • Connect Arduino to the computer with USB .
  • Open the Arduino IDE > Chose your Board Type.

IDE.png

First you need to include the library for LCD , you can add here if don't have the library

5.png

#include 

The explenation of the coding :

• #include <LiquidCrystal.h> the code to include library for LCD

6.png

Second,initialize Variable you can use #int . . , #float . . , #double . . and #char . . in the case we will use #int . .

LiquidCrystal lcd(7, 6, 5, 4, 3, 2); 
int potPin = 0; 
float suhu = 0;
long val = 0;

The explenation of the coding :

• LiquidCrystal lcd(7, 6, 5, 4, 3, 2); = 0; this code to initialize the all input pin from the LCD

• int potPin = 0; this code to initialize the input pin for the LM35

• float suhu = 0; this code to initialize ouput

• long val = 0; this code to initialize the value result from the LM35

After Define you Now Set Up the All PinMode void setup()

7.png

void setup()
{
Serial.begin(9600); 
lcd.begin(16, 2); 
}

The explenation of the coding :

• Serial.begin(9600); to set up the serial monitor on the laptop Or Computer

• lcd.begin(16, 2); to set up the LCD's number of rows and columns

Last program is void loop() everything about the system can be run continuously.

8.png

void loop()
{
val = analogRead(potPin); 
suhu = (5.0 * val * 100.0)/1024.0; 
lcd.clear(); 
lcd.setCursor(0,0); 
lcd.print("current temp. "); 
lcd.setCursor(0,1); 
lcd.print((long)suhu); 
lcd.print(" deg.C");
delay(1000);
}

The explenation of the coding :

• val = analogRead(potPin); to read the value from the sensor

• suhu = (5.0 * val * 100.0)/1024.0; to convert to Celcius

• lcd.clear(); to clear LCD screen

• lcd.setCursor(0,0); to set text to LCD row 1

• lcd.print("current temp. "); to some text to add meaning to the numbers

• lcd.setCursor(0,1); to set text to LCD row 2

• lcd.print((long)suhu); to writing temperature value

• lcd.print(" deg.C"); to writing in the celcius

• delay(1000); to make delay 1ms

After write codes, click the "Verify button" to save and compile the sketch. This will also check for any errors in the program.

9.png

If no errors is found , now you can click "Upload button" to start installing the program into the arduino uno board.

10.png

Arduino : Using "LM-35" a Termo Sensor Module | Ecency