Close
0%
0%

grinder_timer

Making a dumb coffee grinder slightly less dumb.

Similar projects worth following
This is a programmable timer tethered to a Rancilio Rocky coffee grinder. The Rocky is a "dumb" grinder and electrically very simple. Basically it's an ac motor with an on/off switch and a momentary push-button to grind. This project adds an electronic timer so that repeatable grind quantities can be produced without having to stand over the grinder. Features:
- Four programmable presets (A, B, C or D) stored in EEPROM to survive powercycle.
- Left/Right buttons to select preset.
- Up/Down buttons to adjust grind duration for selected preset (0.25s increments up to 60s).
- Grind button to initiate grind and begin countdown timer.
- Oled display (128x64) to show preset menu and countdown timer.
- Aluminium enclosure.
- Single cable (3-core) tether to grinder for power and control.
Code, schematic and PCB layout are all on github.

Rev_2

In August 2020, with some time on my hands I finally got around to a second revision of this project.  Improvements include:

  • Hardware:
    • Pull-ups on I2C SDA and CLK lines.
    • Drive relay with a transistor instead of direct from IO.
    • Add flyback diode protection to relay coil.
    • Smaller transformer.
    • Smaller relay.
    • Switch to SMD where possible.
    • Two-sided PCB (have it fabricated instead of etching).
    • Switch buttons from mushy panel-mount to tactile SMD.
    • Balanced caps for the 32.768kHz crystal.
    • Put grind button LED on a PWM output.
  • Firmware:
    • Switch from C to C++.
    • New OLED driver (change from SPI SSD1306 to IIC SH1106 controller).
    • Pulse/fade effect for grind button LED.
    • Ability to cancel a grind once started.
    • Remember selected preset after a power-cycle.


Grinder Tether

A three-core cable is required to tether the grinder_timer to the coffee grinder.  The cores are required for power (active, neutral) and to actually switch on the grinder (motor).  The tether cable is connected at both ends via spade connectors.  Within the grinder, the spade connectors splice into existing spade connections with no modifications required.  The cable is run through the same grommet as the grinder's AC supply cable.  There is no permanent modification to the grinder required.


Power

The grinder_timer takes power from the coffee grinder.  Since the grinder is a simple AC circuit, the grinder_timer had to include power transformation/rectification/regulation to provide 5V for the other components.  The power sub-circuit uses basic components to provide 5V to the AVR and other components.

  • Transformer 240VAC/6VAC x2 @ 0.25A (secondary coils connected in parallel for 6VAC at 0.5A).
  • Bridge Rectifier.
  • Filter Capacitors - 470uF, 10uF, 2x 0.1uF.
  • Voltage regulator LM7805.
  • Relay 5A/250VAC.

Motor Control

The grinder motor is switched on/off by grinder_timer via a relay.  Closing the relay simply completes the neutral side of the grinder motor circuit.

AVR Circuit

The main circuit is centred around an ATmega328p AVR micro.  It is connected to pin headers for connecting the buttons and a USB/Serial adapter.  Another pin header is for I2C control of the OLED and includes pull-up resistors on the clock and data lines..  There's a six-pin ISP header for programming.  I wanted the countdown timer to be reasonably accurate so there is a 32.768kHz crystal connected so as to implement an RTC (real-time clock) with the AVR.

OLED Module

The display is a 128x64 pixel mon OLED driven by an SSD1306.  It is controlled by the AVR's I2C (TWI) peripheral.  The module is physically connected via a pin header on the main circuit board.

Prototype Circuit

I developed the prototype of the electronics on a bread-board simultaneously with the schematic CAD.

Code

Early development stages of the code was written exclusively with vim from the terminal (terminator).  However I had read about Atom and decided to try it out so at some point in development I switched over.

The code is all interrupt driven.  Pushing any button runs the pin-change interrupt that checks which button and performs the appropriate action.

The grind button enables the timer/counter 2 peripheral which is set up to use the external 32.768kHz crystal.  This is the timer that actually counts down the desired duration.  This could have been done with an internal oscillator, but I wanted to learn about using the AVR as an RTC for more accurate and consistent timing.

The AVR's internal eeprom is used so that the stored presets survive a powercycle.

One trick I missed with the OLED module is the requirement to toggle the reset line as part of a start-up sequence at boot (datasheet included on github repo).  I simply tied the reset line to the AVR's reset line.  I eventually found this was causing issues at power-up because the oled reset is supposed to be toggled a minimum...

Read more »

  • 1 × ATMega328p AVR Microcontroller
  • 1 × 1x8 Male Pin Header For OLED module
  • 1 × Bridge Rectifier
  • 1 × 470uF Electrolytic Capacitor One for power smoothing, one across OLED reset to delay oled reset on powerup
  • 1 × 10uF Electrolytic Capacitor Power smoothing

View all 26 components

  • rev2

    clewsy08/22/2020 at 06:29 0 comments

    Revised firmware and hardware details are all current in the gitlab repo.

  • Completed project update

    clewsy12/12/2017 at 09:25 0 comments

    • Code - A few minor tweaks and bug fixes.
    • Hardware - Everything mounted and enclosed.

    The grinder is now officially slightly less dumb.

  • Initial project upload.

    clewsy12/04/2017 at 04:38 0 comments

    Current project status:

    • Code seems to be 100% functional.
    • Hardware:
      • PCB populated and functional.
      • Awaiting some parts including panel-mount buttons and a larger (same resolution) OLED module.

View all 3 project logs

Enjoy this project?

Share

Discussions

tuxgeek wrote 12/06/2020 at 16:35 point

Hi Clewsy,  is there any chance I can by a pcb for this project from yours?

  Are you sure? yes | no

clewsy wrote 02/12/2021 at 22:49 point

Hello @tuxgeek I'm so sorry I missed this question.  It was a long time ago, but if you're still interested let me know.  I have spares since the fabrication order had a minimum quantity of 5.

  Are you sure? yes | no

clewsy wrote 12/15/2017 at 00:27 point

Awesome! Let me know how it goes.

  Are you sure? yes | no

Elliot Williams wrote 12/14/2017 at 17:03 point

That's hilarious.  I've literally been thinking about how I would do this for the last three months.  I will steal parts of your design.  :)

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates