Lab / Microcontrollers and sensors

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.

Microcontrollers and sensorsVirtual readings4 viva questions

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 ready
1What is the LM35's scale factor?
2How can you improve resolution with an LM35?
3Why does the DS18B20 need a pull-up?
4Thermistor or LM35: which is linear?

Try the readings before the lab

Calculated, not measured. In the lab, write down your own readings.
Temperature (°C)LM35 out (mV)ADC countReading back (°C)
10100209.8
202004120
252505124.9
303006129.8
404008240.1
5050010249.9
6060012360.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 countReading 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.

Open my record book

Your lab record

Result formatSensor reading ___ °C, thermometer ___ °C (difference ___ °C).

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.

1. What is the LM35's scale factor?
2. How can you improve resolution with an LM35?
3. Why does the DS18B20 need a pull-up?
4. Thermistor or LM35: which is linear?

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.

Interfacing a temperature sensor (LM35 or DS18B20)