Projects / Bare sensor probe build

Bare sensor probe build

Beginner1.3 hGuided buildReviewed

Build it step by step

0 of 8 done
  1. NANOHelloPCF8574

    Install the libraries

    OneWire, DallasTemperature and LiquidCrystal I2C.

  2. NANO

    Check the legs

    Flat side facing you: GND, data, 5V.

  3. NANO

    Wire the sensor

    GND, D2 and 5V with the 4.7 kohm pull-up.

  4. NANO

    Wire the display

    A4, A5 with power.

  5. NANO

    Upload the sketch

    A temperature appears.

  6. NANO

    Test by touch

    Hold the sensor and watch it rise.

  7. NANO

    Seal it

    Solder wires, add heat-shrink and a small tube.

  8. NANO

    Test in ice water

    The probe sealed in a bag should read close to 0 C.

In short

How do you build a bare sensor probe build?

Build your own temperature probe from the bare three-leg sensor, a pull-up and heat-shrink, and test it against a known value. You need Arduino Nano, DS18B20 IC (TO-92), Resistor 4.7 kΩ, 16x2 LCD with I2C backpack (PCF8574) and Breadboard 830 Tie Points. It takes 8 steps and about 75 minutes.

Level
Beginner
Time
About 75 min
Parts
5

Parts list

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

Wiring

FromToWhy
DS18B20 left leg (flat side facing you)Nano GNDCheck the datasheet pinout before powering
DS18B20 middle leg (DQ)Nano D2One-wire data
DS18B20 right legNano 5VPower
4.7 kohm resistorD2 to 5VPull-up on the data line
LCD VCCNano 5VI2C backpack
LCD GNDNano GNDCommon ground
LCD SDANano A4I2C data
LCD SCLNano A5I2C clock

Code

The DS18B20 is a digital temperature sensor that talks over a single data wire and gives readings in steps of about a sixteenth of a degree. In the small three-leg package it is cheap and easy to build into your own probe. Wiring it right matters: with the flat side facing you the legs are ground, data and power from left to right, and if it is connected the wrong way round it can get hot very quickly, so check the pinout, power up and touch it briefly to make sure it stays cool. The 4.7 kilohm pull-up keeps the data line high between messages. Once it works on the breadboard you can turn it into a probe by soldering three thin wires, covering each joint with heat-shrink and sealing the whole sensor in a small tube. Never put the bare sensor legs into water. Test the finished probe in a glass of ice water, which should read close to 0 degrees, and note any offset. The display also keeps the minimum and maximum, which is handy for checking a room overnight.

Runs on a virtual Arduino Nano 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 <Wire.h>
#include <LiquidCrystal_I2C.h>

OneWire bus(2);
DallasTemperature sensors(&bus);
LiquidCrystal_I2C lcd(0x27, 16, 2);   // try 0x3F if the screen stays blank

float minC = 1000, maxC = -1000;

void setup() {
  Serial.begin(9600);
  sensors.begin();
  lcd.init();
  lcd.backlight();
}

void loop() {
  sensors.requestTemperatures();
  float c = sensors.getTempCByIndex(0);

  lcd.clear();
  if (c == DEVICE_DISCONNECTED_C) {
    lcd.print("No sensor found");
    Serial.println("No sensor found");
  } else {
    if (c < minC) minC = c;
    if (c > maxC) maxC = c;
    lcd.setCursor(0, 0);
    lcd.print("Temp "); lcd.print(c, 1); lcd.print(" C");
    lcd.setCursor(0, 1);
    lcd.print(minC, 1); lcd.print(" / "); lcd.print(maxC, 1);
    Serial.println(c, 2);
  }
  delay(1000);
}

What the serial monitor should show

Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual Arduino Nano with its sensors at their default values. Your numbers will follow your real readings, but the format should match.

24.50

Test checklist

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

CheckExpected
Room temperatureAbout 18 to 28 C
Finger on the sensorReading rises
Ice water in a bagClose to 0 C, within about one degree
Data wire unpluggedNo sensor found
Pull-up removedNo sensor found

If it does not work

No sensor found

Check the pull-up and the D2 wire.

Reads 85 C

The sensor has not finished its first conversion, wait a second.

Reads -127 C

Data line broken, check wiring.

Sensor very hot

Wrong way round, unplug at once.

LCD blank

Try address 0x3F and adjust the contrast pot on the backpack.

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

Ask Lark AI

Common questions

What parts do I need for the bare sensor probe build?

Arduino Nano, DS18B20 IC (TO-92), Resistor 4.7 kΩ, 16x2 LCD with I2C backpack (PCF8574) and Breadboard 830 Tie Points.

How long does the bare sensor probe build take to build?

About 75 minutes for a beginner maker, in 8 steps.

How do I know the bare sensor probe build works?

Room temperature: About 18 to 28 C. Finger on the sensor: Reading rises. Ice water in a bag: Close to 0 C, within about one degree.

No sensor found: what should I check?

Check the pull-up and the D2 wire.

Reads 85 C: what should I check?

The sensor has not finished its first conversion, wait a second.

Reads -127 C: what should I check?

Data line broken, check wiring.

Sensor very hot: what should I check?

Wrong way round, unplug at once.