Introduction: Capacitive Touch Kitchen Timer
This instructable discusses my latest project: An Arduino-based capacitive kitchen timer that allows users to interact with the device via touch inputs. The finished device is driven by the ATMega328PU, which is the same microcontroller that also enables the Arduino UNO. For this project, you'll only need a handful of components, but the final result will surely be a unique gadget that spices up your everyday kitchen work!
I also included three videos that talk you through each major step of this build. The first one discusses the electronics, the second video talks about the firmware, and the third one introduces you to the custom 3D printed case and the assembly of the final product.
Please note: This instructable is a condensed version of this five-part series of articles on my website. I recommend that you take a look at the original series if you want to learn more about the project and its earlier revision!
For this project, you'll need:
Printed Circuit Boards
- 16MHz Crystal
- 22pF capacitor (2x)
- 7-segment display (2x)
- 36 MOhm resistor (5x)
- 10 kOhm resistor
- 47 kOhm resistor
- 10 uF Electrolytic Capacitor (2x)
- 100 uF Electrolytic Capacitor (2x)
- Piezo Beeper
- 7805 Voltage Regulator
- 1N4004 Diode
- 9V battery clip
Note that it's fairly difficult to find 36 mega(!) Ohm resistors. I got mine from a random assortment of resistors I bought at a local store. Anyway, you can use any resistor instead, but try using the largest value you can find. I recommend that you don't go below 1 mega Ohm. Otherwise, capacitive sensing will quickly become very unreliable and unpredictable!
In addition, you'll also need an Arduino UNO and a 3D printer (or access to these resources). We'll use the Arduino to flash the firmware on the MCU, and the 3D printer is required for manufacturing the plastic enclosure of the device.
Step 1: The PCBs and Electronic Components
This project utilizes three different PCBs. The first one is a simple power supply board, that enables the finished product to run on a single 9V battery. This PSU board contains a straight-forward 7805-based step-down circuit.
The second board is the main logic PCB (Please note the images. They contain additional explanations and details!). This is the most complicated component of the build. As mentioned earlier, the project is based on the ATMega328PU. Therefore, I added that MCU and all components that it requires. These components are a 10K pull-up resistor (across the MCU's reset line and the +5V supply rail), a section that generates the 16 MHz clock signal, and a smoothing capacitor close to the IC's power pins. In theory, you could omit the clock generation. The IC should then default to using its internal 8MHz clock. However, not all ICs have this internal clock, or the internal clock might be disabled by default. Either way, the other IC on the main logic board handles the two seven-segment displays. This IC is a MAX7219 LED matrix controller. The 47K resistor close to this IC sets the current that the controller will send to the displays. Note that if you use other displays, you might need to tweak this resistor value if the screens are too dim. Lastly, the main logic board contains five 36 MOhm resistors. These connect the capacitive touchpads to the MCU. As mentioned earlier, it can be difficult to find such high-value resistors in small quantities. Therefore, you can use other values that are easier to get. However, try to use as large values as possible, as doing so greatly increases the quality of the touch sensing.
The third PCB is the capacitive touch ring. This PCB only contains thick traces that act as touchpads that detect user input.
Step 2: The Firmware
Let me begin by saying that you can view and download the firmware for this project here. I also included an alternative version of the firmware that uses different input gestures (See the video for an example).
First, I'd like to discuss what users can do with the finished device. First, you turn the device on by tapping the center button. The displays come on, and they show you the minutes you set when starting the last timer. You can then swipe around the top surface of the device in a circular motion to increase and decrease the currently displayed value. A clockwise motion increases the timer, counter-clockwise decreases it. Once you set the minutes, you tap the center button again. The device now allows you to set the seconds in five-second steps. Once you press the center button again, the device starts counting down the time you set, and it beeps once the timer runs out (see the first video for a demonstration). You can abort an active timer by continuously touching the center button for a few seconds.
Now let's get to the explaining part! Let me start by saying that I used the Arduino IDE to write the firmware and that the program itself uses two Arduino libraries.
The firmware looks massive, but it's really not that complicated. Most of the work is done by the detectFinger() function that periodically polls the five touchpads on the touch ring and then interprets the user input. The function inspects the return values of these five polling calls. If one of the values exceed a certain threshold, then the program assumes that the user wants to make an input.
The function additionally contains four if/else blocks (one for each of the ring buttons). Note that this is a quick and dirty way of implementing it, but it should work for now, and I might update it later. Anyway, each if/else block checks which of the ring buttons is currently active. If it finds one, it checks whether one of the other ring buttons was active just before the current one got activated. If that’s the case, it inspects which other button was active before, and the program then determines the direction in which the user swiped his or her finger. For that, the firmware keeps a record of the last active touchpad.
For the center button, the firmware additionally checks whether the user holds his/her finger over the button for a couple of seconds. In addition to that, a short button press is only detected once the finger is removed from the pad. In contrast, the other buttons detect a button press as soon as they detect the presence of a finger.
Step 3: The Custom 3D-printed Enclosure
The assembly process of the case consists of quite a few steps, and I recommend that you watch the video or visit this website for more detailed instructions (You can also download the 3D-printable STL files there)! Furthermore, note that I created the video way before the project was done. Therefore, The PCB I show in the video looks a bit different.
Please also note the additional information provided with the images! The assembly begins with the top piece of the 3D-printed enclosure. The capacitive touch ring snaps in place in the topmost part (See images one and two). You then need to add the light blue spacer ring. This ensures that the wires, going from the capacitive touch ring to the main logic PCB, have some space within the enclosure (See image three). Then, another blue plastic part snaps into the two white pegs in the top piece (see image four). This blue part has a rectangular cutout for the displays. Next, you slide in the main logic PCB so that the displays poke through that rectangular cutout (See image five), and then you snap the white part with the venting holes into the two large blue pegs so that the parts safely hold the PCB in place (See images six and seven). Next, you add the white ring with the screw holes on it (image eight). You can then use regular self-tapping screws (or a little bit of extra-strong adhesive), to hold the case pieces together. Lastly, mount the battery and the PSU board in the bottom part of the case. Then, connect the PCBs (logic and PSU), and fold the bottom part over the rest of the enclosure. Then use self-tapping screws to close the case. Make sure not to glue the last part shut, as the users will otherwise not be able to replace the battery when needed.
Step 4: Closing Remarks
In summary, this was a fun project, and it turned out way better than I expected after finishing the first revision. As mentioned earlier, visit my website to learn about earlier revisions and mistakes I made! I also discuss a few lessons learned there and ideas for future revisions.
I hope you enjoyed this Instructable, the accompanying blog entries, and the videos! Let me know if you have any other ideas for future revisions, and don't hesitate to contact me if you have any questions! :)
Participated in the