I added WiFi to my coffee machine, and I control it with my home automation server Domoticz, this part is about the concept and my plan.
A couple of days ago, I setup a Domoticz home automation server at my place, this will allow me to control lots of elements in my apartment and make my life easier. With this system, it is easy to add simple devices such as plugs or lights, but I was looking for something more challenging to automate.
How about my coffee machine?
Check out the video of the finished project!
As a programmer, I drink lots of coffee, and I really enjoy a good cup of coffee. That’s why I bought this all-automatic coffee machine:
What’s great about this machine is that it holds coffee grains on the top reservoir, and is able to brew a great coffee with the press of a button, the grains are grinded, pressed, the coffee is poured and finally the waste is disposed.
It’s pretty neat already, but I still need to stand up from my desk (I work from home) and stay next to the machine for two minutes, time for it to warm up and prepare the coffee.
Hence this weekend project, adding WiFi to my coffee machine. So, let’s get to it.
There are two important things I considered during this project:
– The machine needs to function the same as before, In case something goes wrong with the network I want to still be able to use the machine as before.
– The changes needs to be invisible. I will put a bunch of wires and components in there, but I do not want it to become a mess of cables and blinking LEDs.
So, first thing off, where do I start? by tearing down the machine and figuring out how I could achieve this.
There are two main (interesting) parts for me:
– The motherboard: It is situated on the back of the machine. It contains all the components to give power to the pumps, heaters, grinders and microcontrollers to handle the sensors, operate the motors, and communicate with the user via the front panel.
– The front panel: It contains a bunch of buttons (7) and a status screen. It is linked to the coffee machine via a ribbon cable that we can see on the picture (red connector, gray ribbon on the right of the panel PCB).
My initial idea was to investigate what was going on on this ribbon, and clamp my control circuit on it. So I installed a connector (it’s a bit too big, made for the raspberry pi – but works fine) and started testing the lines to see what was going on on them.
- 2 lines for power (5V/GND)
- 3 lines connected to as much buttons that are individually pulled down when a button is pressed
- 2 lines which contain 2 buttons each, they are connected to a voltage divider, which goes from 5V to 3.5V when a button is pressed, and 5V to 2.5V when the other one is.
- Two lines pulled up for the screen backlight, one for a red LED, one for a green LED.
Think about a way to interface all this
The two LEDs create a colored backlight for the screen, that roughly indicate the current state of the machine, with these two we get 4 possible colors:
- no LED: the machine is off (but the circuit is still powered)
- green : the machine is on and ready to make coffees
- red: there is an error that requires an action from the user (Such as when the water tank is empty)
- yellow: the machine is busy / warning
So knowing which LED is on will allow me to determine the current state of the machine, it can be easily connected to the microcontroller like that:
Emulate the first 3 buttons is an easy task, I can simply use a transistor to short the line to ground:
The 4 other buttons are problematic, I would need to determine what voltage level I’m at (5V/3.5V/2.5V) to determine which button is pressed, if any. I could have used a Window comparator circuit to determine that, but it would have required quite some components and extra effort.
Time to think again.
I started testing the buttons directly on the front panel – and each one actually pulls a pin to GND. So if I actually use the transistor circuit from above directly on the buttons and not on the ribbon, I could bypass the voltage divider issue.
The only thing is that it requires me to solder wires on the buttons directly. Oh well. I’ll just have to be more careful 😉
These days, when you need GPIO on one side and WIFI on the other, your only sensible choice is the esp8266 module, at around 3$/piece it is just unbeatable.
The version ESP-12 actually exposes all the pins of the esp8266 chip, which gives me 9 GPIO pins. This is exactly what I need, 7 buttons + 2 LED. Looks like I got lucky with that one.
“I got lucky” 3 of these pins are unusable and I had to give up on controlling three out of seven buttons. I knew it was too good to be true – but more on that later.
I will install NodeMCU on the chip so I can program the chip with LUA.
Ready to begin! see you in part 2