Your personal home barista comes to life with this voice-enabled coffee machine.

An open-source, private-by-design coffee machine that keeps your favorite coffee and caffeination schedule private.

A DIY voice-activated coffee machine

Your voice is a powerful thing. Voice is the most natural interface between humans and machines. The practicalities of voice means it will find a home in almost any industry or organization, chiefly because of its unique advantages over other interfaces — it’s intuitive, hands and eyes-free, and accessible. Your voice is also a biometric indicator, as unique as a retina scan or fingerprint, or even your DNA. Your voice, and the things you say, should be kept private.

When the devices around you no longer require a lengthy operation manual, but rather, require only a voice command, this unlocks an environment where technology disappears into the background, so that you can regain the freedom to spend quality time with the people you care about. That is in fact our mission at Snips, to make technology disappear.

Case-in-point: this voice-activated coffee machine. You can ask it to make you a double espresso or a flat white, to pour you some hot water or even to turn itself off.

It’s purely a demo project, but at our Snips office in Paris, we’ve grown used to the convenience, and so we wanted to make it as easy as possible for anyone interested to replicate it at home.

WARNING — This tutorial outlines the procedure we used to modify our coffee machine to be controlled via home automation. It deals with modifying a main electricity device which can be dangerous if performed incorrectly. Information here may be incomplete, inaccurate and unsafe. Proceed with caution. No liability accepted.

Step 1: Bill of Materials

Here’s what hardware you need to have a voice-activated coffee machine ready to work in your home. We’ve put links to find things at good prices. If the links are not valid anymore please send us an email and we’ll help find replacements.

Important parts:

  1. Delonghi Ecam 22.140B (or similar) — link / ~ $347
  2. Raspberry Pi Model 3B + — link / ~ $39
  3. Raspberry power supply — link / ~ $8
  4. 4GB sd card class 10 — link / ~ $8.30
  5. ReSpeaker 2 Pi Hat — link / ~ $9.90
  6. USB>mini cable — link / ~ $4.99
  7. Arduino nano — link / ~ $22.20
  8. 8-channel relay board — link / ~ $8.98
  9. Stepper motor + control board — link / ~ $5.74
  10. Coupler 8x8 — link / ~ $10
  11. Some 18 AWG wires (ideally red & black) — link / ~ $14.99
  12. 2x M3x15 screws — link / ~$10
  13. 2x M3x45 screws — link / ~$4.99

Miscellaneous parts:

  • a HotGlue Pistol
  • a drill and some small-sized bits
  • a dremel
  • some heat-shrinkable shealth
  • a soldering iron
  • a Philips screwdriver
  • a Torx TS 20 screwdriver

3D printed parts :

  • 3D printed case for the stepper and 3D printed part for the coupler pin — link (If you don’t have a 3D printer, that’s ok! You can use 3D Hubs services)

Step 2: Disassembling

Unscrew the 5 screws at the back of the coffee machine.

Then remove the right and left side of the coffee machine by sliding it backward.

On the back, remove the two screws that hold the top case (do not try to remove it just yet).

On the right side, you will see a screw that holds the top case. Unscrew it, and repeat that step for the left side.

On the front of the coffee machine, pull the steam “main switch” toward you to remove it.

You can now slowly remove the top case and detach the heating plate wires to remove it entirely. You could also just leave the cover on top of the machine, as we will not need to access the machine from the top.

Now let’s focus on the front panel. Unscrews 2 screws on the left and right front panel.

Remove the 4 screws on the back side of the panel. Beware of the two small grey plastic pins on the left and right side. You need to gently push them to be able to remove the front cover.

Gently remove the top right connector from the PCB.

Step 3: Front Panel Soldering

Proceed with caution at this step.

With a dremel, drill 5 small holes where you see red circles. Proceed with caution as we don’t want to cut a copper trace. The drill should be big enough to let two 18 AWG wires go through.

Solder your wires as indicated on the picture. Some switch pins are common, but for the sake of clarity we preferred having a separate set of wires per switch. It is important that you mark each pair of wires so that you know to which switch it belongs.

Step 4: Front Panel Reassembly

Make sure the wires does not prevent the switch cover panel from being correctly in place.

Drill some holes on the back cover, it will be easier for all the wires to go through.

With a dremel or a manual file, remove a half circle on the front cover as well as on the white plastic part above it to let the Stepper wires go through.

Place the 3D printed part on the front cover and mark with a pen the two spots where you need to drill. As a reference we indicated it on the pictures with the two red circles (2.8mm holes).

Screw the PCB back in place as well as all the different elements of the front panel.

You will need to extend the Stepper wires length by approximately 8 inches. Make sure to use similar wire colors for some point of reference.

Caution: Gently insert the 3D printed plastic pin in the potentiometer.

Screw the stepper on the 3D part with M3x15 screws. 
Add the coupler at the tip of the stepper (do not clamp it just yet). Screw the 3D part to the front panel using M3X45 screws. The coupler must be correctly aligned with the 3D pin.

… and all wires should now be on the right side of the coffee machine.

You can then screw the whole front part back to the coffee machine. Don’t clamp the coupler just yet though!

Step 5: Electronics

First and foremost, let us explain how this works in general terms:

As a user, you would start the process by triggering the wake word (“Hey Snips”), you would then pronounce a sentence like “I would love two short strong coffees please”).

Snips (on the Raspberry Pi) would receive your intent.

Then, through a Python code, a figure that correspond to the coffee you selected is sent to the Arduino.

This figure is then received by the Arduino, which corresponds to a specific order for coffee type and intensity. In this specific example, the important data within that figure would be : “two”, “short”, “strong”).

The Arduino would then send a command to the stepper to adjust the coffee intensity, and then activate the correct relay based on the user intent.

Schematics: connecting all the wires/jumper

Hint: we strongly suggest you to glue the jumper/wires onto the Arduino/relay pin so that wires don’t disconnect while manipulating it.

As you can see, the stepper motor is connected to its drive board, which is itself connected to the Arduino. The Arduino is connected to the 8-relay board and each relay is connected to the coffee machine front-panel PCB — couldn’t find a green PCB :) —

Schematic for the Snips voice-activated coffee machine.

Once all the wires are connected, place the relay board and Arduino nano on the right side of the coffee machine.

Make sure that the Arduino and board aren’t touching any metallic parts. The best would be to isolate them with some electrical tape.

Step 6: Software

A: Arduino

Here is the repository link and code:

Arduino code for Snips voice-activated coffee-machine

B: The Raspberry Snips setup

Make sure you have your Raspberry Pi 3 with a Raspbian Stretch Lite installed. You can find instructions to install it here.

Then, setting up the Snips Voice Platform on your Raspberry Pi 3 is a two-step process:

Step 1: Configure network access

The Raspberry Pi needs internet access to pull from the Snips Platform.

Ethernet

Plug-and-play.

WiFi

Insert the SD card in your computer and add the following file wpa_supplicant.conf at the root of the boot volume of the SD card (do not forget to update the ssid and psk keys):

country=FR
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="Your WiFi network name"
psk="Your WiFi network password"
}

If you’re looking for more details about this step, please refer to the official Raspberry documentation

Step 2: Enable SSH

Enable SSH by adding an empty file ssh at the root of the boot volume on your SD card. Insert the SD card into the Raspberry. It will boot in about 20 seconds. If you run into issues check this link.

You can now access your Raspberry from your computer using ssh pi@raspberrypi.local

If you have several Raspberry Pi’s on the same network, we recommend that you change their hostname or connect to them using their IP.

Step 3: Install SAM

In this step, you will install Sam. Sam is a CLI (Command Line Interface) that you will be using to create, manage, and deploy your assistants, to configure your hardware, to view the logs of your assistants on the Raspberry, as well as to run your application locally for quick prototyping.

This part of the tutorial is running from your computer, in the terminal. You’ll need to have Node and NPM installed. You can get them from the Node.js website. You need at least Node v7.5.0, so check your node version with node -v. Your Raspberry Pi must be connected to your network.

Windows users need to additionnaly install Git. You can get it from Git’s website.

From a command shell on your local machine, run the following command:

sudo npm install -g snips-sam

You’ll be asked to input your computer password first.

You are now able to run the sam command from your command shell.

Detecting your Raspberry Pi device on the network

Let’s try to find nearby Raspberry Pi devices on your network, using the command sam devices:

sam devices
Scanning Raspberry Pi devices on the network...
Found 1 device:
- raspberrypi (192.168.9.2)

If Sam does not find any device, make sure the Raspberry Pi and your computer are on the same network. If you have any problems, check out our Network Setup Guide.

Connecting to your device

Connect to your device (you may use your device IP or hostname, and in the latter case, make sure to append .local to the hostname):

sam connect raspberrypi.local
? Enter username for the device: pi
? Enter password for the device: [hidden]
Connected to raspberrypi.local

You are now connected to your Snips device!

This is not mandantory but if you’re curious, you can check at any time the device status with sam status:

sam status
Connected to device raspberrypi.local
OS version ................... Raspbian GNU/Linux 9 (stretch)
Status ....................... Snips Platform not installed
You may install the Snips Platform using sam init
To install specific components, check the help using sam init --help

Step 4: Installing Snips

Now that Sam is set up and connected to your Raspberry Pi, we can install the Snips Platform on it.

The Snips Platform is what runs your assistant. Listening to your voice from a microphone, it transcribes what you say into text, extracts the meaning of it, and performs an action accordingly. You can read more about this in the Snips Platform Documentation.

Start the installer using sam init:

sam init
Installing Snips Platform components. This may take a few minutes...
Successfully installed Snips Platform components

This will take a few minutes, after which the device will reboot. Once ready, you can check again the status of your device. You should see the Status field updated accordingly, as well as a list of newly installed components:

Please note that some services’ status may be different from the example below. Most of them will become active later in the installation process, as soon as an assistant is installed.

sam status
Connected to device raspberrypi.local
OS version ................... Raspbian GNU/Linux 9 (stretch)
Installed assistant .......... Not installed
Status ....................... Installed, not running
Service status:
snips-analytics .............. 0.55.2 (not running)
snips-asr .................... 0.55.2 (not running)
snips-audio-server ........... 0.55.2 (running)
snips-dialogue ............... 0.55.2 (not running)
snips-hotword ................ 0.55.2 (not running)
snips-nlu .................... 0.55.2 (not running)
snips-skill-server ........... 0.55.2 (not running)
snips-tts .................... 0.55.2 (running)

Step 5: Testing your microphone

You can check that your microphone is working:

sam test microphone
Testing microphone
Say something in the microphone, then press Enter...
...

Assuming you have a speaker, if you can clearly hear what you just said, you can move on without further microphone configuration. If you can’t hear yourself, start the interactive microphone setup guide:

sam setup audio
Starting microphone setup...
What microphone do you use?
[1] Generic USB
[2] ReSpeaker 7-Mic Array
...

Once you are satisfied that your hardware setup is working, you are ready to move on to the next step, where you will deploy your coffee assistant.

Step 6 — Installing your coffee assistant.

If you haven’t already, make sure to create an account on the Snips console.

Once your account is created, we are going to create an Assistant. Give it a name, and select English.

Now that your assistant is created, it is time to add the coffee machine app to it.

then click on the “Add apps” button to confirm. Your assistant is now loaded with the coffee app you’ve selected, and is ready to be deployed to the your device. We will deploy the assistant with sam.

On the terminal, login to the console with your credentials:

sam login
? Enter email used on the console: username@mail.com
? Enter password used on the console: [hidden]

Then, you can install an assistant created with your account:

sam install assistant
Fetching assistants done
? Choose the assistant you wish to install on the device (Use arrow keys)
❯ mycoffee Assistant

It will then deploy the assistant to your device.

Downloading assistant
Fetching assistants done
NLU training done
ASR training done
✔ Deploying assistant to raspberrypi.local...
✔ Snips assistant is now running. Say hey_snips to start!

Once you have the assistant installed, you can show the logs and test your assistant with:

sam watch

To exit, type CTRL + C

Step 7 — Test it

  • plug the Arduino USB cable to the RPI
  • turn on the Raspberry Pi
  • turn on the coffee machine (and wait for it to finish its cleaning cycle)
  • “Hey Snips … make me two coffees please” … and ☕️​☕️.

☕️​☕️

*Join our Discord community where thousands of developers exchange tips and tricks about Snips everyday.

We look forward to hearing your feedback and seeing your own voice-activated coffee machine!

If you liked this article and want to support Snips, please share it!

Follow us on Twitter: @Snips

If you want to work on AI + Privacy, check our Jobs Page

Like what you read? Give Valentin f. a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.