Arduino Digital Thermometer Circuit with DS18B20 Sensor

 

Arduino Digital Thermometer Circuit with DS18B20 Sensor

Arduino Digital Thermometer Circuit with DS18B20 Sensor

The DS18B20 is the classic digital temperature sensor for Arduino projects: it sends an exact temperature reading over a single wire, needs no calibration by the builder, and even comes in a waterproof version for water tanks and soil. Paired with a 16x2 LCD, it makes a thermometer you can build in an afternoon.

How It Works

The DS18B20 measures temperature and sends it digitally to the Arduino using the OneWire protocol. The Arduino reads the value every couple of seconds and shows it on the LCD, and an optional buzzer can sound when the temperature crosses a threshold you choose.

Components Required

  • Arduino Uno or Nano board
  • DS18B20 temperature sensor (waterproof version optional)
  • 4.7k ohm resistor (pull-up, essential)
  • 16x2 LCD display
  • 10k potentiometer (LCD contrast)
  • Small buzzer, optional, for a high-temperature alert
  • 5V USB power supply, jumper wires, breadboard

Circuit Connections

  • DS18B20 red wire to 5V, black wire to GND, yellow data wire to Arduino digital pin 2
  • 4.7k resistor between the data wire and 5V (do not skip this, the sensor will not work without it)
  • LCD RS to pin 12, E to pin 11, D4 to pin 5, D5 to pin 4, D6 to pin 3, D7 to pin 8
  • LCD VSS to GND, VDD to 5V, VO to the middle pin of the 10k potentiometer, potentiometer outer pins to 5V and GND
  • Buzzer positive to pin 6 through a resistor, negative to GND, if you add the alert

Build Steps

  1. Wire the sensor, pull-up resistor and LCD exactly as listed.
  2. Install the OneWire and DallasTemperature libraries in the Arduino software.
  3. Upload a sketch that reads the sensor every two seconds and prints the temperature in Celsius on the LCD.
  4. Check the reading against a known thermometer and adjust a small offset in code if needed.
  5. Optional: add a buzzer alert that sounds when the temperature rises above your chosen limit.

Troubleshooting

  • Reading stuck at -127: check the data wire and the 4.7k pull-up resistor first, this is almost always the cause.
  • Reading stuck at 85: the sensor is not finishing its conversion, check power and wiring.
  • LCD blank: turn the 10k contrast potentiometer slowly until the text appears.
  • Garbled display: re-check the six LCD data pins against the list above.

Going Further

Log readings to a computer over serial, add a second DS18B20 on the same wire for inside and outside temperatures, or switch the display to Celsius and Fahrenheit at the press of a button.

What will you measure first — room, water tank, or greenhouse? Tell us in the comments.

0 comments:

Post a Comment