A project comparing temperature accuracy between an LM35 analog sensor and a BMP180 barometric sensor, with pressure/altitude measurements.
Early Conclusion:
- LM35 is more accurate for temperature.
- BMP180 is not accurate as LM35 is, but provides pressure/altitude measurements. I've also tested DHT11 sensor previously and i can tell you that LM35 is so better and more accurate than DHT11, but if you want humidity beside temperature and price is not matter for your project, DHT22 is a better choice.
👉 You can find the full source code here:
GitHub Repo: payamhsn/Iot-LM35-vs-BMP180-Temp
🚀 Project Overview
This project compares:
- LM35 (analog temperature sensor)
- BMP180 (digital barometric sensor for temperature, pressure, and altitude)
Key Findings:
- The LM35 is more accurate for temperature (~24.44°C vs room thermometer: 24°C).
- The BMP180 reads slightly higher (~26.10°C) due to internal heat but provides useful pressure/altitude data.
🔍 How the Sensors Work
LM35 Temperature Sensor
- Principle: Linear analog output (10mV/°C).
- Accuracy: ±0.5°C at 25°C.
- No calibration needed – directly outputs Celsius.
- Formula: Temp (°C) = (ADC Reading × 500) / 1023
- Pros: Simple, low-cost, reliable.
- Cons: Only measures temperature.
BMP180 Barometric Sensor
- Measures:
- Temperature (°C)
- Pressure (hPa)
- Altitude (meters, derived from pressure)
- Interface: I²C (SDA: A4, SCL: A5 on Arduino Uno).
- How it calculates altitude: Altitude = 44330 × (1 − (P/P₀)^(1/5.255)) Where:
-
P
= Measured pressure -
P₀
= Sea-level pressure (1013.25 hPa default) - Pros: Multi-functional (pressure/altitude).
- Cons: Temperature may drift due to internal heat.
🔧 Hardware Setup
Wiring Diagram
Sensor | Arduino Uno Pin |
---|---|
LM35 | A0 (Analog) |
BMP180 | I²C (SDA:A4, SCL:A5) |
Circuit Setup:
- LM35:
-
VCC
→ 5V -
GND
→ GND -
OUT
→ A0 - BMP180:
-
VCC
→ 3.3V or 5V -
GND
→ GND -
SCL
→ A5 -
SDA
→ A4
My Wiring
💻 Code Explanation
The Arduino code:
- Reads LM35 (analog voltage → temperature).
- Reads BMP180 (temperature, pressure, altitude).
- Calculates the difference between the two sensors.
- Prints data to Serial Monitor every 10 seconds.
Key Libraries:
-
Wire.h
(I²C communication) -
Adafruit_BMP085.h
(BMP180 sensor driver)
📊 Serial Monitor Output
Sensor Data:
LM35 Temperature: 24.44 °C
BMP180 Temperature: 26.10 °C
Temperature Difference (BMP-LM35): 1.66 °C
BMP180 Pressure: 879.85 hPa
BMP180 Altitude: 1174.28 meters
🔎 Observations & Analysis
-
Temperature Difference (1.66°C):
- BMP180 tends to read higher due to internal heat from pressure sensing.
- LM35 is more reliable for ambient temperature.
-
Pressure & Altitude:
- Lower pressure (879.85 hPa) indicates higher altitude (1174m).
- Useful for weather tracking or elevation-based projects.
After hours of running LM35, i found that its get more and more accurate comparing to my other pro sensor.
I wrote most of this blog by myself and a little help of AI. Thanks!
Top comments (0)