Anyone who has ever boiled milk on the stove knows, that it has a nasty habit of overflowing. That is why I created the temperature alarm for boiling milk to be used my mother. It continuously measures the temperature of the milk and sounds an alarm when the temperature is over the preset alarm value.
Temperature alarm uses an Atmel attiny841 microcontroller, DS18B20 high temperature waterproof temperature sensor from adafruit, 2x16 HD44780 LCD and a buzzer to do its job.
I’ve designed the pcb in KiCAD, etched the pcb at home and soldered it together. The circuit is fairly simple so it fits nicely on a single sided pcb. The attiny841 is programmed using my avr-usb-programmer.
The case is made from 4mm plywood and the buttons are small pieces of wooden rod glued to a square piece of plywood so they can not fall out.
How it works
DS18B20 is a very simple 1-wire interface temperature sensor, that returns its output nicely in degrees Celsius, so all we have to do is request a conversion, wait for the result, read the output and display it.
I found a nice library by Jacajack that does all the heavy lifting for me, and all I have to do is call the function.
I’m reading the temperature approximately every half a second, triggered by a timer. For the sensor to work this fast I have to set lower resolution, but as I’m only displaying temperature to one decimal place, it is good enough.
Hardware interface to the temperature probe is also simple, just supply 5V and GND and connect signal to a MCU pin with a 4k7Ohms pull up. There is a mistake in my schematics and board, and I had to hack the pull up, but luckily the 5V was right next to the signal so I was easily able to solder an 0805 resistor in.
I’m using the computer fan connector, because it was the only keyed connector I had at home.
Interface to display is standard HD44780. I’m using the 4-bit mode as it only requires 6 pins on the microcontroller. The hardware also requires a potentiometer for contrast setting and supply for lcd and led backlight.
I’m using a library I wrote for this type of lcds, and it can be found in my avr-cpp-lib repository.
The user interface is really simple, I have 3 buttons:
- up increases alarm temperature
- down decreases alarm temperature
- center turns the alarm off
Sometimes simplicity is simply the best.
Alarm uses a self oscillating buzzer, so all I have to do is turn it on and off every half a second to get nice beeping sound. And I can use the same timer as for the temperature updating.
While the alarm works quiet well and does what it is supposed to do, t here are a few things that I could definitely still improve, and I’m planning to go back and fix them when I find some time:
- Set alarm direction: Right now the software only supports alarms when measuring something that is heating, but my mother makes yogurt and she has to wait for the boiled milk to cool down to 50 degrees. The temperature alarm should therefore support sounding an alarm for cooling things as well.
- Better sensor value processing: Right now the raw value from the sensor is used, but the sensor has some mass, and responds to changes slowly. It should be possible to determine sensor’s response and improve the overall system response with some clever code.