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.
1 Components Required
2 Working Principle
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.
Analog Reading
Arduino reads the LM35 voltage via analogRead(A0). The 10-bit ADC gives values from 0 to 1023 against a 5V reference.
Conversion Formula
The raw ADC value is mathematically converted to degrees Celsius using the reference voltage and sensor sensitivity.
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
analogRead(A0) returns 574: temperature = (574 × 5.0 × 100) / 1024 ≈ 28°C
4 Circuit Diagram & Connections
LM35 Pin Connections
| LM35 Pin | Arduino Pin | Wire | Purpose |
|---|---|---|---|
| VCC | 5V | 🔴 Red | Power supply |
| Vout | A0 | 🟡 Yellow | Analog temperature output |
| GND | GND | ⚫ Black | Ground |
7-Segment Display Connections
| Segment | Arduino Pin | Resistor | Note |
|---|---|---|---|
| a | D2 | 220Ω | Top segment |
| b | D3 | 220Ω | Top-right segment |
| c | D4 | 220Ω | Bottom-right segment |
| d | D5 | 220Ω | Bottom segment |
| e | D6 | 220Ω | Bottom-left segment |
| f | D7 | 220Ω | Top-left segment |
| g | D8 | 220Ω | Middle segment |
| COM | GND | — | Common cathode → GND |
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
Add Fahrenheit conversion mode
Buzzer alert for high temperature
Solar-powered weather station
5 Step-by-Step Wiring Guide
Insert the LM35 flat-face forward. The three pins are VCC (left), Vout (middle), GND (right).
Wire LM35 VCC → Arduino 5V. Wire LM35 GND → Arduino GND.
Wire LM35 Vout → Arduino A0 (the analog input that reads temperature).
Insert the display. Identify the common pin (usually pin 3 or 8 — check your datasheet).
Place one 220Ω resistor in series with each segment pin (a–g) to limit current and protect LEDs.
Wire segments a→D2, b→D3, c→D4, d→D5, e→D6, f→D7, g→D8 through the resistors.
For common cathode: COM → GND. For common anode: COM → 5V.
Open Arduino IDE, upload the code below, then open Serial Monitor (9600 baud) to verify the reading before testing the display.
6 Arduino Code
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 }
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.
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
Comments
Post a Comment