Introduction: IOT Coffeemaker (UFEE)

As proof of knowledge, we had to create an IOT device that could be controlled via a self-made web interface. Since I love coffee, and consume a lot of it on a daily basis, I decided to make my own IOT coffeemaker.

The UFEE coffee maker: "the coffeemaker with you in mind"

In order to make the device completely automatic, I'm using instant coffee.

Step 1: What You'll Need

- Raspberry Pi Model 3

- servo motor (ARD-T010051)

- RTC DS3231

- CJMCU-832 PAM8302 2.5W D-Class mono amplifier

- Reed sensor

- 5V RELAY (10A)

- Solid state relay (5V)

- Aux cable

- Shrinking tube

- 2x Copper nozzle

- Bicone piece

- Silicon tube

- Senseo boiler 1400W

- Senseo pump 22W

- Senseo watertank

- Reed switch (normally open)

- coper wire

- MCP3008

- 2x LDR

- 4ohm speaker (or a different kind)

- 2x 10KΩ resistor

- 5KΩ resistor

- Diode 1N4007

For the case I chose for a rather industrial look, but there's a lot of ways to fit the components that might look more appealing when you want to place it in your home.

Step 2: Getting Started

I started with opening up the Senseo coffeemaker and explore the components inside. To open it up, you remove 2 screw from the back using a torx screwdriver, and than you can pry it open at the holding clips.

Once it's open, all you need is the pump, the boiler, and the wires and tubes holding everything together.

The next step is to mount the boiler and pump into the desired casing, since the boiler and the watertank have to sit up right in order to use them. Make sure that the fitting for the watertank is sitting up right, tight and is easily accessible.

Once that is completed, you can start connecting the components according to the scheme.

Step 3: The Nozzle (industrial Look)

For the nozzle, I've use a small metal container in which I drilled a hole just large enough to fit the bicone piece. Fit the tubing to one of the nozzles and tighten en nozzles to the bicone piece. Then drill matching holes in the metal container and the casing, and use some bolts and nuts to tighten it to the casing.

Step 4: The Coffee Dispenser (industrial Look)

To hold the coffee, you'll need a container with a transparent lid that you can mount to the body.

Drill 2 holes of Ø5mm in de bottom:
- One in the center of the container
- one in the middle between the first hole and the side

put the gear of the servo through the hole closer to the side, and screw on the piece (enclosed with the servo) with 6 legs. (see pic 1)

Then take a metal piece and bend it in the shape of a little rail, and bend the corners and end of one piece, so you can mount it to the bottom of the can over the hole in the center. (see pic 2)

Use a fitting bracket to mount the servo more firmly to the body of the container. (see pic 3)

Finally drill a hole of Ø5mm in the lower back of the container to fit the LDR and a few more to mount the container to the body of the machine. (see pic 4)

Step 5: Preparing and Mounting the Sensors

There an NTC built into the boiler, which you can connect to the MCP by making a voltage divider with a pull-down resistor of 5KΩ.

The LDRs for the coffee and cup check should be prepared first. Since I'm using metal casing, it's necessary to isolate it well so I don't short it with the case. If you're also using metal casing, do the following:
- put some isolating tape around each of the legs en cover it up with a shrinking tube. (see pic 1)

- next, solder wires to each of the legs and also cover the connections with shrinking tube, so all the connections are completely covered. (see pic 2 & 3)

- repeat these steps for the second LDR

- put the head of one of the LDR's through the hole you drilled for it in de coffee container and bend the legs. (see pic 4)

- cover with isolation tape so no light can pass through from the back.

- mount the other LDR to either the bottom of the casing with a piece of tube that gets covered when a cup is placed, or directly into the base where you put the cup. (When choosing for the 2nd option, make sure that the sensor is covered well with a transparent material that is waterproof!)

To mount the reed sensor to watertank, fill it with water so that the magnet is at it's highest point (water should be over the minimum line). Then you can either listen when the element switches, or you can connect it to the rpi or an arduino and continuously print the value.

When you're certain you know the exact spot for the sensor, mount it very firmly to the watertank and add an extensive amount of hotglue to make sure the glass tube doesn't break (this is very sensitive). (see pic 5)

Step 6: The Wiring and Calibration

Mount the Raspberry pi and the larger components inside of a wooden box with a plank mounted on the top (base where the machine and cup stand). I've used velcro to mount the pi and the components inside the box. Than you can mount everything directly to ge GPIO pins, or use a breadboard or circuitboard if you prefer.

For the calibration of the sensors, check the values you get in both states and in different lightings, and adjust them in the code. (mine might or might not work). Same goes with the NTC.

NOTICE: The way the values change depends on wether you put the pulldown resitor or the LDR/NTC first. When you first add the resistor with an LDR, you will get a higher value for a lower light exposure. (1023 is completely dark).

When you want to use the alarm system from the project, you need to solder an aux cable to the + - and GND of the amplifier, and the speaker to the output pins of the amplifier. Then also add 5V to the board. (This is used as reference voltage to amplify the sound). You can then still adjust the volume with the potentiometer on the board.

Step 7: System Deployment

Make sure you have a Raspberry Pi model 3 with Raspbian installed and zeroconf is configured so you can configure it headless over an SSH pipeline.

If you don't know how to do it, follow this guide to flash Raspbian to your SD card. To configure zeroconf, open the SD card on your computer and edit the cmdline file and add the following to the end of the file (should be one line)


In order to be able to connect to your pi using ssh, you have to enable it. You can do this by adding a file named SSH in the boot directory without extension (no .txt).

when this is configured, you can make an SSH pipe to your Raspberry Pi using the ssh command in a UNIX terminal, or by using Putty on a windows pc.

The first time you log in to a pi, the credentials are the following:

username: pi
password: raspberry

To make sure your raspberry pi is completely up to date, issue the following command in the terminal:
sudo apt update && sudo apt upgrade

Now you can install the needed packages by issuing the following command:

sudo apt install -y python3-venv python3-pip python3-mysqldb mariadb-server uwsgi nginx uwsgi-plugin-python3 

Next, add a new directory in your home directory with a suiting name (e.g. ufee) and go inside of it:

mkdir project1 && cd project1

Next you want to install a virtual environment in which the application will run. You can do this with following commands:

python3 -m venv --system-site-packages env
source env/bin/activate
python -m pip install mysql-connector-python argon2-cffi Flask Flask-HTTPAuth Flask-MySQL mysql-connector-python passlib

Now your virtual environment is up and running. Now you can copy the code from my github in there. You can find it here. You can also clone it immediately with the following command:

git clone

next, we'll configure the database:

sudo mariadb < ufee/sql/init_db.sql && sudo mariadb < ufee/sql/ufeedump.sql

The configuration of the NGINX and UWSGI:

Change 'Joshy' in the config files with your own username with the following command:

sed -i s/joshy/$USER/g conf/*

add and activate the services:

sudo cp conf/project1-flask.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl start project1-flask.service

And finally configure the NGINX:

sudo cp conf/nginx /etc/nginx/sites-available/ufee
sudo rm /etc/nginx/sites-enabled/default
sudo ln -s /etc/nginx/sites-available/ufee /etc/nginx/sites-enabled/ufee
sudo systemctl restart nginx.service
sudo systemctl enable project1-flask.service

Now the system should be up and running! Enjoy your coffee ;)