Zbotic Logo Zbotic Logo
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

  • Shop
  • About Us
  • Contact Us
  • Reseller
  • Blogs
020 69134444
1800 209 0998
[email protected]
Help Desk
Facebook Twitter Instagram Linkedin YouTube
Zbotic Logo Zbotic Logo
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

All departments
  • 3D Print Service
  • 3D Printer
  • Batteries & Chargers
  • Development Boards
  • Drone Parts
  • EBike parts
  • Sensor Modules
  • Electronic Components
  • Electronic Modules
  • IoT and Wireless
  • Mechanical Parts and Workbench Tools
  • Motors & Drivers & Pumps & Actuators
  • DIY and Robot Kits
  • Show more
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
Return to previous page
Home Sensors & Modules

Temperature Sensor Comparison: DS18B20 vs DHT22 vs BME280 vs LM35

Temperature Sensor Comparison: DS18B20 vs DHT22 vs BME280 vs LM35

April 1, 2026 /Posted by / 0

Picking the right temperature sensor for your Arduino project means understanding how DS18B20, DHT22, BME280, and LM35 differ in accuracy, interface, features, and price. Each sensor has a specific sweet spot, and choosing the wrong one leads to wasted time rewiring or writing workaround code. This temperature sensor comparison breaks down every practical difference so you can make a confident decision before placing your order.

Table of Contents

  • Quick Comparison Table
  • LM35: The Analogue Veteran
  • DHT22: Temperature Plus Humidity
  • DS18B20: Waterproof and Chainable
  • BME280: The Triple Threat
  • Arduino Code for Each Sensor
  • Which Sensor Should You Choose?
  • Frequently Asked Questions

Quick Comparison Table

Feature LM35 DHT22 DS18B20 BME280
Temperature Range -55 to 150°C -40 to 80°C -55 to 125°C -40 to 85°C
Accuracy ±0.5°C (at 25°C) ±0.5°C ±0.5°C ±1°C
Resolution Depends on ADC 0.1°C 0.0625°C (12-bit) 0.01°C
Interface Analogue Digital (proprietary) Dallas OneWire I2C / SPI
Humidity No Yes (±2%) No Yes (±3%)
Pressure No No No Yes (±1 hPa)
Waterproof Version No No Yes No
Multi-Sensor Bus No (1 per pin) No (1 per pin) Yes (many per pin) 2 per I2C bus
Price (₹) 45-65 150-250 50-120 180-350

LM35: The Analogue Veteran

The LM35 by Texas Instruments is one of the oldest and simplest temperature sensors still in widespread use. It outputs an analogue voltage linearly proportional to temperature — 10 mV per degree Celsius. At 25°C, the output is 250 mV. Connect it to an Arduino analogue pin, read the ADC value, and convert using a simple formula.

Strengths

  • No library needed — just analogRead() and basic maths
  • Fast response time (~2 seconds)
  • Wide operating voltage (4V to 30V)
  • Pre-calibrated at the factory — no calibration needed
  • Cheapest option at ₹45-65

Limitations

  • Arduino’s 10-bit ADC limits resolution to ~0.5°C steps (at 5V reference)
  • Long wire runs pick up electrical noise on the analogue signal
  • Only temperature — no humidity or pressure
  • Not available in a waterproof package
  • Negative temperatures require a negative supply voltage or offset circuit
🛒 Recommended: LM35 Temperature Sensor — Factory-calibrated analogue output, no library needed, ideal for beginners learning ADC concepts.

Best Use Cases

Teaching ADC concepts in electronics courses. Simple room temperature displays. Quick prototyping when you need a temperature reading in minutes with zero library setup.

DHT22: Temperature Plus Humidity

The DHT22 (also sold as AM2302) measures both temperature and relative humidity through a single digital pin. It uses a capacitive humidity sensor and a thermistor internally, with a small chip that converts the readings into a proprietary serial protocol.

Strengths

  • Measures humidity (0-100% RH, ±2%) alongside temperature
  • Digital output — immune to analogue noise on long cables
  • Simple wiring: VCC, GND, and one data pin (plus a 10k pull-up resistor)
  • Well-supported DHT.h library with examples
  • Module versions come with the pull-up resistor built in

Limitations

  • Slow sampling rate — one reading every 2 seconds maximum
  • Occasional read failures (the library returns NaN) — always add error checking
  • No waterproof version available
  • Only one sensor per data pin (each needs a dedicated GPIO)
  • The cheaper DHT11 variant sacrifices accuracy (±2°C) for lower cost
🛒 Recommended: DHT22 Temperature and Humidity Sensor Module (with cable) — Includes pull-up resistor and cable, ready to plug into Arduino.

Best Use Cases

Weather stations, greenhouse monitoring, server room environmental alerts, HVAC monitoring, and any project where both temperature and humidity matter. In India’s humid monsoon climate, tracking humidity alongside temperature is essential for comfort and mould prevention.

DS18B20: Waterproof and Chainable

The DS18B20 by Maxim (now Analog Devices) uses the Dallas OneWire protocol, which means you can connect dozens of sensors on a single Arduino pin. Each sensor has a factory-programmed unique 64-bit serial number. The waterproof stainless-steel probe version makes it the only option for measuring liquid temperatures.

Strengths

  • Multiple sensors on one pin — run 10+ sensors through a single GPIO with one 4.7kΩ pull-up resistor
  • Waterproof probe available — measure water, oil, soil, or any liquid
  • Configurable resolution: 9-bit (0.5°C, 94ms) to 12-bit (0.0625°C, 750ms)
  • Parasitic power mode — can operate with just 2 wires (data + GND)
  • Long cable runs (up to 100m with proper pull-up and cabling)

Limitations

  • No humidity or pressure measurement
  • Slower at high resolution — 750ms per reading at 12-bit
  • Requires OneWire and DallasTemperature libraries
  • Finding sensor addresses can be confusing for beginners
🛒 Recommended: DS18B20 Waterproof Temperature Sensor Probe (1m cable) — Stainless steel probe for liquid and outdoor temperature monitoring.
🛒 Recommended: DS18B20 Temperature Sensor Module — Breakout board version with pull-up resistor for PCB and breadboard use.

Best Use Cases

Aquarium temperature control, fermentation monitoring, water heater monitoring, multi-zone building temperature mapping, soil temperature for agriculture, and industrial process monitoring where waterproofing is essential.

BME280: The Triple Threat

Bosch’s BME280 combines temperature, humidity, and barometric pressure in a 2.5×2.5 mm package. It communicates via I2C (default) or SPI and offers the highest resolution of any sensor in this comparison.

Strengths

  • Three measurements in one sensor — temperature, humidity, and barometric pressure
  • I2C interface — shares the bus with other I2C sensors on the same two wires
  • Very high resolution: 0.01°C temperature, 0.008% humidity, 0.18 Pa pressure
  • Pressure data enables altitude estimation (±1 metre)
  • Low power consumption (3.6 µA at 1 Hz sampling) — ideal for battery projects
  • Well-supported by Adafruit, SparkFun, and community libraries

Limitations

  • Temperature accuracy is ±1°C (wider than DHT22 and DS18B20)
  • Self-heating: continuous reading heats the chip, adding 1-2°C offset in enclosed spaces
  • Only 2 I2C addresses available (0x76 and 0x77) — maximum 2 sensors per I2C bus
  • Not waterproof — the sensor has an open port for pressure measurement
  • Most expensive option at ₹180-350

Important: The BMP280 (without the ‘E’) measures only temperature and pressure — no humidity. Check that your module says BME280 if you need all three measurements. The boards look identical.

🛒 Recommended: GY-BME280-3.3 Precision Altimeter Atmospheric Pressure Sensor Module — Temperature, humidity, and pressure in one compact I2C board.

Best Use Cases

Weather stations, indoor air quality monitors, drone altitude hold, altimeters for trekking, IoT environmental logging, and any project where you need multiple environmental readings without wiring multiple sensors.

Arduino Code for Each Sensor

LM35 Code

const int lm35Pin = A0;

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

void loop() {
  int rawValue = analogRead(lm35Pin);
  float voltage = rawValue * (5.0 / 1024.0);
  float temperature = voltage * 100.0; // 10mV per degree

  Serial.print("LM35 Temperature: ");
  Serial.print(temperature, 1);
  Serial.println(" C");
  delay(1000);
}

DHT22 Code

#include "DHT.h"

#define DHTPIN 2
#define DHTTYPE DHT22

DHT dht(DHTPIN, DHTTYPE);

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

void loop() {
  delay(2000); // DHT22 needs 2s between reads

  float humidity = dht.readHumidity();
  float temperature = dht.readTemperature();

  if (isnan(humidity) || isnan(temperature)) {
    Serial.println("DHT22 read failed, retrying...");
    return;
  }

  Serial.print("DHT22 - Temp: ");
  Serial.print(temperature, 1);
  Serial.print(" C | Humidity: ");
  Serial.print(humidity, 1);
  Serial.println(" %");
}

DS18B20 Code

#include <OneWire.h>
#include <DallasTemperature.h>

#define ONE_WIRE_BUS 4

OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

void setup() {
  Serial.begin(9600);
  sensors.begin();
  Serial.print("Found ");
  Serial.print(sensors.getDeviceCount());
  Serial.println(" DS18B20 sensor(s)");
}

void loop() {
  sensors.requestTemperatures();

  for (int i = 0; i < sensors.getDeviceCount(); i++) {
    float temp = sensors.getTempCByIndex(i);
    Serial.print("DS18B20 #");
    Serial.print(i);
    Serial.print(": ");
    Serial.print(temp, 2);
    Serial.println(" C");
  }
  delay(1000);
}

BME280 Code

#include <Wire.h>
#include <Adafruit_BME280.h>

Adafruit_BME280 bme;

void setup() {
  Serial.begin(9600);
  if (!bme.begin(0x76)) {
    Serial.println("BME280 not found! Check wiring.");
    while (1);
  }
}

void loop() {
  Serial.print("BME280 - Temp: ");
  Serial.print(bme.readTemperature(), 2);
  Serial.print(" C | Humidity: ");
  Serial.print(bme.readHumidity(), 1);
  Serial.print(" % | Pressure: ");
  Serial.print(bme.readPressure() / 100.0, 1);
  Serial.println(" hPa");
  delay(2000);
}

Which Sensor Should You Choose?

Here’s a decision flowchart based on your project requirements:

  • Need to measure liquid or outdoor temperature? → DS18B20 waterproof probe. Nothing else here is waterproof.
  • Need temperature + humidity (weather station, HVAC)? → DHT22 for budget builds, BME280 for advanced projects that also need pressure.
  • Need multiple temperature points on one Arduino? → DS18B20. Connect 10+ sensors on a single pin.
  • Learning electronics and ADCs? → LM35. Pure analogue, no libraries, teaches fundamental concepts.
  • Need altitude estimation? → BME280. Barometric pressure maps to altitude.
  • Battery-powered IoT device? → BME280. Lowest power consumption at 3.6 µA.
  • Tightest budget? → LM35 at ₹45 or DS18B20 bare chip at ₹50.

Frequently Asked Questions

Can I use multiple different sensors in one project?

Absolutely. Many weather stations use a DS18B20 waterproof probe for outdoor temperature and a BME280 inside for indoor temperature, humidity, and pressure. They use different interfaces so there’s no conflict. Just use the appropriate library for each.

Why does my LM35 show wrong readings?

The most common issue is electrical noise on the analogue pin. Add a 100nF ceramic capacitor between the LM35 output and ground, as close to the sensor as possible. Also use analogReference(INTERNAL) for the 1.1V reference instead of 5V — this gives you much finer resolution for room temperature readings (0-110°C range).

My DHT22 keeps returning NaN (Not a Number). What’s wrong?

Check three things: (1) The 10kΩ pull-up resistor between data and VCC — module versions have this built in, bare sensors don’t. (2) You’re waiting at least 2 seconds between readings. (3) The cable length isn’t too long — beyond 5 metres, signal quality drops. If using a module board and the problem persists, try a different GPIO pin or a different sensor (some DHT22 clones have poor quality control).

Is the BME280 worth the extra cost over the DHT22?

If you need barometric pressure (weather prediction, altitude), yes — it’s the only sensor here that provides it. If you only need temperature and humidity, the DHT22 is more accurate for temperature (±0.5°C vs ±1°C) and costs less. The BME280 wins on resolution, power consumption, and I2C convenience.

Which sensor works best in hot Indian summers (45°C+)?

All four handle Indian summer temperatures easily — their ranges extend well above 50°C. The LM35 goes highest at 150°C. For outdoor monitoring, use the DS18B20 waterproof probe to protect against rain and dust. For indoor use, any of the four works. The BME280’s self-heating effect is more noticeable in enclosed spaces during hot weather, so ensure airflow around the sensor.

Conclusion

The DS18B20, DHT22, BME280, and LM35 each serve different project needs. There is no single “best” temperature sensor — only the best one for your specific application. For liquid monitoring, the DS18B20 waterproof probe is your only practical choice. For weather stations, the BME280 provides the most data per rupee spent. For learning and quick prototypes, the LM35 gets you a reading in under a minute with zero setup. And for temperature-plus-humidity at a fair price, the DHT22 remains the community favourite.

Browse and compare all temperature and environmental sensors at Zbotic’s sensor modules store.

Tags: BME280, DHT22, DS18B20, Sensors, Temperature
Share Post
  • Facebook
  • Linkedin
  • Whatsapp
Multimeter Buying Guide India:...
blog multimeter buying guide india best options under %e2%82%b95000 612451
blog orange pi vs raspberry pi which single board computer to buy in india 612455
Orange Pi vs Raspberry Pi: Whi...

Related posts

Svg%3E
Read more

Encoder Module: Position and Speed Measurement with Arduino

April 1, 2026 0
A rotary encoder converts the angular position and rotation speed of a shaft into electrical signals that Arduino can count... Continue reading
Svg%3E
Read more

Infrared Obstacle Sensor: Line Follower and Object Detection

April 1, 2026 0
Infrared obstacle sensors are the building blocks of line-following robots, edge detection systems, and proximity triggers. These tiny modules emit... Continue reading
Svg%3E
Read more

Rain Sensor and Raindrop Detection Module: Arduino Guide

April 1, 2026 0
A rain sensor module detects the presence of water droplets on its surface, giving Arduino a simple signal to trigger... Continue reading
Svg%3E
Read more

LiDAR Sensor TFmini: Distance Measurement Beyond Ultrasonic

April 1, 2026 0
When ultrasonic sensors hit their limits — range too short, accuracy too coarse, outdoor sunlight causing interference — LiDAR sensors... Continue reading
Svg%3E
Read more

Pressure Sensor BMP280: Weather Station and Altitude Meter

April 1, 2026 0
The BMP280 barometric pressure sensor by Bosch measures atmospheric pressure with ±1 hPa accuracy and temperature with ±1°C precision. These... Continue reading

Add comment Cancel reply

Your email address will not be published. Required fields are marked

Facebook Twitter Instagram Pinterest Linkedin Youtube

Get the latest deals and more.

Download on Google Play Download on the App Store

Call us: 020 69134444 / 1800 209 0998

Monday - Saturday 09:30 AM - 06:00 PM
For Technical Supports Email: [email protected]
For Sales / Enquiries Email: [email protected]

  • My Account

    • Cart

    • Wishlist

    • Checkout

    • My Orders

    • Track Order

    • My Account

  • Information

    • FAQs

    • Blogs

    • Career

    • About Us

    • Contact Us

    • Payment Options

  • Policies

    • Privacy Policy

    • Terms & Conditions

    • GST Input Tax Credit

    • Shipping Return Policy

    • E-Waste Collection Points

    • Our Sitemap

© Zbotic.in is registered trademark of Moxie Supply Pvt Ltd – All Rights Reserved
Login
Use Phone Number
Use Email Address
Not a member yet? Register Now
Reset Password
Use Phone Number
Use Email Address
Register
Already a member? Login Now