Building an Arduino based capacitive touch kitchen timer – Part 5

In this part of the Arduino capacitive touch timer series, I discuss the final working version of the project and what changes I had to make to the previous revisions. Towards the end of the article, I’ll have a look at what lessons I’ve learned while working on this project.

I closed part four of this series, which I published quite some time ago, with some ideas I had for improving the design that I had at that time. In that article, I mentioned that I wanted to add capacitors close to the power pins of the two ICs to prevent them from resetting. I also wanted to put all components on the underside of the PCB to get the displays closer to the top of the plastic case. Doing so would make it easier to read the displayed values. Let’s have a closer look at these changes!

Product demo and video announcement

But before I go into the details, have a look at the following teaser video:

The video above demonstrates how the finished product works. Note that the video quality is not good, as I only quickly filmed it when I was done assmebling the project. Furthermore, I used a bench power supply to power the circuitry, as I couldn’t find a 9V battery. I’ll release a full video series that discusses the project in more detail next week.

Changes in the PCB design

As mentioned in the beginning of the article, the biggest change to the PCB was that I moved all components, except for the seven-segment displays, to the underside of the board:

Figure 1: The new revision of the main logic PCB. Note how the displays are on the top side while all other parts reside on the bottom side

Other than that, I also added two capacitors and changed the positions of some of the resistors. In fig. 1, you can see that there’s enough place to use taller capacitors and lay them flat on the board (horizontally). I, however, ordered some low-profile capacitors and put them in vertically (see BOM for part specifications). Note that I also updated the connections between the MAX7219 IC and the two displays to make routing the traces easier. As a side-effect, I also had to update the firmware to use the new indices of the displays.

Aside from these changes, the circuit remained as discussed in part two of this series. In the last article, I also mentioned that I wanted to use SMD components. However, I ended up not doing that because that would have made it considerably more difficult to program and update the MCU when necessary.

Updated and more reliable firmware

I also mentioned that the firmware was not perfect. I made some slight changes to it so that the program ignores inputs on certain touch pads in various states of the program. Within the detectFinger() function, discussed in part three of this series, I changed the detection part to the following:

long total1 = (mode == 1 || mode == 2) ? cs_1.capacitiveSensor(32) : 0;
long total2 = (mode == 1 || mode == 2) ? cs_2.capacitiveSensor(32) : 0;
long total3 = (mode == 1 || mode == 2) ? cs_3.capacitiveSensor(32) : 0;
long total4 = (mode == 1 || mode == 2) ? cs_4.capacitiveSensor(32) : 0;
long total5 = cs_5.capacitiveSensor(32);

Remember that total one corresponds to the measured capacitance (in an arbitrary unit) of touch-ring pad number one, and total5 contains the capacitance of the center button. If the measured value exceeds a certain threshold (determined by testing what value works well), the rest of the function detects that a user’s finger was close to one of the touch pads. As you can see, the firmware now ignores the touch-ring pads whenever they are not needed. This is in all states except for mode one and mode two. This prevents false triggering of the device.

This might not seem like a huge change, but it significantly improved the reliability of the device in my tests. Apart from that, I also made an alternative version of the firmware that doesn’t detect the circular motion as an input. Instead, the user has to touch or hold a finger to the right side of the device to increase the counter. Touching the right side of the device decreases the current count. This makes setting the time a much faster process:

Bill of materials

For this project, I used the following components:

PartPcs.Price per Unit [USD]Price [USD]
Main logic PCB100.55Affiliated Link
Power Supply PCB100.55Affiliated Link
Touch Ring PCB515Affiliated Link
ATMega328PU12.402.40Link
MAX7219ENG18.998.99Link
16 MHz Crystal10.690.69Link
22pF Capacitor20.200.40Link
7-segment Display *21.132.26Link
36 MOhm Resistor **5???
10 kOhm Resistor10.10.1Link
47 kOhm Resistor10.10.1Link
10µF Electrolytic Capacitor *20.080.16Link
100µF Electrolytic Capacitor *20.070.14Link
Piezo Beeper10.480.48Link
7805 Voltage Regulator10.890.89Link
1N4004 Diode10.040.04Link
9V battery clip10.760.76Link

* I bought these at a local supplier. Please search for compatible parts.
** I don’t know where to buy this part. It came in a random assortment of resistors I got a few years ago. You can also use a similar value resistor, just make sure to use a large value and adjust the firmware (thresholds) if necessary!

Lessons learned

While working on this project, I learned the following lessons (in no particular order):

Capacitive sensing with an Arduino is easy to do. However, it’s very difficult to get it to work reliably and all the time. Oftentimes, inputs are either not detected at all or false inputs are detected. It helps to use the capacitive sensing library’s auto-calibration feature. Furthermore, ignoring touch-pads when they are not needed further increases the reliability of the device. Hardware-wise, you can use larger-valued resistors (30 mega Ohms or more) to increase the system’s robustness against wrong input detections.

I chose the threshold values and auto-calibration timing in the firmware according to my own testing. This might work for me, but it might not work for you, and the values heavily depend on the resistors you use and on various other factors such as the size of the touch pads and the thickness of the material that sits between the conductive pads and the user’s finger.

It’s a good idea to add capacitors close to the power pins of the ICs. Some devices might show very unexpected and non-deterministic behavior when they run into brown-out issues.

Always think about how your PCB connects to other PCBs in the design. Don’t just slap some connectors on the board where they fit. Wires also need space in the case, and having long wires reduces the reliability of this particular project.

Go over your design twice, maybe even three times before ordering it! I could’ve finished this project months ago if I had done that.

Possible future revisions

I’d like to end this series with some thoughts about possible future revisions. Currently, my biggest concern with this project are the long wires that connect the capacitive touch ring to the main logic PCB. In the future, I might design a new revision that only uses a single round PCB. One side could contain the capacitive pads, and the other one would have enough room for all other components. This also means that I’d have to use SMD technology.

I also thought about adding LEDs to the capacitive touch ring to make it clearer to the user which inputs are allowed in a certain state of the program or what the individual buttons do.

I think it would also make sense to get a better power supply built into the device, and also include a rechargeable battery. In addition to that thought, a friend of mine suggested to include some sort of wireless charging into the device. I think it’s also possible to create a base that contains spring-loaded contacts for charging the battery when the timer sits on top of the base (similar to an electric water cooker).

Closing remarks

Figure 2: The finished product

Lastly, I’d like to say that I hope you enjoyed this journey where I documented the project as I went along. Typically, I plan the projects and build them before writing down what I did. With this project, I tried to document everything as I went along, together with all the mistakes and problems that occurred along the way. I hope this gave you a chance to learn from my mistakes, and I also hope that it helps me prevent making the same mistakes again in the future. Thank you for reading, and a great independence day to my American readers!

Table of contents

Part 1: Project Idea and the theory behind capacitive sensing
Part 2: The circuit and a custom PCB
Part 3: The software
Part 4: The case design and an upcoming revision
Part 5: The finished product, lessons learned (You are here)

4 thoughts on “Building an Arduino based capacitive touch kitchen timer – Part 5

Leave your two cents, comment here!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.