Temperature alarm for boiling milk

The problem with watching milk

Milk does not politely boil at a fixed moment you can watch for. It heats unevenly, a skin forms on the surface, and the foam starts climbing well before the liquid reaches its boiling point. By the time you see the foam at the rim, the pot is usually a second away from going over. A thermometer with an alarm is more reliable than a person standing next to the stove.

This build is a small, self-contained alarm: an ATtiny841 reads a DS18B20 probe, shows the temperature on a 16×2 LCD, and sounds a buzzer when the reading passes a set threshold. The case can be cut from plywood and the board made single-sided, because nothing here is fast or precise enough to need more.

Parts that matter

  • Sensor: DS18B20 in a stainless probe. It is a 1-Wire device that returns a signed temperature in 0.0625 °C steps at full resolution. A waterproof probe is essential; the cable and the seal are the parts that fail first in a kitchen.
  • Controller: ATtiny841. Two hardware USARTs and enough I/O for a 1-Wire pin, six LCD lines and a buzzer, which is why it fits this job better than an ATtiny85.
  • Display: HD44780-compatible 16×2 in 4-bit mode, six wires.
  • Alarm: a piezo buzzer driven through a small NPN transistor. Do not hang a buzzer directly on a port pin: a magnetic buzzer can pull more than the pin’s absolute maximum rating.

Reading the sensor

1-Wire is a strict timing protocol, not a simple analog read. Three consequences shape the firmware:

  • Resolution costs time. A conversion takes about 94 ms at 9-bit, 188 ms at 10-bit, 375 ms at 11-bit and 750 ms at 12-bit. Reading every half second means running at 10 or 11 bit, which gives 0.25 °C or 0.125 °C steps — plenty for an alarm that only has to notice a pot heading for the top.
  • Never block the alarm loop. Either start a conversion and come back for the result, or read the sensor from a timer tick and keep the comparison logic running in the main loop.
  • Parasitic power is a trap. If the probe is powered parasitically, the bus must be held high strongly during conversion, and a long cable will sag. Wire the Vdd line and use a 4.7 kΩ pull-up on the data line; it removes a whole class of intermittent failures.

Choosing the alarm threshold

Water boils at 100 °C at sea level, but milk foaming over is a different event. The foam rises as the milk approaches 85–95 °C and the surface tension changes, so an alarm set at 99 °C is already too late. Most people find a threshold around 85–90 °C gives enough warning to turn the heat down before the foam reaches the rim. That number depends on the pot, the volume and the fat content, so make it adjustable and treat the default as a starting point.

Two details stop the alarm from being annoying:

  • Hysteresis. Once the buzzer sounds, do not clear it until the temperature has dropped a few degrees below the threshold. Without hysteresis, a reading hovering at the set point produces a chirping alarm.
  • Rate-of-rise, optionally. A pot climbing more than about 1 °C per second is heading for trouble even below the threshold. If you want early warning, compare successive readings and alarm on the slope as well as the absolute value.
if (temp_c >= setpoint && !alarm) { alarm = 1; buzzer_on(); }
if (alarm && temp_c < setpoint - 3) { alarm = 0; buzzer_off(); }

Display, buttons and calibration

The LCD shows the current temperature to one decimal place and the set point on the second line. Two buttons adjust the set point; storing it in EEPROM means the alarm remembers it after the power is pulled.

An offset constant is worth having. An uncalibrated DS18B20 is typically within ±0.5 °C, and a probe clamped to the side of a pot reads the metal, not the milk. Compare it against a known thermometer in a stirred water bath and store the difference rather than editing the arithmetic in several places.

Probe placement and other realities

  • Keep the probe off the bottom of the pot. The base is the hottest surface and will read several degrees above the bulk liquid.
  • Stir before trusting a reading; milk stratifies.
  • Wash and dry the probe between uses. Milk residue on the stainless tip insulates it and slowly shifts the reading.
  • Route the cable away from the burner. Silicone insulation survives where PVC does not.

What this cannot do

An alarm is a warning, not a control loop. It will not stop the pot, and it cannot see the foam directly. If the milk heats very fast, the probe’s thermal lag — a few seconds in a probe this size — can eat most of your warning time. Do not leave the kitchen relying on it.

References

  • Maxim/Analog Devices, DS18B20 programmable resolution 1-Wire digital thermometer datasheet — conversion times per resolution, 1-Wire timing, supply and pull-up requirements.
  • Microchip, ATtiny441/ATtiny841 datasheet — port current limits, USART and timer registers.
  • Hitachi, HD44780U datasheet — 4-bit interface initialisation.

The component behaviour above comes from those documents. The threshold suggestions are practical starting values, not measurements of a specific pot.


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter
Scroll to Top