Temperature Measurement and Display using Arduino Uno and LM35 temperature sensor

Temperature Measurement with LM35 & 7-Segment Display – Arduino Tutorial | MakeMindz
Beginner
🌡️ Arduino Sensor Tutorial

Temperature Measurement
with LM35 & 7-Segment Display

Read ambient temperature using the LM35 analog sensor, convert it with Arduino's ADC, and show live readings on a 7-segment display.

LM35 Sensor ADC Conversion 7-Segment Display Multiplexing Tinkercad

1 Components Required

🧠 Arduino UNO
🌡️ LM35 Sensor
🔢 7-Segment Display
220Ω Resistors
🔲 Breadboard
🔌 Jumper Wires
💻 Arduino IDE

2 Working Principle

Step 1

Temperature Sensing

The LM35 outputs a voltage directly proportional to temperature — 10 mV per °C. At 25°C it outputs 250 mV; at 30°C, 300 mV.

Step 2

Analog Reading

Arduino reads the LM35 voltage via analogRead(A0). The 10-bit ADC gives values from 0 to 1023 against a 5V reference.

Step 3

Conversion Formula

The raw ADC value is mathematically converted to degrees Celsius using the reference voltage and sensor sensitivity.

Step 4

Display on 7-Segment

Digits are split from the temperature value and shown on the display. Multi-digit displays use multiplexing to appear continuous.

3 Temperature Conversion Formula

ADC → °C Conversion
temperature = ( analogValue × 5.0 × 100.0 ) / 1024.0
× 5.0 → reference voltage (5V) × 100 → because 10 mV = 1°C ÷ 1024 → 10-bit ADC steps
📐
Example Calculation If analogRead(A0) returns 574: temperature = (574 × 5.0 × 100) / 1024 ≈ 28°C

4 Circuit Diagram & Connections

circuit-diagram.json · LM35 + 7-Segment ↔ Arduino UNO SCHEMATIC
ARDUINO UNO 5V G A0 D2 D3 D4 D5 D6 D7 D8 5V GND A0 D2 D3 D4 D5 D6 D7 D8 LM35 SENSOR LM35DZ VCC VOUT GND 7-SEGMENT COMMON CATHODE = 28°C a→D2 b→D3 c→D4 d→D5 e→D6 f→D7 g→D8 COM→GND 220Ω ×7 Arduino UNO LM35 Sensor 7-Segment Display VCC GND VOUT→A0 Segments (via 220Ω)

LM35 Pin Connections

LM35 PinArduino PinWirePurpose
VCC5V🔴 RedPower supply
VoutA0🟡 YellowAnalog temperature output
GNDGND⚫ BlackGround

7-Segment Display Connections

SegmentArduino PinResistorNote
aD2220ΩTop segment
bD3220ΩTop-right segment
cD4220ΩBottom-right segment
dD5220ΩBottom segment
eD6220ΩBottom-left segment
fD7220ΩTop-left segment
gD8220ΩMiddle segment
COMGNDCommon cathode → GND
⚠️
Common Anode Display? Connect COM to 5V instead of GND and invert all segment logic in code — HIGH turns a segment OFF, LOW turns it ON.



5 Step-by-Step Wiring Guide

1
Place LM35 on breadboard

Insert the LM35 flat-face forward. The three pins are VCC (left), Vout (middle), GND (right).

2
Connect LM35 power

Wire LM35 VCC → Arduino 5V. Wire LM35 GND → Arduino GND.

3
Connect analog output

Wire LM35 Vout → Arduino A0 (the analog input that reads temperature).

4
Place 7-segment display on breadboard

Insert the display. Identify the common pin (usually pin 3 or 8 — check your datasheet).

5
Add 220Ω resistors

Place one 220Ω resistor in series with each segment pin (a–g) to limit current and protect LEDs.

6
Connect segments to Arduino

Wire segments a→D2, b→D3, c→D4, d→D5, e→D6, f→D7, g→D8 through the resistors.

7
Connect common pin

For common cathode: COM → GND. For common anode: COM → 5V.

8
Upload code and test

Open Arduino IDE, upload the code below, then open Serial Monitor (9600 baud) to verify the reading before testing the display.

6 Arduino Code

ARDUINO C++
int sensorPin = A0;

void setup() {
  Serial.begin(9600);
}

void loop() {
  int analogValue = analogRead(sensorPin);

  // Convert ADC value to Celsius
  // LM35: 10mV per °C, 5V ref, 10-bit ADC
  float temperature = (analogValue * 5.0 * 100.0) / 1024.0;

  Serial.print("Temperature: ");
  Serial.print(temperature);
  Serial.println(" C");

  delay(1000);  // Read every second
}
💡
Serial Monitor After uploading, open Tools → Serial Monitor (9600 baud) to watch live temperature readings before wiring the 7-segment display.

7 Multiplexing (4-Digit Display)

A 4-digit display reuses the same segment pins for all digits. Only one digit is active at a time, but they cycle so fast (1–5 ms) that all digits appear lit simultaneously.

01Activate Digit 1
02Send segment data
03Wait 1–5 ms
04Deactivate Digit 1
05Repeat for Digit 2, 3, 4…
🔄
Example: Showing 28°C Split the integer: tens digit = 2, units digit = 8. Activate digit 1 → show "2" → switch to digit 2 → show "8". Cycle at >100 Hz to appear solid.

8 Try It in Tinkercad

Simulate the complete circuit in your browser — no physical components needed. The Tinkercad project includes the LM35, display, and pre-loaded code.

Open Simulation in Tinkercad

9 What You Learn

📡Analog sensor interfacing
🔢ADC (Analog-to-Digital Conversion)
🧮Voltage-to-temperature conversion
💡7-segment display control
🔄Multiplexing technique
🛠️Embedded system fundamentals

10 Applications

🌡️Digital Thermometer
🌦️Weather Monitoring
🏠Smart Home Automation
🏭Industrial Monitoring
🎓School Science Projects

Possible Upgrades

🖥️Add I2C LCD instead of 7-segment
📶IoT monitoring via ESP8266
💾Log temperature data to SD card
°FAdd Fahrenheit conversion mode
🔔Buzzer alert for high temperature
☀️Solar-powered weather station

© 2026 MakeMindz · Arduino & Robotics Tutorials · Made with ❤️ for makers

Comments

try for free