Arduino Uno DS18B20: Industrial Submersible Thermometer
Professional Maxim DS18B20 digital temperature sensor features three-layer 3-element matched thermal system (laser-trimmed bandgap reference + proportional-to-absolute-temperature sensor + delta-sigma ADC) delivering -55 to +125°C range with ±0.5°C accuracy (-10 to +85°C) and 0.5°C resolution in stainless steel TO-92 package (6mm OD x 55mm L).
OneWire 3-wire interface (GND/VCC/DQ pin 2) supports 115200bps Manchester-encoded packets with unique 64-bit ROM ID, parasitic power option, and programmable 9-12 bit conversion times (93.75ms-750ms). 4.7kΩ pull-up enables 20+ sensor multi-drop bus over 50m+ cable.
Production Thermometric Components
- Arduino UNO R3 digital GPIO (pin 2)
- DS18B20 waterproof probe (3m cable, SS304 sheath)
- 4.7kΩ pull-up resistor (mandatory)
- Male-to-male jumper wires (3 pieces)
- OneWire + DallasTemperature libraries
- 12V cooling relay + 10kΩ setpoint pot
Industrial OneWire Thermometry Interface
RED (VCC): Arduino 5V (3.0-5.5V range)
BLACK (GND): Arduino GND
YELLOW (DQ): Arduino Digital Pin 2 + 4.7kΩ to 5V
/*
DS18B20 Waterproof Professional Thermostat
Libraries: OneWire + DallasTemperature (Miles Burton)
*/
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
const int compressorPin = 7;
const int heaterPin = 8;
const float SETPOINT = 20.0; // Process 20°C
const float HYSTERESIS = 0.5; // ±0.5°C band
void setup() {
Serial.begin(9600);
pinMode(compressorPin, OUTPUT);
pinMode(heaterPin, OUTPUT);
sensors.begin();
sensors.setResolution(12); // 0.0625°C
Serial.println("=== DS18B20 Process Thermostat Active ===");
Serial.println("T°C | Status | Action | Resolution");
Serial.println("---------------------------------------");
}
void loop() {
sensors.requestTemperatures();
float tempC = sensors.getTempCByIndex(0);
if(tempC == DEVICE_DISCONNECTED_C) {
Serial.println("ERROR: DS18B20 disconnected!");
return;
}
// Process control with hysteresis
Serial.print("Temp: ");
Serial.print(tempC, 2);
Serial.print("°C | ");
if(tempC > SETPOINT + HYSTERESIS) {
digitalWrite(compressorPin, HIGH);
digitalWrite(heaterPin, LOW);
Serial.println("COOLING");
} else if(tempC < SETPOINT - HYSTERESIS) {
digitalWrite(compressorPin, LOW);
digitalWrite(heaterPin, HIGH);
Serial.println("HEATING");
} else {
digitalWrite(compressorPin, LOW);
digitalWrite(heaterPin, LOW);
Serial.println("HOLD");
}
Serial.print("Res: ");
Serial.println(sensors.getResolution(0));
delay(1000);
}
OneWire Library Production Deployment
Library Manager → OneWire + DallasTemperature. 4.7kΩ pull-up mandatory. 12-bit resolution = 0.0625°C. Serial Monitor displays precise process control.
Advanced Multi-Probe & Bus Configuration
// Multi-drop OneWire bus (20+ sensors)
void printAddresses() {
uint8_t address[8];
while(oneWire.search(address)) {
Serial.print("ROM: ");
for(int i=0; i<8; i++) {
Serial.print(address[i], HEX);
Serial.print(" ");
}
Serial.println();
}
oneWire.reset_search();
}
void loop() {
sensors.requestTemperatures();
for(int i=0; i<sensors.getDeviceCount(); i++) {
float temp = sensors.getTempCByIndex(i);
Serial.print("Probe ");
Serial.print(i);
Serial.print(": ");
Serial.println(temp, 2);
}
}
DS18B20 Stainless Probe Specifications
- Range: -55 to +125°C
- Accuracy: ±0.5°C (-10 to +85°C)
- Resolution: 9-12 bits (0.5 to 0.0625°C)
- Conversion: 93.75ms (12-bit)
- Probe: SS304 6x55mm, 3m+ cable, IP68
Industrial Process Applications
Liquid immersion temperature (brew kettles, chillers)
HVAC refrigerant line monitoring
Soil temperature profiling
// Beer fermentation profile
const float PRIMARY = 18.0; // 18°C primary
const float SECONDARY = 20.0; // 20°C secondary
unsigned long fermentStart = 0;
void loop() {
float temp = sensors.getTempCByIndex(0);
unsigned long days = (millis() - fermentStart) / 86400000UL;
float setpoint = (days < 7) ? PRIMARY : SECONDARY;
if(temp > setpoint + 0.3) digitalWrite(7, HIGH); // Peltier cooling
else digitalWrite(7, LOW);
}
OneWire 3-Wire Protocol Timing
- Reset: 480μs LOW → 70μs wait
- Presence: 60-240μs LOW (slave response)
- Read slot: 1μs → sample → 15μs release
- Write 0: 60μs LOW → 10μs release
- Write 1: 1μs LOW → 60μs release
Multi-Drop Bus & Parasitic Power
// Temperature excursion alarm
void loop() {
sensors.requestTemperatures();
float temp = sensors.getTempCByIndex(0);
if(temp > 65.0 || temp < -20.0) {
tone(9, 2000, 500);
Serial.println("*** TEMPERATURE ALARM! ***");
}
Serial.printf("T: %6.2f°C | Status: %s\n",
temp, (temp > 65 || temp < -20) ? "ALARM" : "OK");
}
Production Deployment Specifications
- 4.7kΩ pull-up resistor (mandatory)
- 3-core shielded cable (>10m runs)
- 12-bit resolution (750ms conversion)
- 20+ sensors per bus (500m total)
- IP68 stainless probe (full immersion)
- -55 to +125°C full range
Calibration & Maintenance Protocol
Ice point 0.0°C verification, boiling 100.0°C calibration (pressure corrected). Monthly 2-point check. Cable strain relief mandatory. Avoid kinks in SS sheath. 0.1°C precision maintained 5+ years.