Interfacing a temperature sensor (LM35 or DS18B20)
To measure temperature with an LM35 on the ADC (or a DS18B20 on 1-Wire) and display it.
Theory
The LM35 outputs 10 mV per °C (250 mV at 25 °C). With the 5 V reference, each ADC step is 4.9 mV, about 0.5 °C, so T = count × 500 / 1023. The DS18B20 is digital: it sends the temperature over a single data wire with up to 0.0625 °C resolution and needs a 4.7 kΩ pull-up.
Apparatus
- Arduino Uno
- LM35 (or DS18B20 with 4.7 kΩ)
- 16×2 LCD with I2C (optional)
- Thermometer for comparison
Circuit connections
- LM35: +Vs to 5V, Vout to A0, GND to GND (flat face towards you: +Vs, Vout, GND)
Procedure
Pre-lab check
4 questions · 75% to be readyTry the readings before the lab
| Temperature (°C) | LM35 out (mV) | ADC count | Reading back (°C) |
|---|---|---|---|
| 10 | 100 | 20 | 9.8 |
| 20 | 200 | 41 | 20 |
| 25 | 250 | 51 | 24.9 |
| 30 | 300 | 61 | 29.8 |
| 40 | 400 | 82 | 40.1 |
| 50 | 500 | 102 | 49.9 |
| 60 | 600 | 123 | 60.1 |
Precautions
- Check the LM35's pin order before power-up; reversed, it gets hot.
- Average several readings to reduce noise.
My readings
Type what you measured. It goes into your record book, and to My Garage when you are signed in.
| S. No. | Temperature (°C) | LM35 out (mV) | ADC count | Reading back (°C) |
|---|---|---|---|---|
| 1 | ||||
| 2 | ||||
| 3 | ||||
| 4 | ||||
| 5 | ||||
| 6 |
Check my readings
Put the value you set in the first column, then compare. Real parts have tolerance.
Your lab record
Everything above is free. The print-ready write-up comes with Maker.
Printed pages leave the observation table empty for your own readings.
Viva practice
Say your answer out loud first, then check. The first 2 answers are free; Maker opens all 4.
Quick answers for your record and viva
What is the aim of the interfacing a temperature sensor (lm35 or ds18b20) experiment?
To measure temperature with an LM35 on the ADC (or a DS18B20 on 1-Wire) and display it.
What apparatus is needed for interfacing a temperature sensor (lm35 or ds18b20)?
Arduino Uno, LM35 (or DS18B20 with 4.7 kΩ), 16×2 LCD with I2C (optional), Thermometer for comparison.
What is the theory behind interfacing a temperature sensor (lm35 or ds18b20)?
The LM35 outputs 10 mV per °C (250 mV at 25 °C). With the 5 V reference, each ADC step is 4.9 mV, about 0.5 °C, so T = count × 500 / 1023. The DS18B20 is digital: it sends the temperature over a single data wire with up to 0.0625 °C resolution and needs a 4.7 kΩ pull-up.
What result should I get in interfacing a temperature sensor (lm35 or ds18b20)?
Sensor reading ___ °C, thermometer ___ °C (difference ___ °C).
What precautions should I take in interfacing a temperature sensor (lm35 or ds18b20)?
Check the LM35's pin order before power-up; reversed, it gets hot. Average several readings to reduce noise.
