TillFleisch / ESPHome-Philips-Smart-Coffee

ESPHome components which implement a Philips Series 2200/3200 Coffee Machine into HomeAssistant. Capable of brewing automatic coffee.
Other
167 stars 27 forks source link
automation coffee coffee-machine esphome homeassistant philips

ESPHome Smart Coffee (Philips Series 2200/3200) CI

This project integrates a Philips Series 2200/3200 Coffee Machine into into Home Assistant through ESPHome. This component has been developed on a Philips EP2220 and an ESP8266 but it will happily run on an ESP32. Currently supported Coffee Machine models include:

Series Model Number
Series 2200 EP2220, EP2235
Series 3200 EP3243, EP3246

My modified EP2220: Modified Coffee Machine More information about the PCB used in this image is available here.

This component provides a Power Switch, a Status sensor and various Buttons which simulate user input as well as a Number component to customize beverage settings such as size and strength. The Power Switch can be used to turn on the coffee machine with and without a cleaning cycle during startup.

Provided entities in HomeAssistant

You might break/brick your coffee machine by modifying it in any way, shape or form. If you want to use this component, do so at your own risk.

Configuration variables

A example configuration can be found here

Philips Coffee Machine

Philips Power switch

Action Button

Philips Status Sensor

Bean and Size Settings

Fully automated coffee

The following script can be used to make a fully automated cup of coffee. The power switch used in this case does not perform a cleaning cycle. The cleaning check is required since after power loss the machine always cleans. This script will only continue to brew coffee under 2 conditions:

script:
  - id: coffee_script
    then:
      - if:
          condition:
            lambda: 'return id(status).state == "Off";'
          then:
            - switch.turn_on: power
            - wait_until:
                condition:
                  lambda: 'return (id(status).state == "Idle") || (id(status).state == "Cleaning");'
                timeout: 120s
            - if:
                condition:
                  lambda: 'return (id(status).state == "Idle") && id(mug_sensor).state;'
                then:
                  - delay: 5s
                  - button.press: make_coffee_button
          else:
            if:
              condition:
                lambda: 'return (id(status).state == "Idle") && id(mug_sensor).state;'
              then:
                - button.press: make_coffee_button

Wiring

The coffee machines display unit is connected to the mainboard via a 8-pin ribbon cable with Picoflex connectors. The display is powered by the mainboard and the two units communicate using a serial bus. The ESP is placed in between this bus to perform a man-in-the-middle attack. The RX/TX lines are piped through the ESP such that messages can be read, intercepted and injected.

When injecting a 'turn coffee machine on' command, the coffee machine does turn on, but the display unit does not. To circumvent this behavior we can re-boot the display unit by temporarily removing it's power. Thus the display will power on and operate normally. To perform this operation a transistor or MOSFET can be used.

The following wiring guideline can be used to add a Wemos D1 Mini to the coffee machine. The unlabeled wires should be connected without changes. More schematics are available here. Wiring guide

The ribbon cable wires have the following functionalities.

Pin Mainboard Functionality
0 5V 5V
1 GND GND
2 GND GND
3 unused unused
4 TX/RX Messages from mainboard to display
5 RX/TX Messages from display to mainboard
6 0V unknown - very noisy
7 5V

Voltage regulation

The Wemos D1 Mini has a built in Voltage regulator, thus connecting it to the 5V provided by the mainboard is no problem. If you use a different ESP Module/Board please make sure it is 5V tolerant or use a Voltage regulator. Otherwise you might release magic smoke.

Custom PCB

This project has convinced me to design my first PCB (printed circuit board). This rather simple ESP8266-12F-based design was inspired by the Wemos D1 Mini, which I was using previously. When using this PCB the ribbon cable connecting the mainboard to the display must not be cut in half and no soldering is required.

PCB Front side

The Schematics, PCB Layout and BOM are available here on oshwlab.com and an accompanying 3D-printable case for the small PCB is available here on printables.com. The SMD components were chosen such that they can still be hand-soldered without a hot-air station or reflow oven, given a little experience. Since this is my first design there may be mistakes and things that could be optimized. Everything is provided as is, without warranty or liability of any kind.

There are also other PCB designs like this one which relies on using a Wemos D1 Mini and does not require soldering SMD components.

Communication protocol

More information on the communication protocol used by this component can be found here.

Related Work

Troubleshooting

Display not turning on

With some Hardware combinations and on some coffee machines, the display might not turn on reliably. If this is the case for you please try the following troubleshooting steps to resolve the issue: