Skip to content
Buy 10+ on select items — save 10% auto-applied
Free US shipping on orders $35+
Order by 3pm ET — ships same-day from the US
Skip to main content

Arduino Nano DS18B20: Build a Sous-Vide Controller | ShillehTek

May 17, 2026 18 views

Arduino Nano DS18B20: Build a Sous-Vide Controller | ShillehTek
Project

Build an Arduino Nano DS18B20 sous-vide controller with a relay to hold a water bath near your setpoint for consistent results, using parts from ShillehTek.

1 hr Intermediate (mains AC handl6 parts

Project Overview

DIY Sous-Vide Cooker: Use an Arduino Nano with a DS18B20 waterproof temperature probe and a relay to control a rice cooker or hotplate and hold a water bath within about ±0.5 °C of your target temperature.

Sous-vide chefs cook food in a precisely temperature-controlled water bath, like steak at 54.4 °C for a perfect medium-rare or eggs at 63 °C for soft-set yolks. Commercial immersion circulators cost $150 to $400, but with a DS18B20 probe, a relay, an Arduino, and a cheap cooker, you can build similar temperature control at home.

  • Time: ~1 hour
  • Skill level: Intermediate (mains AC handling)
  • What you will build: A temperature-controlled water bath that holds around ±0.5 °C near your target setpoint.
Arduino Nano sous-vide controller connected to a rice cooker with a waterproof DS18B20 probe
The whole sous-vide rig: rice cooker + DS18B20 probe + Arduino + relay for stable temperature control.

Parts List

From ShillehTek

External

  • 4.7 kΩ resistor - 1-Wire pull-up between DS18B20 DATA and VCC
  • A cheap rice cooker, slow cooker, or hotplate - used as the heat source
  • Vacuum-seal bags + plastic-bag clips (or zip-lock bags + water-displacement method)
  • Optional but recommended: cardboard or rigid mount to suspend the probe in the bath

Safety: The relay switches mains AC. If you are not comfortable with mains wiring, use a smart plug or a pre-built mains relay enclosure (Sonoff S31, etc.) and trigger it from the Arduino over WiFi instead.

Step-by-Step Guide

Step 1 - Understand the sous-vide control idea

Goal: Understand why controlling water temperature matters and what the Arduino controller is doing.

What to do: Sous-vide works by cooking at the final doneness temperature instead of cooking hotter and trying to time the result. Food cannot exceed the bath temperature, so the final texture becomes predictable.

The challenge is holding water temperature close to your target for long periods. That is the job of the Arduino-based controller in this build.

Expected result: You know the basic control objective: keep the bath within about ±0.5 °C of your setpoint by switching the heater on and off.

Step 2 - Assemble the main hardware blocks

Goal: Identify the three functional blocks: sense, decide, and act.

What to do: Build the controller setup on a breadboard and plan your wiring layout.

Arduino Nano sous-vide controller hardware on a breadboard with relay module and LCD1602
Arduino + relay + LCD on a small breadboard.
  • Sense: DS18B20 waterproof probe submerged in the bath, reading temperature about once per second.
  • Decide: Arduino compares the reading against your target. If below, switch the heater ON. If at or above, switch it OFF.
  • Act: Relay turns the heater (rice cooker / hotplate) on and off through mains.

Expected result: You have a clear plan for where the probe, relay, and display connect to the Arduino.

Step 3 - Wire the DS18B20 temperature probe

Goal: Connect the DS18B20 so the Arduino can read water temperature reliably.

What to do: Wire the probe and add the required pull-up resistor for 1-Wire.

  • DS18B20 red to 5 V
  • DS18B20 black to GND
  • DS18B20 yellow (data) to D2
  • 4.7 kΩ resistor between D2 (data) and 5 V (pull-up for 1-Wire)

Expected result: The DS18B20 is powered and the data line is pulled up correctly for stable readings.

Step 4 - Wire the relay and LCD

Goal: Connect the output switch (relay) and the display to the Arduino.

What to do: Wire the relay control input and connect the LCD1602 (I2C if you have the backpack version). Then wire the relay contacts into the heater power path.

Arduino Nano sous-vide wiring diagram showing DS18B20 on D2, relay on D3, and LCD1602 on I2C pins A4 and A5
Probe on D2, relay on D3, LCD on I2C (A4/A5).
  • Relay IN to D3
  • Relay VCC to 5 V, GND to GND
  • Relay COM and NO terminals wired into one leg of the rice-cooker mains cord (cut the live wire, route it through the relay)
  • LCD1602 VCC/GND/SDA(A4)/SCL(A5) if you have the I2C backpack version; otherwise wire 4-bit parallel

Expected result: The Arduino can switch the heater via the relay, and you have the LCD wired for status output.

Step 5 - Upload the control sketch (bang-bang with hysteresis)

Goal: Read the DS18B20 temperature and switch the relay to hold temperature near a target.

What to do: Install and use the OneWire and DallasTemperature libraries, then upload this sketch. It turns the heater on below the low threshold and off above the high threshold.

Code:

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

const int PROBE = 2;
const int RELAY = 3;
const float TARGET = 54.4;     // target water temp (steak medium-rare)
const float HYSTERESIS = 0.3;  // +/- band

OneWire bus(PROBE);
DallasTemperature sensors(&bus);

void setup() {
  Serial.begin(9600);
  pinMode(RELAY, OUTPUT);
  sensors.begin();
  sensors.setResolution(12);   // 12-bit = 0.0625C resolution
}

void loop() {
  sensors.requestTemperatures();
  float t = sensors.getTempCByIndex(0);
  Serial.print("Water: "); Serial.print(t, 2); Serial.print(" C  ");

  if (t < TARGET - HYSTERESIS) {
    digitalWrite(RELAY, HIGH);   // heater ON
    Serial.println("HEATING");
  } else if (t > TARGET + HYSTERESIS) {
    digitalWrite(RELAY, LOW);    // heater OFF
    Serial.println("IDLE");
  }
  delay(1000);
}

This is a simple on/off controller. For tighter control (around ±0.1 °C), upgrade to a real PID loop using the PID_v1 library by Brett Beauregard.

Expected result: Serial Monitor prints the water temperature and shows when the heater is heating or idle.

Step 6 - Run the bath and verify temperature stability

Goal: Confirm the relay cycles the heater and the bath stabilizes near the setpoint.

What to do: Place the probe in the water bath, power the Arduino, and turn on the heater through the relay-controlled outlet path. Watch the serial output as the temperature approaches your target.

5V relay module switching a rice cooker heater on and off under Arduino control
The relay clicks periodically while maintaining temperature.
Arduino Serial Plotter showing DS18B20 water temperature ramping to 54.4 C and holding within about plus or minus 0.3 C
Ramp up to 54.4 °C, then holds within ±0.3 °C.
Sous-vide water bath holding temperature with a vacuum-sealed steak submerged and DS18B20 probe in the water
Steak in a vacuum bag, fully submerged while the bath holds 54.4 °C.

Expected result: The bath reaches your target and stays inside the hysteresis band as the relay turns the heater on and off.

Step 7 - Finish the cook and evaluate the outcome

Goal: Use the stable water bath to cook sous-vide and confirm the expected doneness.

What to do: Cook your food at the chosen temperature and time. When done, remove it from the bag and sear as desired.

Expected result: Consistent doneness from edge to edge, driven by the controlled bath temperature.

Step 8 - Optional upgrades to extend the project

Goal: Identify improvement ideas you can add later.

What to do: Consider these upgrades if you want more features or tighter control.

  • Add buttons + a rotary encoder to set target temperature without recompiling
  • Save target temp + time profiles for steak / fish / egg / chicken
  • Move to a proper PID loop (PID_v1 library) for tighter control
  • Add a stir motor for better water circulation
  • Bridge to Wi-Fi (ESP32) for phone-app temperature setpoints + cook alerts

Expected result: A clear list of next steps if you want to evolve the build beyond the basic controller.

Conclusion

In this build, you used an Arduino Nano, a DS18B20 waterproof probe, and a relay to control a rice cooker or hotplate and maintain a sous-vide water bath close to your target temperature. Once the probe is submerged and readings are stable, the cook becomes predictable because the food cannot exceed the bath temperature.

Want the exact parts used in this build? Grab them from ShillehTek.com. If you want help customizing this project or building something for your product, check out our IoT consulting services.