Situatie
You’ll build a simple digital thermometer that measures ambient temperature using a temperature sensor (like the LM35, TMP36, or DHT11) and displays the reading via the Serial Monitor or LCD screen.
We’ll cover two main versions:
-
Basic Version — Using an analog temperature sensor (LM35 or TMP36).
-
Advanced Version — Using a digital sensor (DHT11 or DHT22) with humidity support.
Materials Needed
Component | Quantity | Description |
---|---|---|
Arduino Uno (or Nano/Mega) | 1 | The main microcontroller board |
LM35 or TMP36 sensor | 1 | Analog temperature sensor |
Breadboard | 1 | For easy circuit assembly |
Jumper wires | ~6 | Male-to-male wires |
USB cable | 1 | To connect Arduino to your computer |
(Optional) 16×2 LCD Display | 1 | For local display |
(Optional) 10kΩ Potentiometer | 1 | LCD contrast control |
Step 1: Understand the Sensor
LM35 Pinout
Pin | Label | Function |
---|---|---|
1 | VCC | +5V from Arduino |
2 | VOUT | Analog output (connect to Arduino analog input) |
3 | GND | Ground |
The LM35 outputs 10 mV per °C.
So if the output voltage = 250 mV → temperature = 25°C.
Step 2: Wiring the LM35 to Arduino
Connections
LM35 Pin | Connects To |
---|---|
VCC | 5V on Arduino |
GND | GND on Arduino |
VOUT | A0 on Arduino |
Circuit Diagram (Text Form)
Step 3: Arduino Code (LM35 Version)
Explanation
-
analogRead(A0): reads 0–1023 corresponding to 0–5V.
-
Voltage calculation:
(value * 5.0) / 1023.0
. -
LM35 output scaling: 10 mV = 1°C → multiply voltage by 100.
Step 4: Viewing Data
-
Open Arduino IDE → Tools → Serial Monitor.
-
Set baud rate = 9600.
-
You’ll see continuous readings like:
Step 5: Calibration (Optional)
Real sensors may have small offsets.
You can adjust the output manually:
Compare readings with a known thermometer and tweak the offset until accurate.
Advanced: Using DHT11 / DHT22 (Digital Sensor)
Required Library
-
Install “DHT sensor library” by Adafruit from Arduino Library Manager.
Wiring (DHT11)
DHT11 Pin | Connects To |
---|---|
VCC | 5V |
GND | GND |
DATA | Digital Pin 2 |
Code (DHT11)
Step 6: (Optional) Display on LCD
If using a 16×2 LCD (I2C):
-
Install “LiquidCrystal_I2C” library.
-
Connect SDA → A4, SCL → A5.
-
Example snippet:
Troubleshooting Guide
Issue | Possible Cause | Solution |
---|---|---|
No readings / 0°C | Wrong wiring or pin | Check sensor pins |
Negative readings | Wrong sensor type (TMP36 needs offset) | Adjust formula |
Unstable readings | Noisy analog signal | Add capacitor (0.1 µF) between VOUT & GND |
“nan” or “Failed to read” | DHT library issue | Check sensor type & connections |
Next Steps & Enhancements
-
Add OLED / LCD display for portable thermometer
-
Store data using SD card module
-
Upload readings to the cloud via ESP8266 / WiFi module
-
Use RGB LED to indicate temperature range (blue/cool, red/hot)
-
Build an IoT dashboard (ThingSpeak, Blynk, etc.).
Leave A Comment?