0% found this document useful (0 votes)
3 views8 pages

Temperature Sensor Using Arduino (LM35) - Project Report

Uploaded by

cesarbaes
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views8 pages

Temperature Sensor Using Arduino (LM35) - Project Report

Uploaded by

cesarbaes
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

English VII

Temperature Sensor Using Arduino


(LM35) - Project Report
Project carried out in the field of
“Electrical Circuits”

Members
Barrera Escarcega Cesar
Beltran Gonzalez Lennin Ulises
Hernández Cruz Rogelio
Pedraza Martínez Darién Cristopher

Professor: Peña Campos Manuel Alejandro

Course in which it was done: Programación


de periféricos
1. Introduction
The temperature sensor project aims to measure the environment temperature using the
LM35 sensor and display the results on the Serial Monitor of the Arduino IDE. The LM35 is
a temperature sensor that outputs an analog signal proportional to the temperature in
Celsius.

2. Components Required
Arduino Uno board: The Arduino Uno is a popular microcontroller board based on the
ATmega328P. It features 14 digital input/output pins, 6 analog inputs, a USB connection
for programming, and a power jack. Ideal for beginners, it allows users to create
interactive projects, from simple LED displays to complex robotics. The open-source
platform supports a wide range of sensors and modules, making it a versatile tool for
electronics and programming enthusiasts.

LM35 Temperature Sensor: The LM35 is a precision temperature sensor that provides an
analog voltage output proportional to the temperature in Celsius. It offers high accuracy
with a linear output of 10mV per degree Celsius, requiring no external calibration. It's
commonly used in environmental monitoring and temperature control systems due to
its simplicity and reliability.

Breadboard: A protoboard, also known as a breadboard, is a reusable platform used for


building and testing electronic circuits without soldering. It consists of interconnected
rows and columns of holes where components can be easily inserted and connected,
allowing quick modifications. Ideal for prototyping and educational purposes, it
simplifies circuit design and experimentation.

Jumper Wires: Jumpers are small wires with connector ends used to make quick and
temporary connections on protoboards or between components in electronic circuits.
They come in various lengths and types, such as male-to-male, male-to-female, and
female-to-female, making them versatile for different wiring needs.

USB Cable for programming the Arduino: The Arduino USB cable is used to connect an
Arduino board to a computer for programming and power supply. It typically has a
Type-A USB connector on one end and a Type-B connector on the other, providing
reliable data transfer and power to the board during project development.

3. Tools:
Computer
Screwdriver
tweezers
4. Circuit Diagram
LM35 Pinout:
VCC: Connected to 5V of Arduino.
GND: Connected to GND of Arduino.
OUT: Connected to the analog input pin (A0) of Arduino.
Circuit Connections:
Connect the VCC of the LM35 to the 5V pin of the Arduino.
Connect the GND of the LM35 to the GND pin of the
Arduino.
Connect the OUT pin of the LM35 to the A0 pin of the
Arduino.

Components:
LM35 Temperature Sensor: This sensor has three pins—VCC, GND,
and OUT.
Arduino: The microcontroller used to read the sensor data.
Breadboard: For connecting components without soldering.

Steps:
Place the LM35 on the Breadboard: Insert the LM35 into the
breadboard with the three pins (VCC, GND, and OUT) accessible on
separate rows for easier wiring.
Connect LM35 VCC Pin to Arduino 5V:

Use a jumper wire to connect the VCC pin of the LM35 (the first pin from
the left, when the flat side is facing you) to the 5V pin on the Arduino.
This provides power to the LM35 sensor.
Connect LM35 GND Pin to Arduino GND:

Use another jumper wire to connect the GND pin of the LM35 (the rightmost pin)
to the GND pin on the Arduino.
This completes the electrical circuit by connecting the ground.
Connect LM35 OUT Pin to Arduino Analog Pin A0:

The middle pin of the LM35 is the OUT pin, which gives an analog voltage
based on the temperature.
Use a jumper wire to connect this OUT pin to the A0 analog input pin on
the Arduino. This will allow the Arduino to read the temperature data
from the sensor.
4. Programming (Arduino Code)
Upload the following code to the Arduino using the Arduino IDE:

// Define the pin where the LM35 is connected


const int tempPin = A0;

void setup() {
// Start the serial communication
[Link](9600);
}

void loop() {
// Read the analog value from the temperature sensor
int analogValue = analogRead(tempPin);

// Convert the analog value to temperature in Celsius


float temperature = (analogValue * 5.0 * 100.0) / 1024;

// Print the temperature on the serial monitor


[Link]("Temperature: ");
[Link](temperature);
[Link](" °C");

// Wait for 1 second before the next reading


delay(1000);
}

1. Defining the Pin:

const int tempPin = A0;


This line defines a constant tempPin which is the analog pin A0 on the Arduino. The LM35
sensor is connected to this pin, and the analog signal from the sensor will be read here.

2. Setup Function: The setup() function runs once when the Arduino starts.
[Link](9600); initializes the serial communication at
void setup() { a baud rate of 9600 bits per second. This allows the
// Start the serial communication Arduino to send data (in this case, temperature values) to
[Link](9600); the computer, which can be displayed on the serial
} monitor.
3. Loop Function:

void loop() { // Read the analog value from the temperature sensor int
analogValue = analogRead(tempPin);

The loop() function runs repeatedly.


analogRead(tempPin) reads the analog voltage from the LM35 sensor connected to pin
A0 and stores this value in the variable analogValue. The value is between 0 and 1023
(because the Arduino has a 10-bit ADC).

4. Converting Analog Value to Temperature:

float temperature = (analogValue * 5.0 * 100.0) / 1024;

This line converts the raw analog value to a temperature in Celsius.


analogValue is multiplied by 5.0 because the Arduino operates at 5V, and the analog reading is
proportional to this voltage.
It is then multiplied by 100.0 because the LM35 outputs 10mV per degree Celsius.
Finally, it is divided by 1024, which is the resolution of the 10-bit ADC in the Arduino (i.e., it converts
the 0-1023 analog value into a corresponding voltage).

5. Printing the Temperature:

// Print the temperature on the serial monitor [Link]("Temperature: ");


[Link](temperature); [Link](" °C");

The [Link]() and [Link]()functions print the temperature value to the serial monitor.
First, "Temperature: " is printed.
Then, the actual temperature value is printed.
[Link](" °C"); adds "°C" to indicate that the value is in Celsius, and moves to the next line in the
monitor.

6. Delay for 1 Second:

// Wait for 1 second before the next reading delay(1000); }

delay(1000); pauses the program for 1000 milliseconds (or 1 second) before the
next reading. This creates a delay between each temperature measurement,
making it easier to observe changes over time.
Diagram

5. Explanation of the Code


Setup Function: The [Link](9600); line starts the serial communication
between the Arduino and the computer, allowing us to see the temperature
data on the Serial Monitor.
Loop Function:
analogRead(tempPin); reads the analog voltage output from the LM35 sensor.
The formula float temperature = (analogValue * 5.0 * 100.0) / 1024; converts
the analog value into Celsius. The LM35 outputs 10 mV per degree Celsius.
Finally, the temperature value is printed to the Serial Monitor.

6. Testing the Project


After connecting the circuit and uploading the code, open the Serial
Monitor from the Arduino IDE.
The temperature readings will start displaying, updating every second.
You can verify the accuracy by comparing the readings with a standard
thermometer.
Results:
Successful Temperature Measurement: The LM35 temperature sensor
successfully captured the temperature, and the Arduino displayed the
readings on the Serial Monitor in real time.
Accurate Conversion: The code accurately converted the analog input
from the LM35 sensor into temperature values in degrees Celsius using
the formula provided.
Real-Time Updates: The temperature data updated every second,
demonstrating a functional loop setup for continuous monitoring.
User-Friendly Setup: The components and code worked cohesively,
confirming the reliability of the circuit and programming for measuring
temperature.

Conclusions:
Effectiveness of the LM35 Sensor: The LM35 proved to be an effective and
reliable tool for measuring temperature, thanks to its precision and ease
of use.
Integration with Arduino: The project demonstrated the seamless
integration of the LM35 sensor with the Arduino Uno, showcasing its
suitability for simple environmental monitoring applications.
Learning Outcome: The project provided hands-on experience in circuit
assembly, sensor calibration, and Arduino programming, which are
essential skills for electronic prototyping.
Practical Application: This project serves as a foundation for developing
more complex systems, such as automated climate control or data
logging solutions.

You might also like