Modification and remote control of the Philips 5400 coffee machine. Management is implemented by means of UART and ESPHome
Important! All materials of this project (firmware, schematics, 3D models, etc.) are provided "AS IS". Everything you do with your equipment, you do at your own risk. The author is not responsible for the result and does not guarantee anything. Modification of the coffee machine requires intervention, which will automatically deprive you of the warranty for a new coffee machine.
Working versions of the code for controlling the coffee machine can be taken here (read the comments in the code)
Important! To assemble the firmware strictly in ESP Home version 2023.5.0 or 2023.6.0 and no later, as well as specify a specific version of arduino 2.0.9 in the configuration. If you build the firmware in the latest version of ESP Home and use arduino recommended, the coffee machine will not work correctly. We need to rewrite the code. If you want to rewrite the code for the new version of ESPHome and share it, then I will be grateful for your participation. Thank you.
esp32:
board: esp32dev
framework:
type: arduino
version: 2.0.9
How do I install any version of the ESPHome addon?
- You can download the required version of the ESPHome addon at this link
- Download the addon ESPHome 2023.5.0 (17.05.2023) here
- Download the addon ESPHome 2023.6.0 (22.06.2023) here
- Unzip the archive to any location so that it can be copied to Home Assistant
- Copy the esphome folder from the archive to the addons network folder. If the Home Assistant network folders don't work, then install the Samba share addon. The Samba share addon is available by default in the addon store, but if the Samba share addon is not available for some reason, then enable advanced mode, and then you will see the Samba share addon in the addon store, and if this addon is still not available, then you can install the Samba share addon using this link
In the archive home-assistant-addon-xx.xx.xxxx we are interested in the folder esphome
Copy the esphome folder to the network folder addons
-
Restart Home Assistant
-
Go to the addon store and look for the local version of the ESPHome addon. We are looking at the version, it should be version 2023.5.0 or 2023.6.0, depending on which archive we downloaded
-
If the local version of the ESPHome addon is also version 2023.5.0 or 2023.6.0, then set
What can integration do?
- Turn on and off the coffee machine
- Choose a coffee drink
- Espresso
- Espresso lungo
- Coffee
- Americano
- Cappuccino
- Latte macchiato
- Coffee with milk
- Latte coffee
- Cream Cafe
- Ristretto
- Coffee on the road
- Coffee with milk on the road
- Milk foam
- Hot water
- Choose the strength of coffee
- Choose grain or ground
- Choose the number of servings, including ExtraShot
- Choose the volume of coffee
- Choose the volume of milk
- Send your own coffee drink recipes
- Automatic operation of water removal from the spout of the coffee machine
- Calibration of the servo for water drainage
- Sensors
- Pallet
- Grain
- Water in the container
- Coffee grounds container
- Coffee machine power status (on/off)
- Coffee machine statuses (cooking, pouring coffee, pouring milk, grinding grains, etc.)
- Error sensor
- Sensor 90 to display the coffee drink recipe package, you can use this package to create your favorite coffee drink recipe
- Sensor of the selected coffee drink, coffee volume and milk
Adding the Philips 5400 component to ESPHome
external_components:
- source:
type: git
url: https://github.com/DivanX10/ESP-Philips-5400-Coffee-Machine
If desired, you can connect the component locally. Download the files to the \esphome\components folder\
external_components:
- source:
type: local
path: components
components: [philips_series_5400]
Examples of sending your own coffee drinks
This is purely a recommendation and notification. The decision is up to you. For this model, any changes to the drink parameter are saved to the profile, except for the guest profile. In order not to overwrite profiles, you can select a guest profile and sending recipes for cooking, the changes will not be overwritten. When you send any drink, the screen will not display the drink you selected, but the drink that you selected last time on the control panel of the coffee machine will be displayed. If you didn't touch the screen, then the first drink will be selected by default, this is espresso
If you turn on the Message 2 90 sensor, a package of coffee drink will be displayed in it. You can use this for your recipes. Just copy all bytes except the first three (example in the screenshot, highlighted in red)
You can create any recipes using the table protocol of coffee drinks in Excel
button:
#Sample code for sending a Max 150ml Coffee drink. The recipe package is copied from the Message2 90 sensor, we filter out only the first 3 bytes
#Drink: Coffee. Grain: Maximum. Coffee: 150 ml.
- platform: template
name: "Coffee Max 150ml"
icon: mdi:coffee
on_press:
- lambda: |-
{
uint8_t data[]={0x00, 0x03, 0x00, 0x02, 0x02, 0x00, 0x96, 0x00, 0x00, 0x00};
id(philip)->prepare(data);
}
#Sample code for sending a coffee drink Americano ground 90ml. The recipe package is copied from the Message2 90 sensor, we filter out only the first 3 bytes
- platform: template
name: "Americano ground 80ml"
icon: mdi:coffee
on_press:
- lambda: |-
{
uint8_t data[]={0x01, 0x00, 0x00, 0x02, 0x03, 0x00, 0x28, 0x00, 0x28, 0x00};
id(philip)->prepare(data);
}
#Sample code for sending a coffee drink Coffee with milk 150/120ml. The recipe package is copied from the Message2 90 sensor, we filter out only the first 3 bytes
- platform: template
name: "Coffee with milk Max 150/120ml"
icon: mdi:coffee
on_press:
- lambda: |-
{
uint8_t data[]={0x02, 0x03, 0x00, 0x02, 0x01, 0x02, 0x96, 0x00, 0x78, 0x00};
id(philip)->prepare(data);
}
Embedding ESP
Remove the control panel. It is not difficult to remove. We pull a little on ourselves, insert a plastic spatula into these points and take out the panel
We need access to an 8-core wire that needs to be connected to the ESP
We connect according to the scheme of your choice, through a relay or through an optocoupler. We connect the servo at will, it is needed for the operation of water removal from the spout
General connection diagram without relays and optocouplers. Just connect the ESP32 to the coffee machine
Disassembling the control panel
Why exactly did I disassemble the control panel and connect the relay, and why not the optocoupler? There were attempts to find a solution to turn on the coffee machine without disassembling the control panel. I tried to disconnect the power supply through the transistor, tried to send commands, but it was unsuccessful.
I connected the resistor according to this scheme, but this method works on a 2000/3000 series coffee machine, but it did not work for the 5400 series. For reference, there are two projects for 2000 series coffee machines, these are ESPHome-Philips-Smart-Coffee and SmartPhilips2200
We remove the sticker from the chip and see the marking with the name of the chip STM32L4R5VIT6
In the chip documentation STMicroelectronics STM32L4R5VIT6 we find our chip, it is STM32L4R5VIT6 LQFP100 (25 legs on each side)
The documentation says that you can control the coffee machine with bytes after turning it on, so I couldn't turn it on remotely. Maybe I'm wrong and if such a solution is found, I will definitely make an amendment.
To simulate the operation of the touch button, you can use a single-channel 5V relay module (KY-019) or an optocoupler PC817C, which will supply GND to the resistor R110, to which there is a track from the power button, thereby turning the coffee machine on and off. I did not risk soldering the wire after the resistor R110 (the nominal value of the resistor is 4.7 kOhm), since after the resistor there is a direct path to the chip leg, and the lamp to the capacitors, and I do not know how the chip can react to this, but if so, then we will be able to turn on the coffee machine through the touch button and remotely. This was tested on a touch lamp, where I soldered the wires after the resistor and I could turn it on and off remotely, as well as turn the lamp on and off by pressing the touch button. I don't dare repeat it on the coffee machine.
Control panel in parsing
The track from the power button to the resistor R110 (the nominal value of the resistor is 4.7 kOhm), after the resistor the track goes to Schottky diode BAS70TW (K73)
Solder the wire to the resistor R110 (the nominal value of the resistor is 4.7 kOhm)
We make a hole in the lid and take the wire out, which we connect to the relay or to the optocoupler
Decryption of the protocol
I managed to decrypt some of the protocols, if you find something new, let me know about it and I will update the information. Create an issues and describe in detail about the protocol.
Brief description of the protocol function
- AA:AA:AA:90 - coffee drink recipes
- AA:AA:AA:91 - coffee beverage preparation counter
- AA:AA:AA:93 - coffee beverage preparation counter
- AA:AA:AA:B0 - system sensors
- AA:AA:AA:B5 - coffee and milk volume counter for making coffee drinks
- AA:AA:AA:BA - couldn't decipher
- AA:AA:AA:BB - couldn't decipher
- AA:AA:AA:FF - couldn't decipher
- AA:AA:AA:FE - turning the coffee machine on and off
AA:AA:AA:FE - this package AA:AA:AA:FE:00:00:C8:87:1B:40:55 occurs twice, at the very beginning, it goes first when turning on the coffee machine and when turning off
AA:AA:AA:90 - coffee drink recipes
AA:AA:AA:91 - protocol of the coffee drinks counter. It's just a record of the coffee drinks made and the record is reset when the coffee machine turns off. We made one cup of coffee, the counter worked and set for example 1, then we made another cup of coffee, the counter worked again and set 2. In order to remotely start the preparation of coffee drinks, you need to run at +1 to what is in the counter. Without taking into account this counter, the preparation of coffee drinks remotely will not work
AA:AA:AA:B0 - protocol of system sensors: container of coffee grounds, water, tray, presence of grain, coffee preparation statuses, custard block statuses
AA:AA:AA:B5 - protocol of the coffee drinks counter. Counts the volume of poured coffee and milk in seconds
Water drain of the coffee machine spout
I have developed a water outlet from the spout for the coffee machine. Why is this necessary? When we turn on the coffee machine, then when it is turned on, the heating and flushing starts. During flushing, most of the water passes inside, and some is poured out through the spout. What should we do if we want the coffee machine to make us fresh coffee in the morning and that there is no water in the coffee after washing? Water drainage allows you to solve this problem. When the coffee machine is turned on with the help of a smart home, the water supply still remains at the spout until the moment when the coffee machine switches to the "Drink selection" mode, only after that the water outlet hides inside the spout, opening the passage to the spout.
You can find a ready-made model for printing on a 3d printer here or download from this project. You can open FCStd files in the FreeCAD program.
The MG90S Micro Servo 180 degree servo is used. It is quite enough to drain water. Powered by +3.3V from the ESP itself, which is a big plus. The wire from the servo is pulled inside simply, without drilling the housing. We pull the wire into the inside of the spout holder and pull it to the inside of the case to the ESP
Control Panel in Home Assistant
Copy the code from here , and then create a card
Card code
entity: sensor.coffee_machine_power_status
type: custom:multiple-entity-row
name: Status
icon: mdi:coffee-maker
state_color: true
show_state: false
secondary_info:
attribute: Making coffee
entities:
- entity: group.kitchen_coffee_machine_info_and_menu
name: Menu
state_color: true
icon: mdi:information-outline
styles:
height: 60px
width: 50px
- entity: group.kitchen_coffee_machine_coffee_drinks
name: Drinks
state_color: true
icon: mdi:coffee
styles:
height: 60px
width: 50px
- entity: switch.coffee_philips_5400_valve_open_closed
name: Valve
type: switch
tap_action:
action: toggle
icon: mdi:coffee-maker-outline
state_color: true
styles:
height: 60px
width: 50px
- entity: binary_sensor.coffee_philips_5400_power_status
name: Power
icon: mdi:gesture-tap-button
state_color: true
tap_action:
action: call-service
service: script.kitchen_coffee_machine_power
styles:
height: 60px
width: 50px