How to Build an Accessible Coffee Machine Interface

by Orlie in Circuits > Assistive Tech

6787 Views, 33 Favorites, 0 Comments

How to Build an Accessible Coffee Machine Interface

20240613_141814.jpg
signal-2024-02-29-174300_002.jpeg
Button_complete.jpeg

Hello there! Thank you for visiting this page. We want to show you how to build an accessible coffee machine. Some people have trouble to interact with touchscreen based coffeemachines. Therefore, we build an easy to use adapter, with which the coffee machine can be used by wireless buttons. In later versions we are aiming to show you how to create an additional speech control.

How does it work?

All coffee options are presented in an Matlab-based App. By using Button 1 we can toggle through all options. With Button 2 wie can select the option and with button 3 we can reset the menu. With the choice, parameters are given to the actual extension shown in the sart picture and two stepper motors drive to the right position and push the button of the coffee machine.

This tutorial is partially based on other tutorials which we will give credit all along. If you are not sure about the components look at the pictures. I did my best to document every step with pictures.

Supplies

Hardware.jpg
Parts1.jpeg

You will need:

  • 1x soldering iron and solder
  • 1x computer with a screen
  • Arduino IDE
  • Either
  • MATLAB (later versions will have an app with Python, so stay tuned)
  • A code editor able to interpret Python, such as Visual Studio Code, Anaconda, PyCharm or Spyder
  • a 3D-Printer (we used Prusa MINI)
  • 3D-printing filament (we used PLA)

For the coffee machine extention you need:

  • 1x Arduino GIGA R1 WiFi
  • 1x setp motor Nema 17-03
  • 1x Debo motor Driver 3 breakout board
  • 1x step motors 28BYJ48 with drivers
  • 2x Prusa Linear bearing LM8UU
  • 1x Prusa Timing pulley T16-2GT
  • 1x Prusa Belt X-axis
  • 1x Prusa Bearing housing 623h
  • 2x Prusa Smooth rod X-axis / Y-axis (MINI/+)
  • to secure the screws we recommend 10x Ruthex RX M3-5,7

Please, check the length of your coffee machine before you buy the Belt and the smooth rod. Depending on the layout these parts have to be longer or shorter (see Step 3).

For the wireless buttons we used this tutorial (https://wltd.org/posts/how-to-build-a-real-smart-button-for-under-10). You need for three buttons the following parts.

Electrical parts for the buttons:

  • 3x ESP8266
  • 1x ESP8266 USB programmer
  • 3x Arcade Buttons
  • Breadboard or perforated grid board as curcuit board
  • 6x 2N7000 MOSFETs, N Channel
  • 9x 10k resistors
  • 6x 100k resistors
  • 3x 220 resistors
  • 3x AA battery mounts and additionally six AA batteries
  • Optional: On-Off-Switch

All code is provided in https://github.com/AnkeLinus/Assistive_Coffee_machine/tree/main

Building the Button

Curciut.PNG
Hardware.jpg

For this part you need the electrical parts stated above, the soldering iron, and the computer with the Arduino IDE.


We used the tutorial to build the button: https://wltd.org/posts/how-to-build-a-real-smart-button-for-under-10. We highly recommend following this tutorial for soldering the hardware. For the 3D-printed parts we provide another version in the next step. If you want this button, please pay attention that the cables between button, board and battery pack are long enough.

Additionally, an On-Off-Switch between Plus-connector of the battery pack and the board can be build in, if the Button is not constantly needed.

Repeat till you have 3 buttons. The programming of the buttons is described in Step 6.

Build the Casing for the Button

Buttons_Housing.jpg
Buttons_Housing2.jpg.png

For this step you need the 3D-printer.


You can find here the three parts needed for the button. The button has rounded edges and is 8.6x8.6cmx6.8cm large. If you need to configure the parts to fit on your components feel free to use the step data.

If you prefer using the button housing as provided, you can us the STL data for the PrusaSlicer. Download the PrusaSlicer App and install it. Setup your printer (please see https://help.prusa3d.com/de for detailed information). Most important is the printer type and the 3D-printing material. Drag and Drop the parts into the program. If you have (like us) a Prusa Mini, you have to print the parts in two steps, since they are too big to fit on the heatbed at once. We used PLA with an infill of 20% and supports.

The Button Housing is divided into 3 compounds. The first one is for the board. The little hole is either to stick the ESP8266 through it or to have a visual feedback if the LED on the ESP-board is still blinking while sending. In the middle the button is mounted. Also note here, that if you buy other buttons the holes could have other dimensions. In the last compound the battery pack is placed.

If the parts are printed, insert the button parts. Don't glue anything shut before you tested if it worked.

Optional:

  • The holes at the Battery pack side are made for M5-screws. On the inside there would be enough space to add a holding for the nut. In our case, we glued the nuts and the battery mount to the 3D-printed housing.
  • The edges are already rounded, but with this measures it is possible to round them more, if there is a higher risk for harm.
  • If you build in the On-Off-switch, the step-file for the button housing has to be modified to access the switch.

Build the Coffee Machine Extention

Coffee Machine extension 1.PNG
Coffee Machine extension 2.PNG

For this step you need the 3D-printer, the Arduino, Arduino IDE, the Prusa Parts and the stepper motors.


The coffee machine extention is based, in our case, on some parts of an old Prusa printer. In this setup we need only two motors for handling a total of six buttons. The first motor moves the holding of the second motor to the right location. Then, the second motor presses the button.

You find attached the stl- and step-data for the 3D-printing parts. Please note, that if your coffee machine is of another type than Melitta CITouch the arrangement of the buttons and therefore this setup will vary. How can you fix it? The code stated in the next point is adaptable to new positions. We will describe for the case of another setup the steps you have to take. To modify the arrangement you have to create a new holding:

  • Measure the location of the "clips" (left and right side, where you want to attach the extention.
  • While measuring, make sure that you wont cover any buttons such as on/off.
  • Measure the distance between the buttons and the location of the first button.
  • Order or find rods and belts fitting in length to your new setup.

Let's assemble it. The completed assembly is shown in the first two pictures.

  1. Print the parts.
  2. In the holes for mounting the motors, the platines and the Arduino, you have to put the Ruthex RX parts. You can insert them by melting them into the material with the soldering iron.
  3. Lets take a look on the Prusa parts.
  4. Take the Axis_End and insert the linear bearing to fix the belt. Tighten it with a screw. Insert the two smooth rod axis (picture 3).
  5. Put on both axis one pulley. Take the middle part, on which the motor and the finger is connected. Insert the belt into the spacings of carriage_R (picture 4). Afterwards clip it on the pulleys and screw carriage_L on it.
  6. On the other end (Axis_Start) attach the Nema motor, put the pulley through the hole and loop the belt around.
  7. Take the part Axis_Start, put it on both axis. Afterwards connect the pulley with the stepper motor and push the pulley in the hole (picture 5).
  8. Move Axis_Start as far to the outside, so that the belt is under tention and secure with the screws.
  9. Fix the other 3D-printed parts as shown in figure 1 and 2. This should be part Fingermount, Finger and Arduinomount.
  10. Depending on your coffee machine you may elongate the cables for the motor on the axis, so that it can reach the other end of the coffee machine.


Check if your coffee machine has buttons, capacitive or pressure sensitive touch screen. The finger has to be adjusted by using adequte materials.

Wiring the Motors

Follow this tutorial to set the Nema motor up: https://circuitdigest.com/microcontroller-projects/controlling-nema-17-stepper-motor-with-arduino-and-a4988-stepper-driver-module

In this link you find the wiring for the 28JB stepper motor: http://mikrocontroller-blog.de/module/5v-schrittmotor-28byj-48-mit-treiberplatine-uln2003-fuer-arduino-ansteuern/#

Make sure while programming the Arduino to adjust the ports to your wiring. Most likely you have to set the pins in the code different.

Setup MQTT

In this step you only need your PC.


We decided to use MQTT to connect all parts. All parts are connected via WiFi, so that the parts can be moved from each other. The system we present is based on an Windows 11 version. All necessary Software should be compartible with different operation systems. As we used the system please make sure, that you don't open third parties the gates to your PC and your data. By changing some settings security can be enhanced drastically.

  1. Start a mobile hotspot: Go to "Start" (little Windows icon in the corner) and type mobile hotspot. Go to the according settings and enable the hotspot. In this step you find all necessary information for your IP settings needed for the Arduino and the ESP8266.
  2. Download and install Eclipse Mosquitto: https://mosquitto.org/. This will be our MQTT broker. The usage is quite easy to use.
  3. Go to "Services" by typing it in the Windows search.
  4. Look for a service called Mosquitto broker and start it.
  5. We had to change some settings in the mosquitto.conf so that the buttons and the Arduino could connect. Go to the mosquitto-folder. It is most likely under "C:/Programs/mosquitto". Open this file with Notepad++ (so that you can have the Admin rights). Remove # by the line (here: line 529) with "allow_anonymous false" and change false to true. Remove the # in line 232 so that there is only written listener. You can add a line with "listener 1883 YourIPadress.from.the.mobilehotspot". Please change YourIPadress.from.the.mobilehotspot to your actual IP-adress. More informations here: https://mosquitto.org/man/mosquitto-conf-5.html. A restart of the broker as described in 4. is necessary to apply it.
  6. Maybe your PC will block any connection. You have to add the port to the trusted connections (recommended) or disable your firewall (not recommended).
  7. Add the port as follows (Windows version): Go to your firewall and network security settings, select advanced safety settings and add a new rule. Add port 1883.

It might be that the mosquitto broker doesn't start up, when your PC is started. If you have connection issues, make sure that this is running. Afterwards we will present the buttons, the App and the Arduino Code.

Setup the Buttons

You will need for this step the buttons from Step 1 and 2 and the ESP8266 USB programmer.

The code is everytime the same, exept of the topic names and the parameters of the button. Best way to flash them on the ESP8266 is to create three programms in the Arduino IDE (download here: https://www.arduino.cc/en/software, we used Arduino IDE Version 2.3.1). This is how you have to setup the system:

  1. Create one of the programs Button1 to Button3 found in the git. It is important that the parameters and topics are different in each program, so that every button is for the interface unique. If you change it yourself, make sure to change the equivalent in the interface app.
  2. Install the needed libraries: ArduinoMqttClient by Arduino (v. 0.1.8), Stepper by Arduino (v.1.1.3), WiFi101 by Arduino (v.0.16.1), MQTT by Joel Gaehwiler (v. 2.5.2) and PubSubClient by Nick O'Leary (v.2.8)
  3. Install the boards: Arduino Mbed OS Edge Boards by Arduino (v.4.1.1) and esp8266 by ESP8266 Community (v.2.7.0)
  4. Connect the ESP8266 to the ESP8266 USB Programmer (see data sheet)
  5. compile and Upload the code.
  6. Remove the Programmer, Switch to UART to flash the chip and insert it again. Tip: If you take a look in the Serial Monitor with the right baud-rate (115200) you will see the reaction of the chip (serial.println and client.publish). This is perfect for debugging.
  7. Afterwards attach the ESP8266 to your button. If you go into the PowerShell or command promt, navigate into the mosquitto file, you can listen to the topics with this command:
mosquitto_sub -h your_ip -t button_1 

It should show a message "1" to "3", when one of button is pressed. in our case the red button send a "1" used to toggle through the menu and the blue button sends a "2" to confirm the selection. Then the button is correctly conntected over MQTT and has an active connection. Due to the deep sleep function it is quite slow to react. So give it some seconds to react.

Repeat this for the other two buttons.

We faced some challenges that we solved as such:

  • Errors were thrown while compiling the code: The MQTT library needed in our case version 2.7. We downgraded it in the Arduino IDE.

You can find the code for the buttons in my git: https://github.com/AnkeLinus/Assistive_Coffee_machine/tree/main. It is labled Button1.ino, Button2.ino and Button3.ino.

Setup the User Interface App Matlab

To use the Python based app, skip this step and go to Step 8.

Download the App below and start it in MATLAB. It has to be at least Version 2022a, since it contains important updates for MQTT.

In the following the connection between App and Arduino is shown. In this file the parameters are given to the MQTT topic.

clc;
clear all;
close all;

%Root-Certificate, Port and Brokeradress for MQTT-Client
rootCert = "C:\Users\Administrator\Downloads\thingspeak-com.pem";
brokerAddr = "mqtt://192.168.137.1";
port = 1883;

%Defining MQTT-Client and connecting
mqClient = mqttclient(brokerAddr, Port=port, CARootCertificate=rootCert);
mqClient.Connected;

%Subscribe to Topic
subscribe(mqClient, 'variablen')

%Definition variable for motors
variable_motor_fahren = "2038";

%Sending variable to MQTT
variable_msg = variable_motor_fahren;
mqClient.write('variablen',variable_msg);


In this part you can find the App:

To adjust the menu to your coffee machine you have to change the functions in the app provided below. Measure the spacings between the buttons and adjust the stepsize for the stepper motor.

Also here the code is in the git: https://github.com/AnkeLinus/Assistive_Coffee_machine/tree/main. It is called App1. To solve issues with the foto, you can either load in the provided image or rename one of yours.

Setup the User Interface With Python

If you used the Matlab based App, skip this step.

Download the code from the git Python_Interface.py. Make sure that a picture of your choice or the picture in the git is in the same folder as the py-file.

Create an environment in the terminal of your code editor:

python -m venv .env
.\.env\Scripts\Activate.ps1

Install pillow and paho-mqtt:

pip install paho-mqtt
pipinstall pillow

Now you should be good to go, if you did setup mosquitto the right way.

Conntect the Arduino

signal-2024-02-29-174300_007.jpeg

Add the code "arduino_code.ido" from the git to a new file in your Arduino IDE, compile and push it on the Arduino Giga R1 WiFi. All needed libraries should be already installed in Step 6. Depending on the coffee machine type you have to change the Stepper data to match to your spacings in between buttons.

Again make sure, that the pins used are the same in the code. If not, please adjust the pins in the code to your layout.

Applying It to Other Apps

This structure can be fitted to other Apps as well as long as they operate with MQTT. By writing a new app (for example switching Matlab with Python or Java) you just have to listen to the stated topics button_1, button_2, button_3 and kaffeesorten. Feel free to experiment with the codes and we would be happy about your feedback.