Arduino Temperature Sensor Project (LM35/DHT11 Guide) for Beginners

Posted by

Ever wondered how your phone warns you about overheating or how smart homes automatically control room temperature? Behind many of these systems, there’s a simple temperature sensor doing all the work.

If you’re learning Arduino, building a temperature sensor project is one of the best beginner-friendly experiments you can try. It’s practical, affordable, and surprisingly fun once you see real-time temperature values appearing on your screen.

In this guide, you’ll learn how to create an Arduino Temperature Sensor Project using LM35 and DHT11 sensors. We’ll cover circuit connections, Arduino code, common mistakes, and real-world applications in simple language.

Let’s understand this step by step.


Table of Contents

  1. What is an Arduino Temperature Sensor Project?
  2. LM35 vs DHT11 Sensor
  3. Components Required
  4. Arduino LM35 Temperature Sensor Project
  5. Arduino DHT11 Temperature & Humidity Project
  6. Common Problems and Fixes
  7. Real-World Applications
  8. Conclusion
  9. FAQs

What is an Arduino Temperature Sensor Project?

An Arduino temperature sensor project allows the Arduino board to measure environmental temperature using electronic sensors like LM35 or DHT11.

The sensor collects temperature data and sends it to the Arduino. The Arduino then processes that data and displays it on the Serial Monitor, LCD display, or even a mobile app.

Here’s the thing — beginners often think temperature sensing is complicated. In reality, modern sensors make it incredibly easy.

These projects are commonly used in:

  • Smart home systems
  • Weather stations
  • Greenhouse monitoring
  • CPU temperature monitoring
  • Industrial automation
  • Fire warning systems

In real projects, this matters a lot because accurate temperature readings help protect devices and improve automation.


LM35 vs DHT11 Sensor

Before building the project, it’s important to understand the difference between these two popular Arduino sensors.

FeatureLM35DHT11
MeasuresTemperature onlyTemperature + Humidity
Output TypeAnalogDigital
AccuracyBetterModerate
Temperature Range-55°C to 150°C0°C to 50°C
Ease of UseVery easyEasy
CostCheapSlightly higher

Most beginners start with the LM35 because the wiring is simple. But if you also want humidity readings, the DHT11 is a better choice.


Components Required

For LM35 Project

  • Arduino Uno
  • LM35 Temperature Sensor
  • Breadboard
  • Jumper wires
  • USB cable

For DHT11 Project

  • Arduino Uno
  • DHT11 Sensor Module
  • Breadboard
  • Jumper wires

[Image: Arduino LM35 circuit wiring diagram]
Alt text: Arduino LM35 temperature sensor connection setup

[Image: DHT11 sensor connected with Arduino Uno]
Alt text: DHT11 temperature and humidity sensor Arduino project


Arduino LM35 Temperature Sensor Project

The LM35 is one of the easiest temperature sensors for beginners because it outputs analog voltage directly proportional to temperature.

LM35 Pin Configuration

The LM35 has 3 pins:

PinConnection
VCC5V
OUTA0
GNDGND

Most beginners make this mistake: connecting the sensor backward. Always double-check the flat side orientation before powering the circuit.


Circuit Connection

Connect the sensor like this:

  • LM35 VCC → Arduino 5V
  • LM35 OUT → Arduino A0
  • LM35 GND → Arduino GND

Once connected, upload the code below.


Arduino LM35 Code

// LM35 Temperature Sensor with Arduino

int sensorPin = A0;

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

void loop() {

int reading = analogRead(sensorPin);

float voltage = reading * (5.0 / 1023.0);

float temperature = voltage * 100;

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

delay(1000);
}

How This Code Works

Let’s break it down simply:

  • analogRead(A0) reads sensor voltage
  • Arduino converts analog data into voltage
  • LM35 gives 10mV per °C
  • The code converts voltage into temperature

For example:

  • 0.30V = 30°C
  • 0.40V = 40°C

When you open the Serial Monitor, you’ll see live temperature readings every second.


Common LM35 Issues

Wrong Temperature Values

Usually caused by:

  • Loose wires
  • Wrong pin connection
  • Poor USB power supply

Fluctuating Readings

This often happens due to electrical noise. Adding a small capacitor between VCC and GND can stabilize readings.


Arduino DHT11 Temperature & Humidity Project

Now let’s move to the DHT11 sensor.

Unlike LM35, the DHT11 can measure both temperature and humidity. That makes it useful for weather monitoring projects.


DHT11 Wiring

DHT11 PinArduino Connection
VCC5V
DATADigital Pin 2
GNDGND

If you’re using a DHT11 module board, it already includes the required resistor. Bare sensors may require a 10K pull-up resistor.


Install DHT Library

Before uploading code:

  1. Open Arduino IDE
  2. Go to Sketch → Include Library → Manage Libraries
  3. Search for:
    • “DHT sensor library”
  4. Install it

This is important because the DHT11 requires a library for communication.


Arduino DHT11 Code

#include <DHT.h>

#define DHTPIN 2
#define DHTTYPE DHT11

DHT dht(DHTPIN, DHTTYPE);

void setup() {

Serial.begin(9600);
dht.begin();

}

void loop() {

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

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

Serial.print("Humidity: ");
Serial.print(humidity);
Serial.println(" %");

delay(2000);
}

Understanding the Code

This code does two things:

  • Reads temperature
  • Reads humidity

The sensor sends digital data directly to Arduino, which makes calculations easier compared to analog sensors.

In real projects, this matters a lot because humidity monitoring is useful in:

  • Greenhouses
  • Server rooms
  • Smart farming
  • Weather stations

Which Sensor Should You Choose?

If you’re confused between LM35 and DHT11, here’s a simple recommendation.

Use CaseRecommended Sensor
Learning basicsLM35
Weather projectsDHT11
Better accuracyLM35
Humidity monitoringDHT11
Simple analog projectsLM35

For complete beginners, I usually recommend starting with LM35 first and then moving to DHT11.


Real-World Applications of Arduino Temperature Sensors

Temperature sensor projects are not just for learning. They’re used everywhere.

Smart Home Automation

Arduino can automatically turn fans or AC systems on when temperature rises.

Fire Detection Systems

High temperature alerts can trigger alarms.

Weather Monitoring

DHT11 sensors are commonly used in DIY weather stations.

Industrial Machines

Machines use temperature sensors to prevent overheating.

Greenhouse Farming

Humidity and temperature monitoring help protect crops.


Beginner Tips for Better Results

Here are a few practical tips most tutorials don’t mention:

  • Avoid touching the sensor while testing
  • Keep wires short for stable readings
  • Use quality jumper wires
  • Don’t place sensors near heat-producing devices
  • Wait a few seconds after powering the board

Most beginners rush testing and assume the sensor is faulty when readings fluctuate slightly.


Suggested Internal Links

  • Beginner Arduino Projects
  • How to Set Up Arduino IDE

Suggested External Resources


Image Suggestions

[Image: Serial Monitor showing live temperature values]
Alt text: Arduino temperature sensor serial monitor output

[Image: LM35 and DHT11 side-by-side comparison]
Alt text: LM35 vs DHT11 Arduino sensor comparison


Conclusion

Building an Arduino Temperature Sensor Project using LM35 or DHT11 is one of the easiest ways to learn electronics and sensor programming.

The LM35 is excellent for understanding analog temperature sensing, while the DHT11 adds humidity monitoring for more advanced projects. Once you get comfortable with these sensors, you can expand into IoT systems, smart automation, and wireless monitoring.

Start simple, test patiently, and don’t worry if your first readings aren’t perfect. Every Arduino beginner goes through the same learning process.

The best part? You’re building real-world skills while experimenting at home.


FAQs

Is LM35 better than DHT11?

LM35 usually provides more accurate temperature readings, while DHT11 can measure both temperature and humidity.


Why is my DHT11 showing “NaN” values?

This typically happens because of:

  • Incorrect wiring
  • Missing library
  • Loose connection
  • Fast reading intervals

Can I use these sensors with Arduino Nano?

Yes, both LM35 and DHT11 work perfectly with Arduino Nano.


Do I need resistors for LM35?

No, the LM35 generally works without extra resistors.

Leave a Reply

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