Build your own kitchen timer with a dual alarm
Kitchen Helper
A simple kitchen helper with two timers assists budding chefs in coping with dishes that are unlikely to be ready at the same time.
Not all the recipes you cook likely need to be ready at the same time, especially if everyone in the household has their own idea of how long you need to boil eggs for breakfast. A simple dual timer solves the problem.
This project uses a Pi Zero and some cheap components sold by the usual mail order companies for a few euros, dollars, or pounds. In principle, it is possible to build the project from scratch on a breadboard without any soldering, which makes it perfect as a starter project for your own experiments.
On the Pi Zero you need to install Raspbian "Buster" up front; the Lite version will do the trick. The only additional package you need to install for the time being is wiringPi [1], which uses a numbering system different from the header pin and GPIO systems. If you want to work with a graphical user interface, you could switch to a Raspberry Pi 3 or 4, but these platforms are oversized for this use case.
Strictly speaking, even the Pi Zero is overkill because, in principle, any microcontroller could control an alarm clock. The advantage of the Raspberry Pi is that software implementation is faster and easier: I use Python in this project. Before you move on to the software for the project, you first need to wire the hardware.
Mini Displays
Segment displays based on the TM1637 driver are ideal for displaying times (Figure 1). Each digit can be displayed with seven segments, and suitable displays are easily found by searching for "7-segment display." The monochrome displays are inexpensively available in red, white, blue, yellow, and green. They are available with a colon in the middle (clock type) or with one decimal point per digit.
Many sellers (especially on eBay) do not always provide the correct data. Often you will find a description of the clock type combined with an image of the decimal point display. Other sellers show both types to protect themselves against complaints relating to wrong delivery. Make sure you take a close look.
The connector pins are another potential source of concern. Pre-soldered specimens, as shown in Figure 1, are useful for experiments on the breadboard, but for installation in a housing, pins soldered from the back would be more useful. Finding the perfect device is not that easy.
TM1637 displays require two lines (CLK and DIO, or clock and data) in addition to power and ground. It is a lean I2C protocol that works on any pin. The device can handle 5V of input voltage, but the 3.3V on the Raspberry Pi are perfectly OK.
In this project, the displays are deployed on GPIO6 and GPIO12 (CLK) and GPIO13 and GPIO16 (DIO) on the left side of the display. Figure 2 shows the complete assembly with wiring for orientation.
Sound the Alarm
A buzzer serves as an alarm signal. You want to use an active buzzer; for a passive version, you would have to generate the sound yourself as PWM signals. Buzzers are typically available with two or three pins. In the first case you just need to apply a voltage (set the GPIO to High); in the alternative case, you have a control pin in addition to voltage and ground. For the versions I used for this example, I had to set the control pin to Low to make the buzzer go off.
The alarm clock program expects the control pin on GPIO26. To check this functionality, enter:
$ gpio -g mode 26 out $ gpio -g write 26 0 $ gpio -g write 26 1
The first line switches GPIO26 as the output pin, and the second line activates the buzzer. The third line switches it off again. At startup time, GPIO26 is an input pin and you might hear a short sound. If this annoys you, a low pullup resistor will prevent this happening.
Toggle
To edit the alarm times, you need to be able to switch between the two displays. To do so, you can use a slider, which is a button with two states. Of its three connectors, the central is grounded, and depending on the position of the switch, either the left or the right connector is grounded.
In this project, only the left connector GPIO20 and ground are wired. Also, the GPIO20 internal pullup is switched on. While the switch is on the right, GPIO20 is High, but otherwise Low. To test the wiring, enter:
$ gpio -g mode 20 in $ gpio -g mode 20 up $ gpio -g read 20
Repeat the command in the third line for different switch positions; depending on the position, the read
command outputs a 0 or 1.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Fedora Asahi Remix 41 Available for Apple Silicon
If you have an Apple Silicon Mac and you're hoping to install Fedora, you're in luck because the latest release supports the M1 and M2 chips.
-
Systemd Fixes Bug While Facing New Challenger in GNU Shepherd
The systemd developers have fixed a really nasty bug amid the release of the new GNU Shepherd init system.
-
AlmaLinux 10.0 Beta Released
The AlmaLinux OS Foundation has announced the availability of AlmaLinux 10.0 Beta ("Purple Lion") for all supported devices with significant changes.
-
Gnome 47.2 Now Available
Gnome 47.2 is now available for general use but don't expect much in the way of newness, as this is all about improvements and bug fixes.
-
Latest Cinnamon Desktop Releases with a Bold New Look
Just in time for the holidays, the developer of the Cinnamon desktop has shipped a new release to help spice up your eggnog with new features and a new look.
-
Armbian 24.11 Released with Expanded Hardware Support
If you've been waiting for Armbian to support OrangePi 5 Max and Radxa ROCK 5B+, the wait is over.
-
SUSE Renames Several Products for Better Name Recognition
SUSE has been a very powerful player in the European market, but it knows it must branch out to gain serious traction. Will a name change do the trick?
-
ESET Discovers New Linux Malware
WolfsBane is an all-in-one malware that has hit the Linux operating system and includes a dropper, a launcher, and a backdoor.
-
New Linux Kernel Patch Allows Forcing a CPU Mitigation
Even when CPU mitigations can consume precious CPU cycles, it might not be a bad idea to allow users to enable them, even if your machine isn't vulnerable.
-
Red Hat Enterprise Linux 9.5 Released
Notify your friends, loved ones, and colleagues that the latest version of RHEL is available with plenty of enhancements.