Ice and boiling point calibration
Build it step by step
0 of 7 doneWire both probes
DS18B20 with a pull-up, NTC with the divider.
Read at room temperature
Compare with each other.
Make an ice slurry
Crushed ice with a little water, stirred.
Take the ice reading
Type i.
Take the boiling reading
Type b in a rolling boil.
Apply the correction
Type r and read corrected values.
Check in warm water
Compare with a reference thermometer.
How do you build an ice and boiling point calibration?
Check temperature sensors at 0 °C in ice water and at boiling, and work out a correction. You need Arduino Nano, DS18B20 waterproof probe, NTC 10 kΩ waterproof probe, Resistor 4.7 kΩ and Resistor 10 kΩ. It takes 7 steps and about 60 minutes.
- Level
- Beginner
- Time
- About 60 min
- Parts
- 5
Parts list
- Development BoardsBuyArduino Nano × 1
- SensorsBuy
- SensorsBuy
- PassivesBuyResistor 4.7 kΩ × 1
- PassivesBuyResistor 10 kΩ × 1
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| DS18B20 red and black | Nano 5V and GND | Power |
| DS18B20 yellow (data) | Nano D2, with 4.7 kΩ to 5V | One-wire data |
| NTC probe one lead | Nano 5V | Top of the divider |
| NTC probe other lead | Nano A0 and a 10 kΩ resistor to GND | Divider output |
| USB | Nano | Power and serial monitor |
Code
Two fixed points give a straight-line correction. Crushed ice and water, stirred, sits at 0 °C; boiling water sits at about 100 °C at sea level and a little lower higher up, by roughly 1 °C for every 300 m, which the code uses as the altitude correction. Type i with the probes in the ice slurry (mostly ice, just enough water to touch the probe) and b in a rolling boil, then r to see corrected values. The probes must not touch the bottom or sides of the container, which are hotter or colder than the water. Boiling water causes burns: use a steady pot on a stable surface, keep leads away from the burner, let it cool before handling, and keep the Arduino well away from steam. Check that your NTC probe is rated for 100 °C before dipping it in boiling water, as some cheap ones are rated lower. Use distilled water for the best results. Arduino IDE, board "Arduino Nano" (try the Old Bootloader option if the upload fails).
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).
// Two-point calibration at the ice point and the boiling point. Libraries: OneWire, DallasTemperature. Board: Arduino Nano.
// Serial monitor at 115200 baud. Type i in the ice slurry, then b in boiling water. Then r shows corrected readings.
#include <OneWire.h>
#include <DallasTemperature.h>
OneWire ow(2); DallasTemperature ds(&ow);
const float ALTITUDE_M = 920.0; // your height above sea level, for the boiling point
const float BETA = 3950.0, R0 = 10000.0, RFIX = 10000.0;
float iceDS = 0, boilDS = 100, iceNTC = 0, boilNTC = 100;
float refBoil;
float ntcC() { // average 50 readings
long s = 0; for (int i = 0; i < 50; i++) { s += analogRead(A0); delay(4); }
float adc = s / 50.0;
float r = RFIX * adc / (1023.0 - adc); // NTC on top of the divider
float t = 1.0 / (log(r / R0) / BETA + 1.0 / 298.15) - 273.15;
return t;
}
float dsC() { ds.requestTemperatures(); return ds.getTempCByIndex(0); }
float avg(float (*f)(), int n) { float s = 0; for (int i = 0; i < n; i++) { s += f(); delay(200); } return s / n; }
void setup() {
Serial.begin(115200); ds.begin();
refBoil = 100.0 - ALTITUDE_M / 300.0; // water boils about 1 C lower for every 300 m of height
Serial.print("Reference boiling point here: "); Serial.println(refBoil, 2);
Serial.println("Commands: i = ice reading, b = boiling reading, r = corrected readings");
}
void loop() {
if (Serial.available()) {
char c = Serial.read();
if (c == 'i') { iceDS = avg(dsC, 20); iceNTC = avg(ntcC, 20); Serial.print("Ice DS18B20 "); Serial.print(iceDS, 2); Serial.print(" NTC "); Serial.println(iceNTC, 2); }
if (c == 'b') { boilDS = avg(dsC, 20); boilNTC = avg(ntcC, 20); Serial.print("Boil DS18B20 "); Serial.print(boilDS, 2); Serial.print(" NTC "); Serial.println(boilNTC, 2); }
if (c == 'r') {
float gainDS = (refBoil - 0.0) / (boilDS - iceDS), gainNTC = (refBoil - 0.0) / (boilNTC - iceNTC);
for (int k = 0; k < 10; k++) {
float d = dsC(), n = ntcC();
Serial.print("DS18B20 "); Serial.print((d - iceDS) * gainDS, 2); Serial.print(" NTC "); Serial.println((n - iceNTC) * gainNTC, 2);
delay(500);
}
}
}
}Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Ice slurry | Corrected values within 0.2 °C of zero |
| Boiling water | Within 0.5 °C of the local boiling point |
| Warm water | Both probes agree within 0.5 °C |
| Room air | Both stay close to each other |
If it does not work
DS18B20 reads -127
Check the 4.7 kΩ pull-up and the wiring.
NTC reads odd values
Check which side the 10 kΩ resistor is on in the divider.
Ice reading not zero
Stir the slurry and keep the probe off the walls.
Boiling reading far off
Check the altitude constant and that the water is truly boiling.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the ice and boiling point calibration?
Arduino Nano, DS18B20 waterproof probe, NTC 10 kΩ waterproof probe, Resistor 4.7 kΩ and Resistor 10 kΩ.
How long does the ice and boiling point calibration take to build?
About 60 minutes for a beginner maker, in 7 steps.
How do I know the ice and boiling point calibration works?
Ice slurry: Corrected values within 0.2 °C of zero. Boiling water: Within 0.5 °C of the local boiling point. Warm water: Both probes agree within 0.5 °C.
DS18B20 reads -127: what should I check?
Check the 4.7 kΩ pull-up and the wiring.
NTC reads odd values: what should I check?
Check which side the 10 kΩ resistor is on in the divider.
Ice reading not zero: what should I check?
Stir the slurry and keep the probe off the walls.
Boiling reading far off: what should I check?
Check the altitude constant and that the water is truly boiling.
