Projects / Min-max thermometer with LCD

Min-max thermometer with LCD

Beginner45 minGuided buildReviewed

Build it step by step

0 of 5 done
  1. UNODS18B2028.0°C

    Wire the probe

    Red to 5V, black to GND, yellow to D2. Add the 4.7 kΩ between D2 and 5V.

  2. UNOHelloPCF8574

    Wire the LCD

    VCC, GND, SDA to A4, SCL to A5.

  3. UNO

    Add the button

    From D3 to GND.

  4. UNOHelloPCF8574

    Upload

    Upload. If the LCD lights but shows blocks or nothing, turn the contrast trimmer on the backpack.

  5. UNODS18B2028.1°C

    Test

    Hold the probe in your hand, then in cold water, and watch L and H update. Press the button to reset them.

In short

How do you build a min-max thermometer with LCD?

A DS18B20 probe shows the current temperature on a 16x2 LCD, along with the lowest and highest since reset. You need Arduino Uno R3, DS18B20 waterproof probe, Resistor 4.7 kΩ, 16x2 LCD with I2C backpack (PCF8574), Tactile push button 6 mm, Breadboard 400 points (half size) and Jumper wires male to female (40 pcs). It takes 5 steps and about 45 minutes.

Level
Beginner
Time
About 45 min
Parts
7

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
DS18B20 red / blackUno 5V / GNDProbe power
DS18B20 yellowUno D2, with 4.7 kΩ to 5V1-Wire data with pull-up
LCD VCC / GNDUno 5V / GNDDisplay power
LCD SDA / SCLUno A4 / A5I2C
ButtonUno D3 and GNDReset min and max

Code

Arduino IDE, board "Arduino Uno". Install OneWire, DallasTemperature (Miles Burton) and LiquidCrystal I2C (Frank de Brabander) from the Library Manager.

Runs on a virtual Arduino Uno in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal_I2C.h>

OneWire bus(2);
DallasTemperature probe(&bus);
LiquidCrystal_I2C lcd(0x27, 16, 2);    // try 0x3F if the screen stays blank
float lo = 1000, hi = -1000;

void setup() {
  pinMode(3, INPUT_PULLUP);
  probe.begin();
  lcd.init(); lcd.backlight();
}

void loop() {
  probe.requestTemperatures();
  float t = probe.getTempCByIndex(0);
  if (t == DEVICE_DISCONNECTED_C) { lcd.clear(); lcd.print("Probe missing"); delay(1000); return; }
  if (digitalRead(3) == LOW) { lo = t; hi = t; }
  lo = min(lo, t); hi = max(hi, t);
  lcd.setCursor(0, 0); lcd.print("Now "); lcd.print(t, 1); lcd.print((char)223); lcd.print("C   ");
  lcd.setCursor(0, 1); lcd.print("L "); lcd.print(lo, 1); lcd.print(" H "); lcd.print(hi, 1); lcd.print("  ");
  delay(1000);
}

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Room air20 to 35 °C depending on the room
Probe in your closed handRises towards 32 to 35 °C within a minute
Probe in ice waterFalls to 0 to 1 °C
Button pressedL and H both jump to the current reading

If it does not work

Shows "Probe missing" or −127

The 4.7 kΩ pull-up is missing, or yellow is not on D2.

LCD backlight on but no text

Turn the contrast trimmer on the backpack, or try address 0x3F.

Reading stuck at 85.0

That is the DS18B20 power-on value. Check the probe's power wires.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the min-max thermometer with LCD?

Arduino Uno R3, DS18B20 waterproof probe, Resistor 4.7 kΩ, 16x2 LCD with I2C backpack (PCF8574), Tactile push button 6 mm, Breadboard 400 points (half size) and Jumper wires male to female (40 pcs).

How long does the min-max thermometer with LCD take to build?

About 45 minutes for a beginner maker, in 5 steps.

How do I know the min-max thermometer with LCD works?

Room air: 20 to 35 °C depending on the room. Probe in your closed hand: Rises towards 32 to 35 °C within a minute. Probe in ice water: Falls to 0 to 1 °C.

Shows "Probe missing" or −127: what should I check?

The 4.7 kΩ pull-up is missing, or yellow is not on D2.

LCD backlight on but no text: what should I check?

Turn the contrast trimmer on the backpack, or try address 0x3F.

Reading stuck at 85.0: what should I check?

That is the DS18B20 power-on value. Check the probe's power wires.