Feature

Better Brew

Arduino-powered Coffee Grinder Timer

Flavio Spedalieri

Issue 70, May 2023

Using electronics and maker skills to turn a manual coffee grinder into an advanced grinder with timer functions.

For our coffee connoisseur readers, you know that an optimum coffee grind can improve the taste of your delicious coffee. Not only does the grind need to be a particular size, but the dose is also important.

Advanced coffee grinders have a built-in timer that helps ensure you get the right dose every time. If your grinder doesn't have a timer, then doses can be inconsistent and may lead to coffee extractions that lack balance, body and character.

Engineer and creator, Flavio Spedalieri, put his electronics knowledge to good use and modified converted his coffee grinder from manual (dose) to grind on demand. The timer features two programmable timers, an offset feature (to adjust time on the fly) and the ability to store two presets.

We caught up with Flavio to find out more.

Thank you for getting in touch with us about your project. Please introduce yourself to our readers and what first got you into electronics.

My Name is Flavio Spedalieri. My very first exposure into electronics would come in my very young years. Thinking back, I would have been 7 or 8 years of age. I recall vividly wanting to pull things apart to see how they work. Perhaps the turning point came when my father and I ventured into Dick Smith electronics where I got my first book in electronics, Dick Smith's Fun Way Into Electronics Book 1. I would have been going on 10 or 11 years old, around 1986-87.

Throughout my high school years, my interests in electronics and science took off. In 1990, I began to develop strong interest in Lasers, and eventually nightvision technology. I continue to carry my passion and interests in the fields, and in the most recent years, finally completed some long-desired projects including Tesla Coils, Nitrogen lasers and bring together my journey and projects on a website that I built from scratch at
https://www.nightlase.com.au.

Many of us in the office have cut our teeth on the DSE Fun Way books and projects. We love that you have added electronics to a manual coffee grinder. We run on caffeine at the DIYODE office. Can you give our readers a rundown on why optimum coffee doses are important to a quality coffee?

Coffee, the elixir of life as they say. I developed my interest in coffee and the industry around 2000. Some 23 years on, I would say that have learnt so much, but I continue my journey as I learn more in this evolving industry.

At home, I own a Rocket Giotto Evoluzione, which is a heat-exchange E61 group style machine. Most recently in May 2022, I also purchased a “9Barista” stove-top espresso maker. The 9Barista is a beautiful piece of engineering designed and engineered in the UK – I just had to have one. The coffee from this is phenomenal.

Coffee is a very subjective and personal thing, the same as wine, Gin or a fine Whiskey. The key to a memorable cup, is the coffee itself, its freshness, roast, and how its extracted. It would take many pages to delve into the world of coffee.

When we talk about coffee dose, we are actually referring to a “Brew Ratio”, that is the amount of dry coffee (in grams) used to deliver a said volume of extracted coffee (yield). The optimal dose of coffee will be determined by the method of how the coffee is brewed as well as the roast profile – so it gets quite detailed.

As my preferred coffee is an espresso or milk-based espresso (depending on my mood), at home on my Rocket, I will dose 22g into my portafilter, and on my 9Barista, I am dosing 18.5g. My target yield is a double ristretto (around 40-42mL coffee) in around 22 sec. – To achieve optimum control and quality in the cup, we need a high-quality grinder.

This obviously motivated you to turn your grinder from manual to auto?

A huge thank you goes out to Dean and Rose Kiner, Owners of Siboni's Coffee in Pymble NSW for their kind and generous donation of the Compak K6 Grinder, for Dean's invaluable input throughout the build and inspiration to have made this project possible.

The Grinder was originally the workhorse in the store, however over the years, Dean had upgraded the grinders, the K6 was simply stored and unused.

The original thoughts was to simply convert the grinder as a simple On-Demand grinder, that is a simple push button to grind coffee. I never would have envisaged the result of the project evolve so much to feature an advanced timer.

The project itself became two parallel projects in the end. One project focused on converting the grinder from a doser to doserless, and the second project focused on developing the timer module and finally integrating this into the grinder housing.

The timer module could be purposed for any such project or even something unrelated.

What electronics parts do you use and how does it all work?

The design brief for the timer; functional, simplicity and ease of use with a nice clear display.

The timer module is designed and programmed around the Arduino platform (ATmega328) and finally ported to the "ProMini" board in the final build.

A 128x64 pixel graphical OLED screen was implemented as the primary display. The default display I used is the Digole Digital Solutions DS12864OLED-2W OLED.

The board connects three momentary illuminated push buttons as well as an encoder with an integrated button.

The Module and SSR (Solid State Relay) are powered by a small MeanWell MODEL: RS-15-5 (5V 3A) power supply.

The timer module allows for the programmed time (runs the motor for the preset time), an “offset” for when you want to adjust the run-time plus or minus 0.1 sec for calibration (which can then also update the stored time by pressing the encoder button), and a manual button which simply pulses the motor so you can purge or manually grind coffee as needed.

Two programmable presets are available. The display shows the program preset (1 or 2), the programmed time as well as if any offset (< or >) is active.

What made you choose a solid state relay instead of a mechanical type?

It's possible to use a mechanical relay, however, you need to contend with a higher voltage for the coil, and also the down-side of mechanical contacts that could become “sticky” over time.

Controlling an SSR with a microcontroller avoids these deficiencies as well as a much faster response.

I specifically selected a high-quality KYOTTO AC Solid State Relay (KD40C25AX) which is rated at 480V AC, 25A. I believe in using quality components and engineering margin for current and voltage handling. Reliability is key.

Great. What prototyping was involved and what design challenges did you need to overcome?

I am not a programmer by any means, so this was my biggest challenge and a massive learning curve. Many months work included constant testing of the program, having ideas on functions and user interface, but lacking the full confidence how to implement in code, however, I did manage to pack a lot in – It certainly stretched my skills and brain.

The additional challenges during development; considerations to the limited physical space to be able to mount the electronics and what display to use, its physical location and the size of the display.

In the early stages of the project, a standard 16x2 character LCD was the original display. A Smaller 16x2 OLED was also tested, however as the project evolved, consideration had to be made that space was limited, and that the larger screens would be difficult to fit.

The goal shifted away from text based 16x2 line display with focus to develop the programming for a tiny 128x64 pixel graphical OLED (24mm diagonal) screen with white pixels. The bonus of being a graphical display, allowed for some nice graphic additions as well as a much nicer looking display.

Another advantage of OLED Displays is their excellent contrast and clear text.

Development of the code began in March 2020 and I completed the final timer module in June 2020.

To pay homage to my favourite coffee blend “Romeo” and to Dean and Rose, I implemented a graphical splashscreen graphic when the timer is first turned on.

Did you need to repurpose someone else's code?

In researching timers, several options available, including the use of DIN style timers, however, these can be complex to use and require substantial clearance to fit, which for this case would have needed to be built external to the grinder.

A more favourable option is the use of an Arduino based microcontroller, and available code found on several sites, however, this also proved quite challenging.

Several ‘flavours’ had been found from very basic (and not able to store preset time), through to more complex, multi-menu driven options with features that include the ability to add scales (to weigh the grind).

Although these had been tested, in the end, proved to become either far too complex to drive, or simply did not work at all.

One project that was found, was a basic two-preset timer originally developed by YouTube user “Jamesallmighty” for a MAZZER ROBUR, however, there was very limited details.

A 16 x 2 Backlit LCD was used as the display, 4 control buttons (+/-, P1, P2 & manual) and using the grinder multi-switch and rewired to activate the timer (or effectively 5 buttons required).

Loading of the code provided a “feel” of how the timer would work from an end-user / operator perspective, however, at the time, I really did not realise that the project would result in a complete re-engineering and re-writing of the code over the next several months.

Through development and re-engineering; the code, the introduction of features including driving the 16 x 2 LCD using I2C communications, addition of “MANUAL GRIND” display, implementation of an encoder to enable time setting, reconfiguration (and reduction) of buttons, adding visual features through LED fades and flashes, addition of an “Offset Mode” and ability to display the loaded firmware version and enable / disable the start screen. Eventually, support for multiple displays added to arrive at something that I was finally happy to see implemented in my grinder.

I have no doubt my code work could be better or made more efficient, however, I worked with what knowledge and understanding of the code I could – I have to say I even surprised myself having to learn how to code an encoder, how to program button presses and much more.

It looks like you're handy with using timber, too. Could those parts be made using a 3D printer instead?

I do love timber, and the timber infill came up a treat. Sure, 3D printing of any component would work very well for such a project, however, I don’t have one and I am also one for the work I do, to carry a quality feel, and something that I have handcrafted.

Can you go into more detail about the spout and anti-static screen that you used?

The spout is a spare part for the Rancilio Rocky Grinder. Dean had this on hand, so this was utilised for the project.

The Anti-static screen is a Mazzer spare part, it serves two purposes; removes static from the ground coffee to reduce “Clumping” as well as providing flow control of the coffee exiting the chute.

Some testing and modification to screen was needed to allow the correct flow of coffee out of the grinder (and prevent choking).

Is there anything we haven't discussed that our readers should know about your grinder project?

Yes, some very important notes; grinders run from mains 240V. This project involves modifying a mains powered appliance and using a solid-state relay device to switch 240V mains to the motor.

If you are not confident in working with mains powered devices, please leave that part up to a person who would be qualified and able to certify the work.

The grinders use induction motors and typically will have a capacitor (motor Start / Run), these capacitors will hold charge and capable of delivering a substantial shock if they are not correctly discharged.

As mentioned, my project effectively became two parallel projects; one to modify the grinder which is a massive task in itself, and then development of the timer module.

Testing of the timer module can be easily done without ever connecting it across mains.

The push for completing the project came when my sister asked me about wanting to replace their pod coffee machine. In 2018, I had built my Rocket Giotto Evoluzione (yes complete build from parts), which replaced my trusted original ECM Giotto which was then sitting in storage.

I gifted my old ECM coffee machine and paired this with my completed coffee grinder project to my sister and Brother-in-law for their home in the Hunter Valley.

If our readers are inspired and want to make something similar, where can they see more details?

They are welcome to visit my website, the specific page on the grinder is: https://www.nightlase.com.au/?pg=coffee

Readers are also welcome to contact me via my contact page: https://www.nightlase.com.au/?pg=contact

Wonderful. Thank you so much for going into detail about your clever project. Here’s to many delicious coffees in your future.

To achieve optimum control and quality in the cup, we need a high-quality grinder.

Front side of board with OLED and Rotary Encoder
Rear side of board with Arduino compatible ProMini

The key to a memorable cup, is the coffee itself, its freshness, roast, and how its extracted.

Dean and Rose Kiner with their roaster at Pymble
Painted
K6 Outlet
Fork alignment
Fascia cutout
Completed build

WARNING: In Australia, a person cannot legally work on voltages above 50Vac without a license. DIYODE Magazine has no intention of recommending that you break any law, and will not be held liable if you choose to do so. Any mistake made by any person working on lethal voltage equipment can lead to their own death, or that of another person.