ESP smart сoffee machine Philips 5400 Series

I created sensors, and thanks to the sensors, I came to some understanding of how to run coffee recipes many times. It turns out that the counter is working and it is impossible to jump over the counter, the coffee recipe will not work. Here’s what I saw

The code for the operation of sensors message 91 and 93

In order for the Message 90 sensor to work, you need to enable debugging in both directions for uart_mainboard. It is not recommended to do this, because because of this, the changed coffee preparation parameters are not saved in the profile and interferes with the normal operation of the coffee machine, so I turned off BOTH and specified RX

 - id: uart_mainboard
   rx_pin: GPIO3
   tx_pin: GPIO1
   baud_rate: 115200
   stop_bits: 1
   data_bits: 8
   parity: NONE
   rx_buffer_size: 256
   debug:
     direction: RX
     dummy_receiver: false

uart:
 - id: uart_display
   rx_pin: GPIO16
   tx_pin: GPIO17
   baud_rate: 115200
   stop_bits: 1
   data_bits: 8
   parity: NONE
   rx_buffer_size: 256
   debug:
     direction: BOTH
     dummy_receiver: false
     sequence: 
      - lambda: |-
          UARTDebug::log_hex(direction, bytes, ':');
          //Coffee drinks
          //Message 93. Teaches bytes 0 through 11. We display in this form [0xAA, 0xAA, 0xAA, 0x93, 0x0F, 0x01, 0x01, 0xBC, 0xD7, 0xF1, 0xEB, 0x55]
          if (bytes[0] == 0xAA && bytes[2] == 0xAA && bytes[3] == 0x93) {
              std::string message93 = "[";
              for (int i = 0; i <= 11; i++) {
                  char hex_str[6];
                  snprintf(hex_str, sizeof(hex_str), "0x%02X", bytes[i]);
                  message93 += hex_str;
                  if (i != 11) {
                      message93 += ", ";
                  }
              }
              message93 += "]";
              id(id93message).publish_state(message93);
          }

          //Message 90. Accounting for bytes from 0 to 20. We display it in this form [0xAA, 0xAA, 0xAA, 0x90, 0x06, 0x0A, 0x00, 0x03, 0x00, 0x02, 0x03, 0x00, 0x1E, 0x00, 0x00, 0x00, 0xC5, 0x47, 0xCB, 0x8E, 0x55]
          if (bytes[0] == 0xAA && bytes[2] == 0xAA && bytes[3] == 0x90) {
              std::string message90 = "[";
              for (int i = 0; i <= 20; i++) {
                  char hex_str[6];
                  snprintf(hex_str, sizeof(hex_str), "0x%02X", bytes[i]);
                  message90 += hex_str;
                  if (i != 20) {
                      message90 += ", ";
                  }
              }
              message90 += "]";
              id(id90message).publish_state(message90);
          }

          //Message 91.Accounting for bytes from 0 to 11. We display it in this form [0xAA, 0xAA, 0xAA, 0x91, 0x12, 0x01, 0x08, 0xB0, 0x97, 0xDA, 0x2C, 0x55]
          if (bytes[0] == 0xAA && bytes[2] == 0xAA && bytes[3] == 0x91) {
              std::string message91 = "[";
              for (int i = 0; i <= 11; i++) {
                  char hex_str[6];
                  snprintf(hex_str, sizeof(hex_str), "0x%02X", bytes[i]);
                  message91 += hex_str;
                  if (i != 11) {
                      message91 += ", ";
                  }
              }
              message91 += "]";
              id(id91message).publish_state(message91);  
          } 

text_sensor:
  - platform: template
    name: "Message1 93"
    id: id93message
    update_interval: 60s

  - platform: template
    name: "Message2 90"
    id: id90message
    update_interval: 60s

  - platform: template
    name: "Message3 91"
    id: id91message
    update_interval: 60s

To understand how the counter works, you can watch the video

Looking at the Message 90 and 93 sensors, I noticed the following.

This is what bytes look like when the coffee machine offers to choose a drink and before switching off

Turn off the coffee machine

The coffee machine is turned off

The coffee machine was completely de-energized and plugged into an outlet, after a pause of 5 seconds

The coffee machine was turned on, the heating and flushing stage began

The coffee machine has passed the washing stage and offers to choose a drink

I realized that immediately after the coffee machine turns on and offers to choose a drink, it is impossible to send a command to prepare a recipe, since the washing stage will start. To prevent this from happening, you need to wait until it happens like this


When making coffee drinks, the counter is triggered and I had an idea how to run the recipe, but I can’t write the code correctly. ChatGPT is trying to help me, but it doesn’t work well and it offers a bunch of options, and most of the options are wrong, compilation goes wrong. ChatGPT simply offers codes by brute force and there is zero sense from this.

The point is that we extract bytes from the Message 91 sensor and insert it as a variable to send a command, thus simulating the operation of the counter

For the test, I created a button and it works correctly. This is not sending a cooking command, but just checking to see how bytes are being sent. I extract bytes from the Message 91 sensor and send the Message Send button 91 to the sensor and the sensor displays exactly the same as in Message3 91
[0xAA, 0xAA, 0xAA, 0x91, 0x08, 0x01, 0x08, 0x16, 0xB1, 0x6B, 0x3D, 0x55]

  - platform: template
    name: "Message Button 91"
    icon: mdi:coffee
    on_press:
      - text_sensor.template.publish:
          id: idMessageButton
          state: !lambda 'return id(id91message).state;'

To send the command, I first tried this option, but it doesn’t work, because when compiling I get an error

button
  - platform: template
    name: "Coffee"
    icon: mdi:coffee
    on_press:
      - uart.write:
          id: uart_mainboard
          data: [0xAA, 0xAA, 0xAA, 0x90, 0x06, 0x0A, 0x00, 0x03, 0x00, 0x02, 0x03, 0x00, 0x1E, 0x00, 0x00, 0x00, 0xC5, 0x47, 0xCB, 0x8E, 0x55]
      - uart.write:
          id: uart_mainboard
          data: return 'id(id91message).state;'

And I got this code from ChatGPT, the compilation was successful, but it doesn’t work and I don’t see how bytes are being sent

button
  - platform: template
    name: "Coffee"
    icon: mdi:coffee
    on_press:
      - uart.write:
          id: uart_mainboard
          data: [0xAA, 0xAA, 0xAA, 0x90, 0x06, 0x0A, 0x00, 0x03, 0x00, 0x02, 0x03, 0x00, 0x1E, 0x00, 0x00, 0x00, 0xC5, 0x47, 0xCB, 0x8E, 0x55]
      - uart.write:
          id: uart_mainboard
          data: !lambda |-
            std::string message = id(id91message).state.c_str();
            std::vector<uint8_t> bytes;
            for (std::size_t i = 0; i < message.size(); i += 4) {
              std::string byte_str = message.substr(i, 4);
              uint8_t byte = std::stoi(byte_str, nullptr, 16);
              bytes.push_back(byte);
            }
            return bytes;

Table of analysis of the protocol AA AA AA 90 which is responsible for accounting. The last 4 bytes are the checksum. If you change one byte, the recipe will not work.

:partying_face:

Thanks to one person, you can now make coffee many times. We wrote a component to control the coffee machine. But I must say right away, the code is not perfect, but it works. You can use the code as it is or modify it and bring it to mind. A pass-through counter has been implemented in the code and now you can prepare coffee remotely as many times as you want

The project ESP-Philips-5400-Coffee-Machine is still in Russian, I will add a page in English soon.

The project itself ESP-Philips-5400-Coffee-Machine

In the config you need to add

external_components:
  - source:
      type: git
      url: https://github.com/DivanX10/ESP-Philips-5400-Coffee-Machine


philips_series_5400:
  display_uart: uart_display
  mainboard_uart: uart_mainboard
  id: philip

The full code can be found here

1 Like

I have one of these coffee machines and this project intrigues me. Amazing work reverse engineering the machine!

What is the use case for this, though? What functionality does this give over just the buttons?

It all depends on you.

  1. The coffee machine can be turned on and off remotely
  2. There are sensors showing:
  • Availability of water
  • Availability of grain
  • Is the pallet inserted
  • Is the coffee grounds container empty
  • Coffee preparation statuses
  • Power status, whether the coffee machine is turned on or not
  1. You can send your recipes for making coffee based on the recipe table, or you can make coffee and the recipe will be displayed in the coffee preparation sensor and it can be used

The coffee machine makes me coffee as I wake up, it’s damn cool, it’s what I dreamed of. For my philips 5400 coffee machine, the REDMOND SkyCoffee M1519S coffee maker worked like this. It turned on when we woke up, but with the advent of the coffee machine I wanted to do the same and I did it.

Video of how the coffee machine turns on and makes me coffee

The: make coffee as you wake up is nice, but doesn’t it still need to do the first cleaning after being off for a long time? Or does this make is so that you can skip that step?

Do you mean when the coffee machine turns on and does the heating and rinsing and drains the water into the cup?

To do this, I designed a water outlet. When the coffee machine is turned on, it starts the washing stage and water flows through it into the cup if it is standing or is poured into the tray if there is no cup. The water drain removes water from the cup, preventing water from entering the cup during washing and the cup remains dry, all the washing water goes past the cup


1 Like

That is very clever

News
The component for controlling the Philips 5400 coffee machine is completely rewritten and ready. I added an English version to the coffee machine project here. Any improvements and improvements in the code are welcome. Fork and finish the code at your discretion. Share a link to your projects with revision

This is how the control panel of the coffee machine and the panel of parameters for making coffee drinks looks like

image

1 Like

Is the relay specifically if you want control over on/off? What is the use-case for using the optocoupler instead?

Optocoupler is probably a good option. Why am I writing probably? Because I do not know how the optocoupler will behave if connected to a pin without pulses when power is supplied. As I later found out, the esp does not have all pins free (without pulses when current is applied). When I connected the optocoupler to the esp, I didn’t think about it and when I plugged the coffee machine into the socket, the coffee machine turned on every time. This does not happen with the relay. The relay can be connected to any pin on the ESP and the coffee machine will not turn on when plugged into the socket. When I remembered about it, by this time I had everything assembled on the relay and had no desire to check. But, in the case of an optocoupler, you can turn on the coffee machine from the button on the control panel and remotely, but it does not work with the relay, only switching on with esp.

1 Like

Can I make this work with the 3200 series somehow?

The 4000/5000 series coffee machine project is not suitable for the 3200 series coffee machine, since they have different protocols. The 3200 coffee machine has no LCD screen and buttons, so you need to look at projects for 1000-3000 series coffee machines. The links are in the header

1 Like

Hey @DivanX10 and peeps, thanks for this thread, awesome work here!

I was reading through everything and got excited until I realized your last point about the relay disabling the physical power button. For me I’d prefer to only automate the coffee making on some days :slight_smile: so hopefully someone is willing to test the optocoupler idea some more or figure out a new way to turn the machine on.

Unfortunately, I can’t test other connection schemes to simulate pressing a button and I no longer want to, since I don’t want to sit for a while without coffee and tinker with the coffee machine again. I’m used to turning it on through the voice assistant or automatically after waking up. I was once offered a scheme for connecting to an optocoupler that would simulate pressing a button and at the same time maintain the functionality of the physical button. But I haven’t tried it and can’t guarantee it will work. When soldering, I ruined the 4.7 kOhm SMD resistor and installed what was there - SMD 10 kOhm. If you solder a resistor of a higher value, for example, as I soldered 10 kOhm, then the sensitivity of the button will disappear, but it works with the relay. It is not advisable to set it below 4.7 kOhm, since a resistor is needed here to eliminate interference and it was not for nothing that the manufacturer set it to 4.7 kOhm. If you want, try it and if the physical button works for you and you can turn it on remotely, it will be great. There may be other connection schemes for remote activation. I will be glad if you succeed and share your working scheme

Below are the diagrams that were offered to me after I had already implemented and published my working scheme for remote switching on, but without losing the ability to turn on the coffee machine through a physical button

image

Note! R330Ohm - a 330 Ohm resistor can be used 270-510 Ohm

1 Like

Good day. I have a problem with my Philips coffee machine. Triac bt312 is faulty and smd resistor R109 is also faulty. Unfortunately, the value is not readable. Does anyone have a photo of the triac where it would be possible to read the value. Thank you Jara.

Hello everyone and congratulations on this beautiful project! :smiley:
As far as you know… would it also work on a machine from the new 5500 series?
Thanks

I did not find the 5500 series coffee machine, show the coffee machine with screenshots and a link to it

This is the link from the Philips website:

It is the latest model of the EP series.
I would like to know if it works with the same codes as the 5400 series.
But I haven’t found much information about it.

In appearance, the models between the 5400 and 5500 series are identical, but there is no guarantee that the protocol will be the same. The manufacturer can make changes to the protocol, for example, order the firmware from another developer. Philips doesn’t write the code themselves, they order it. Then, you should understand that by buying this coffee machine after modification, you lose the warranty, and given the cost of this coffee machine at € 699.99, maybe you should look at others who already have integration with Home Assistant, and do not need to modify the 5500 series coffee machine. If you still really want a 5500 series coffee machine and want to modify it, then you do it at your own risk and should understand that it may not take off, and then you will have to decrypt the protocol yourself, and maybe earn if the protocol is the same.

Alternative integrations for coffee machines. No modification of the coffee machine is required for their operation, and therefore you will not lose the warranty

  1. Home assistant Delonghi integration
  2. Jura Coffee Machines for Home Assistant

I decided to update ESPHome and ran into a problem. The coffee machine started to work erratically, and as a result, I rolled back to the old version of ESPHome 2023.5.0 and rebuilt the firmware, and also specified.

esp32:
  board: esp32dev
  framework:
    type: arduino
    version: 2.0.9
  1. 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
  1. Unzip the archive to any location so that it can be copied to Home Assistant

  2. 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


  1. Restart Home Assistant

  2. 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

  3. If the local version of the ESPHome addon is also version 2023.5.0 or 2023.6.0, then set

1 Like