Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coffee machine Philips EP5444/90 5400 Series LatteGo #6

Closed
DivanX10 opened this issue Apr 26, 2023 · 82 comments
Closed

Coffee machine Philips EP5444/90 5400 Series LatteGo #6

DivanX10 opened this issue Apr 26, 2023 · 82 comments
Labels
question Further information is requested

Comments

@DivanX10
Copy link

image

23.04.2023 purchased a new Philips EP5444/90 5400 Series LatteGo coffee machine and I'm going to repeat your experience. The withdrawal of the warranty does not frighten me, I can repair it myself if something happens to it. I would like to clarify about connecting the display to the ESP8266 WeMos D1 Mini. You write about the transistor, but you did not specify which transistor to connect.

image

Which transistor should I connect? I have a TIP120 transistor

image

This is how the wiring to the display looks, just like you do, which may have a chance to control remotely. Do you think it will work?

image

Do I understand correctly that it is necessary to disconnect this cable from the display, connect some of the wires to the ESP8266 WeMos D1 Mini, and already pull the wiring from the ESP8266 WeMos D1 Mini to the connector?

@TillFleisch TillFleisch added the question Further information is requested label Apr 26, 2023
@TillFleisch
Copy link
Owner

I used a IRLZ44N mosfet, which I had laying around from a different project. Anything that can switch the 5v/gnd should be able to do the job.
I don't have a background in electrical engineering so take that with a grain of salt.

The picoflex connector looks like the one on my machine. The esp is supposed to go in-between the display and the Mainboard. You can remove the connector or split the ribbon cable to achieve this.

That being said, I have no idea if this external component will work on your machine, as mine does not have a display.
I'm guessing the inner workings on your machine are going to be different.
On my machine the message sent on the bus contain led states and button press states. I cannot say if the behaviour or the messages are the same on your machine.

@DivanX10
Copy link
Author

There are several transistors, which in your opinion are the most suitable and why did you use the IRLZ44N mosfet and not the BC33725TFR?

  1. IRF520NPBF
  2. BC33725TFR
  3. BS170
  4. BC337-40

@DivanX10
Copy link
Author

DivanX10 commented Apr 26, 2023

Do I understand correctly?

  1. ESP8266 is an intermediary between the control panel and the control board, and even if ESP8266 is without the esphome code, you can control the coffee machine as if there is no ESP8266

  2. Commands from the coffee machine need to be caught in logs

  3. If I solder a transistor, in my case it will be BS170, then can I remotely turn on the coffee machine and the screen will turn on?

  4. Which wire is in the stranded cable? Easily amenable to tinning and soldering? Isn't there a thin wire inside? For example, as in wired headphones, the wire is thin and difficult to service, there is not such a wire here?

@TillFleisch
Copy link
Owner

There are several transistors, which in your opinion are the most suitable and why did you use the IRLZ44N mosfet and not the BC33725TFR?

I used the IRLZ44N because it was the one unused mosfet I had laying around. I cannot recommend a specific mosfet or transistor as I am not familiar enough with the related electronics topic.

ESP8266 is an intermediary between the control panel and the control board, and even if ESP8266 is without the esphome code, you can control the coffee machine as if there is no ESP8266

Yes, the ESP is an intermediary. Without the firmware generated by ESPHome the coffee machine will not work properly as the communication between the Display and Mainboard is stopped. This component will take anything on the display UART and forward it to the mainboard UART (and vice versa). In case youre machine uses different commands, but the same wiring, this component should not stop the machine from working (assuming the wiring is the same).

Commands from the coffee machine need to be caught in logs

You can use the ESPHome UART debug functionality to log the communication on the bus.

If I solder a transistor, in my case it will be BS170, then can I remotely turn on the coffee machine and the screen will turn on?

Maybe. Turning on the coffee machine is both a combination of sending a command and temporarily removing power from the display on my unit. I cannot say if the behavior will be the same on your device.

Which wire is in the stranded cable? Easily amenable to tinning and soldering? Isn't there a thin wire inside? For example, as in wired headphones, the wire is thin and difficult to service, there is not such a wire here?

On my machine the wiring inside the ribbon cable is stranded wiring which can be tinned and soldered easily. The wires inside the ribbon are small but not as small as headphone cables.

@DivanX10
Copy link
Author

So, I connected it and it worked, but somehow strangely. It works both with a transistor and without a transistor. Since the BS170 and BC337-40 transistors are on the way and should arrive soon, I decided not to wait, but to use the existing IRF520 MOSFET. If you do not enable debugging (remove debug from the code:), then the screen turns on without a transistor and you can fully control the coffee machine, and through the ESPHome web interface, the Power switch is constantly on and off. It's the same with a transistor. The coffee machine does not pour coffee through ESP Home. Select play/pause does not work.

uart:
  # UART connected to the mainboard
 - tx_pin: GPIO1
   rx_pin: GPIO3
   baud_rate: 115200
   id: uart_mainboard

  # UART connected to the display
 - tx_pin: GPIO15
   rx_pin: GPIO13
   baud_rate: 115200
   id: uart_display

philips_series_2200:
  display_uart: uart_display
  mainboard_uart: uart_mainboard
  power_pin: GPIO12
  id: philip

image
image

If you enable debugging. The debugging code looks like this (see below), then when you try to press the button via the web ESPHome, the control panel on the coffee machine turns off, although there are logs in the ESPHome. Can you help me set up the esp to work with the coffee machine? How to understand from the log that the coffee machine is pouring coffee? Can you add a philip_series_5400 coffee machine to the component?

uart:
  # UART connected to the mainboard
 - tx_pin: GPIO1
   rx_pin: GPIO3
   baud_rate: 115200
   id: uart_mainboard
   debug:

  # UART connected to the display
 - tx_pin: GPIO15
   rx_pin: GPIO13
   baud_rate: 115200
   id: uart_display
   debug:

philips_series_2200:
  display_uart: uart_display
  mainboard_uart: uart_mainboard
  power_pin: GPIO12
  id: philip

image

@DivanX10
Copy link
Author

I figured out how to create my component for the 5400 series, it remains to understand why the screen turns off when debugging. There is an assumption that the IRF520 MOSFET transistor does not open at 3.3V. As soon as I get the BS170 and BC337-40 transistor, I will check them in action.

As I understand how to split messages. We turn on the debugging mode, click on the buttons and see what message arrives in the esp, we break this message into parts and insert it in the same way as your version

image

https://github.com/TillFleisch/ESPHome-Philips-Smart-Coffee/blob/main/protocol.md

@TillFleisch
Copy link
Owner

Based on the uart logs it looks like the ep5444 is using a different protocol for communication.
On my ep2220 all messages start with 'D5 55', this does not seem to be the case on your machine.

The protocol has been reverse engineered using the uart debug functionality. You can find more information on the messages in protocol.md.

Unfortunately, I cannot help you develop support for the ep5444 as I don't have access to that machine.
To me it looks like this should be its own separate external component.
Feel free to fork and modify this repository.

@DivanX10
Copy link
Author

DivanX10 commented Apr 27, 2023

When debugging, I have very long numbers displayed. How did you prescribe to catch messages as shown in the screenshot? What code did you use?
image

If I specify such a code

uart:
  # UART connected to the mainboard
 - tx_pin: GPIO1
   rx_pin: GPIO3
   baud_rate: 115200
   id: uart_mainboard
   debug:

then my messages will look like this

<<< AA:AA:AA:B5:F5:06:00:00:00:00:00:00:68:BE:A1:30:55:AA:AA:AA:B5:F3:06:00:00:00:00:00:00:EF:B7:CE:F6:55:AA:AA:AA:B0:F4:07:06:00:00:00:00:00:00:FA:4D:73:CF:55:AA:AA:AA:B5:F5:06:00:00:00:00:00:00:68:BE:A1:30:55:AA:AA:AA:B5:F3:06:00:00:00:00:00:00:EF:B7:CE:F6:55:AA:AA:AA:B0:F4:07:06:00:00:00:00:00:00:FA:4D:73:CF:55:AA:AA:AA:FF:04:01:04:69:84:3E:E6:55:AA:AA:AA:B5:F5:06:00:00:00:00:00:00:68:BE:A1:30:55
23:44:03	[D]	[uart_debug:114]	
>>> 6C:75:55:AA:AA:AA:FF:F3:01:F3:83:86:6C:75:55:AA:AA:AA:FF:F3:01:F3:83:86:6C:75:55:AA:AA:AA:FF:F4
23:44:03	[D]	[uart_debug:114]	
<<< AA:AA:AA:B5:F3:06:00:00:00:00:00:00:EF:B7:CE:F6:55:AA:AA:AA:B0:F4:07:06:00:00:00:00:00:00:FA:4D:73:CF:55:AA:AA:AA:B5:F5:06:00:00:00:00:00:00:68:BE:A1:30:55:AA:AA:AA:B5:F3:06:00:00:00:00:00:00:EF:B7:CE:F6:55:AA:AA:AA:B0:F4:07:06:00:00:00:00:00:00:FA:4D:73:CF:55:AA:AA:AA:B5:F5:06:00:00:00:00:00:00:68:BE:A1:30:55:AA:AA:AA:B5:F3:06:00:00:00:00:00:00:EF:B7:CE:F6:55:AA:AA:AA:B0:F4:07:06:00:00:00:00:00:00:FA:4D:73:CF:55
23:44:03	[D]	[uart_debug:114]	
>>> F6:01:F6:E7:B0:CD:03:55
23:44:04	[D]	[uart_debug:114]	
<<< AA:AA:AA:B5:F5:06:00:00:00:00:00:00:68:BE:A1:30:55:AA:AA:AA:B5:F3:06:00:00:00:00:00:00:EF:B7:CE:F6:55:AA:AA:AA:B0:F4:07:06:00:00:00:00:00:00:FA:4D:73:CF:55:AA:AA:AA:B5:F5:06:00:00:00:00:00:00:68:BE:A1:30:55:AA:AA:AA:B5:F3:06:00:00:00:00:00:00:EF:B7:CE:F6:55:AA:AA:AA:B0:F4:07:06:00:00:00:00:00:00:FA:4D:73:CF:55:AA:AA:AA:B5:F5:06:00:00:00:00:00:00:68:BE:A1:30:55
23:44:04	[D]	[uart_debug:114]	
<<< AA:AA:AA:B5:F3:06:00:00:00:00:00:00:EF:B7:CE:F6:55:AA:AA:AA:B0:F4:07:06:00:00:00:00:00:00:FA:4D:73:CF:55:AA:AA:AA:BA:F6:18:FD:A1:01:00:CE:42:02:00:03:00:DE:26:E8:03:01:04:03:04:00:01:00:00:00:00:5F:93:11:D8:55:AA:AA:AA:B0:F7:07:06:00:00:00:00:00:00:3F:71:FE:F6:55:AA:AA:AA:B5:F8:06:00:00:00:00:00:FF:34:44:A6:86:55:AA:AA:AA:BA:F6:18:FD:A1:01:00:CE:42:02:00:03:00:DE:26:E8:03:01:04:03:04:00:01:00:00:00:00:5F:93:11:D8:55:AA:AA:AA:B0:F7:07:06:00:00:00
23:44:04	[D]	[uart_debug:114]	

If I specify such a code

uart:
  # UART connected to the mainboard
 - tx_pin: GPIO1
   rx_pin: GPIO3
   baud_rate: 115200
   id: uart_mainboard
   debug:
     direction: TX
     after:
       bytes: 12
       timeout: 1s

then my messages will look like this. I press the buttons and I don't see a sequence, there is no such thing as numbers repeating

>>> A7:A7:F7:2D:55:AA:AA:AA:FF:4C:01:4C
00:04:51	[D]	[uart_debug:114]	
>>> B3:91:B0:E0:55:A7:A7:4C:01:B3:91:E0
00:04:51	[D]	[uart_debug:114]	
>>> 4F:50:7E:FF:7B:55:AA:AA:FF:4F:4F:50
00:04:51	[D]	[uart_debug:114]	
>>> FF:7B:55:9D:9D:DD:5A:0D:CD:55:AA:AA
00:04:51	[D]	[uart_debug:114]	
>>> AA:4F:01:50:7E:7B:55:AA:AA:4F:01:50
00:04:51	[D]	[uart_debug:114]	
>>> 7E:FF:55:AA:AA:AA:FF:4F:01:4F:50:7E
00:04:51	[D]	[uart_debug:114]	
>>> AA:AA:4F:01:50:7E:7B:55:A7:A7:01:4F
00:04:51	[D]	[uart_debug:114]	
>>> 9D:DD:5A:0D:CD:AB:FF:AA:AA:4F:01:50

@DivanX10
Copy link
Author

Tell me, how do you have a timer implemented? I turn on the coffee machine via the control panel, in the settings it is set to turn off after 180 minutes, and the esp turns off after 5-10 minutes. Is there any way to turn it off? Nothing is working for me yet and I'm trying to understand the sequence from the logs, but the coffee machine turns off and I have to turn it on. If I comment out this code, then I can't turn on the coffee machine and the control panel doesn't respond, but if I comment out, then the control panel works

philips_series_5400:
  display_uart: uart_display
  mainboard_uart: uart_mainboard
  power_pin: GPIO12
  id: philip

@DivanX10
Copy link
Author

I reconnected the esp8266 wemos so as not to interfere with the control of the coffee machine and at the same time you can track bytes, try to find at least some logic in this

image

For debugging, I chose only the display to see what commands will be when you click on the screen

uart:
  # UART connected to the display
 - tx_pin: GPIO15
   rx_pin: GPIO13
   baud_rate:  115200
   id: uart_display
   debug:
     direction: TX
     after:
       bytes: 12
       timeout: 100 ms

It looks like this and it's not clear how you can figure it out. Can someone tell me how this is done
image

@TillFleisch
Copy link
Owner

How did you prescribe to catch messages as shown in the screenshot? What code did you use?

I did something similar to the wiring configuration you've commented above and listened to what the machine does.

the esp turns off after 5-10 minutes

This should not happen. Make sure it has stable power. Maybe the coffee machine disables power for the display after a given time period.
With the new wiring configuration you can remove the custom component and use just the debug configuration. This may be more stable.

For debugging, I chose only the display to see what commands will be when you click on the screen

For debugging/reverse engineering the protocol I would recommended the following things:

  • choose a larger buffer/more bytes, this makes detecting patterns easier
  • remove the external component and use the uart dummy_receiver to reduce complexity
  • make sure the baud rate is correct

@DivanX10
Copy link
Author

I did as you said, turned everything off and left only the uart

uart:
  baud_rate: 115200
  rx_pin: GPIO3
  debug:
    dummy_receiver: true
    after:
      bytes: 12

And I saw something interesting, the data comes from the motherboard, not from the display
image

If I use the code below, then thanks to display_uart: uart_display I will have the right arrows displayed. Moreover, the wire I have is really connected to GPIO3, and nothing is connected to GPIO 13 and 15

external_components:
  - source:
      type: local
      path: components
    components: [philips_series_5400, philips_action_button, philips_power_switch, philips_status_sensor]

uart:
#UART connected to the mainboard
 - tx_pin: GPIO1
   rx_pin: GPIO3
   baud_rate: 115200
   id: uart_mainboard

# UART connected to the display
 - tx_pin: GPIO15
   rx_pin: GPIO13
   baud_rate:  115200
   id: uart_display
   debug:
    direction: TX
    dummy_receiver: true
    after:
      bytes: 12

philips_series_5400:
  display_uart: uart_display
  mainboard_uart: uart_mainboard
  power_pin: GPIO12
  id: philip

image

I have some questions.

  1. The data should be pouring from the display as well as from the motherboard, or is it displayed only when you press the buttons?
  2. Do I understand correctly that it is not necessary to use display_uart: uart_display and the data from the display should arrive when the uart is turned on and if there is no data, then the wrong wire is connected?
  3. How do you display data during debugging if you remove it?
philips_series_2200:
  display_uart: uart_display
  mainboard_uart: uart_mainboard
  power_pin: GPIO12
  id: philip

@DivanX10
Copy link
Author

And the records look interesting, until I understood their logic. I describe my observations

the coffee machine is turned on and ready to work
image_2023-04-28_23-00-40

Was in standby mode. As soon as I turned it off, everything became 00:00
image_2023-04-28_23-04-01

I clicked on the make coffee button, but I could not get such records again
image_2023-04-28_23-14-03

@TillFleisch
Copy link
Owner

The data should be pouring from the display as well as from the motherboard, or is it displayed only when you press the buttons?

On my ep2220 the display is constantly sending update requests to the Mainboard. If the machine is turned off, the display stops sending requests. This behaviour may be different on your machine.

Do I understand correctly that it is not necessary to use display_uart: uart_display and the data from the display should arrive when the uart is turned on and if there is no data, then the wrong wire is connected?

The display_uart: uart_display is required by this component as the uart reference is used to detect status updates. For reverse engineering the protocol you don't need the Philips component. You can use the uart debug functionality in combination with dummy receivers.

The wiring may be different on your machine. Thus the display and mainboard names may not be correct.
The data looks pretty scrambled to me (in between the marked regions).
Is the baud rate correct?
Maybe you can verify the data lines(and baud raute) with an oscilloscope.
I cannot really help you with reverse engineering the protocol tough, other than giving hints as to where to look :/

@DivanX10
Copy link
Author

I cannot really help you with reverse engineering the protocol tough, other than giving hints as to where to look :/

You give good advice and it gives me a reason to think, so you even help a lot 😄

@nighteagle1974
Copy link

Hello, i have also this project and bought a 5000 Philips - will give it try on Weekend with a ETH-32.

@DivanX10
Copy link
Author

DivanX10 commented May 2, 2023

How did I find out that the motherboards of the 2000/3000/5000 series coffee machines are identical, only different control panels, so this connection scheme is the same for everyone, only the transistor is questionable. My screen turns on even without a transistor. The main problem is to catch the data from the management and I can't do it.

image

Motherboards of coffee machines of different series 1000/2000/3000/5000

Motherboard of the 1000/2000/3000 series coffee machine

image
image

The motherboard of the 5000 series coffee machine

image_2023-04-30_12-18-22

Below I lay out the scheme for the board 1.9.30.330.00._v10

Circuit for the board 1.9.30.330.00._v10

image


Communication with the front panel

image


Sensors and valves

image


Brewing device

image


High voltage outputs

image


Power supply system

image

I'm trying to figure out from the logs what the command is for turning on coffee brewing and I still can't figure it out. I record by time and see the same records, but which one of them is responsible for the team, I do not see this

image_2023-05-02_16-11-52

We put ESP Home on Windows, then I created a shortcut, specified the command cmd.exe and the path to esphome
image

Copy the project from ESPHome to the ESPHome folder on Windows and run the project

esphome logs smart-coffee-philips.yaml > philips5400_protocol.txt

Logs are recorded on the computer in a text file
image

@nighteagle1974
Copy link

Your posted shematic "Front Panel" is same as "Sensors"?

@DivanX10
Copy link
Author

DivanX10 commented May 2, 2023

Your posted shematic "Front Panel" is same as "Sensors"?

What do you mean? If it's about sensors with this integration, then no, it doesn't work and the control doesn't work either. That's why I use debugging to find the commands in the logs that are responsible for sensors and controls, and at the moment nothing comes out for me. I haven't seen what the logs on the 2000 and 3000 series coffee machines look like to understand what to look for

@nighteagle1974
Copy link

Mean this: "Below I lay out the scheme for the board 1.9.30.330.00._v10"
The first Shematic "Communication with the front panel" is same as "Sensors and valves" so i want a look to the wiring to the LCD and its communication but i see only sensors.

@DivanX10
Copy link
Author

DivanX10 commented May 3, 2023

All circuits for the motherboard 1.9.30.330.00_v10.pdf

@nighteagle1974
Copy link

I have looked on your debbuged codes - it looks like the start and the stop of the message >> bytes not correct. On the first code overview this "Preamble AA AA etc" is on the beginning - the next is on the end or split in parts - looks like the Baudrate is not correct - it is more random when it starts... but it looks like it is a logic in this preamble. I will check this on weekend with my ozsilloskop - hope i find the time.

@nighteagle1974
Copy link

nighteagle1974 commented May 3, 2023

So is there some englich version instead of russia on the shematic-descriptors? Something is english and something not...

@DivanX10
Copy link
Author

DivanX10 commented May 3, 2023

This information is not found on the Internet. I received it in the Russian-speaking community in telegram, where one person received these schemes through his connections. So that's what I posted. You can use a translator

@nighteagle1974
Copy link

Wonder how do you can translate this shematic - it is a image on pdf and i can not mark any letters... or words to copy to google. Somebody here can read this?

@TillFleisch
Copy link
Owner

TillFleisch commented May 3, 2023

@nighteagle1974
Maybe Google lens can help translate images.

..

I think the schematics are great but not necessary. Knowing that the panel-communication part is the same on all devices is good.
Adding support for different machines basically comes down to reverse engineering the protocol used on the bus.

On the ep2220 the panel is constantly requesting status updates from the mainboard which responds with a status update.
This update includes the status of all LEDs on the display.
The status request message is essentially a list/map of all buttons and their states.
When a button is pressed the content changes.
You can find more information on the specific messages in the protocol.md file.

As @nighteagle1974 has pointed, the baud rate may be different. You can either verify with an oscilloscope or try other common baud rates.

@DivanX10
Copy link
Author

DivanX10 commented May 3, 2023

I ordered and am waiting for the Fnirsi-1013D oscilloscope, it will arrive one of these days, I will try

@nighteagle1974
Copy link

Have you read this about your Fnirsi-1013D
https://www.beis.de/Elektronik/FNIRSI-1013D/FNIRSI-1013D_de.html

@DivanX10
Copy link
Author

There is a similar problem on the EP2220. If the machine is turned on via command injection the mainboard turns on, but the communication stops as the display is responsibe for requesting updates (if I remember correcly).
Removing the power shortly from the display tricks it into booting and subsequently requesting updates.

Below are the working buttons for turning off and turning on the coffee machine. I can turn off the coffee machine, but I can't turn it on and it turns on exactly as you wrote. I can solder a transistor, but how do I make a switch then?

button:
  - platform: template
    name: "Turn off"
    on_press:
      - uart.write:
          id: uart_mainboard
          data: [0xAA, 0xAA, 0xAA, 0xFE, 0x00, 0x00, 0xC8, 0x87, 0x1B, 0x40, 0x55]

  - platform: template
    name: "Turn on"
    on_press:
      - uart.write:
          id: uart_mainboard
          data: [0xAA, 0xAA, 0xAA, 0xFE, 0x00, 0x00, 0xC8, 0x87, 0x1B, 0x40, 0x55]
      - delay: 1s  
      - uart.write:
          id: uart_mainboard
          data: [0xAA, 0xAA, 0xAA, 0xFF, 0x00, 0x01, 0x00, 0xAC, 0xE8, 0x5A, 0xE6, 0x55] 

This is how it starts when I click on the enable button, but then the activation process stops

image

@TillFleisch
Copy link
Owner

I would suggest using a momentary GPIO switch. The power-trick may not work on your machine, as the display (with the built in display) may be built differently.

@DivanX10
Copy link
Author

DivanX10 commented May 19, 2023

@TillFleisch

It's still worth a try, maybe it will work. I don't quite understand about the switch and there are questions. I'm not a programmer, so I apologize for the fact that I can't figure out how to do this correctly. Here is your component and power_pin: GPIO12 is used here. I can't turn off your component, because without it the coffee machine does not turn on at all, and the uart_mitm component is not suitable.

philips_series_2200:
  display_uart: uart_display
  mainboard_uart: uart_mainboard
  power_pin: GPIO12
  id: philip

Do I understand correctly that I can not use power_pin: GPIO12, but specify another pin, for example GPIO14? What should I do first, turn it off and then turn it on, or turn it on first and then turn it off? Did I write the code correctly? Could you write the right code?

switch:
  - platform: gpio
    pin: GPIO14
    id: switch_display
    name: "Display"
    on_turn_on:
    - delay: 500ms
    - switch.turn_off: relay

And more. I can't comment out power_pin: GPIO12, ESPHome starts reporting errors, so I can't delete it

image

@DivanX10
Copy link
Author

DivanX10 commented May 21, 2023

Connected the BS170 transistor. About the scheme in a little more detail will be below.

image
image

The output voltage is +5V, so it should be
image

I added a switch to control the transistor, which, in theory, should interrupt the power supply to the screen and feed it again. When we do this, we see from the logs that the coffee machine is trying to start, but this does not happen. The coffee machine does not turn on and the screen does not turn on either.

switch:
  - platform: gpio
    pin: GPIO14
    name: Display
    internal: False
    id: id_switch_display
    restore_mode: ALWAYS_ON
    on_turn_off:
    - delay: 500ms
    - switch.turn_on: id_switch_display

image

I created a button to turn on the coffee machine, through which commands are sent every 18.536000000ms, and then a command is sent to restart the display. The coffee machine does not turn on because there is no answer about the motherboard

I made a lot of different combinations for the test. Here is an example of two commands

Option 1

  - platform: template
    name: "Turn on 1"
    on_press:
      - uart.write:
          id: uart_mainboard
          data: [0xAA, 0xAA, 0xAA, 0xFE, 0x00, 0x00, 0xC8, 0x87, 0x1B, 0x40, 0x55, 0xAA, 0xAA, 0xAA, 0xFF, 0x00, 0x01, 0x00, 0xAC, 0xE8, 0x5A, 0xE6, 0x55]
      - delay: !lambda "18.536 ms;"
      - uart.write:
          id: uart_mainboard
          data: [0xAA, 0xAA, 0xAA, 0x93, 0x00, 0x01, 0x01, 0x81, 0x90, 0xAD, 0xE0, 0x55]
      - delay: !lambda "18.536;"
      - switch.turn_off: id_switch_display

Option 2

  - platform: template
    name: "Turn on 2"
    on_press:
      - uart.write:
          id: uart_mainboard
          data: [0xAA, 0xAA, 0xAA, 0xFE, 0x00, 0x00, 0xC8, 0x87, 0x1B, 0x40, 0x55]
      - delay: !lambda "return 18.536;"
      - switch.turn_off: id_switch_display

Where did I get the delay of 18.536 ms? When I was taking data through a logic analyzer and viewing data through the Pulse View program, I decided to measure the time between sending a command from the screen and receiving a response from the motherboard, and this time was 18.536000000 ms

image

When we press the touch button on the coffee machine, I see the following data

The command being sent is AA:AA:AA:FE:00:00:C8:87:1B:40:55:AA:AA:AA:FF:00:01:00:AC:E8:5A:E6:55
image

Answer AA:AA:AA:FE:00:00:C8:87:1B:40:55 from the motherboard after 18.536000000 ms and after that the coffee machine turns on
image

This is the data from the logs when the coffee machine is turned on from the touch button and I highlighted in red where the screen sends a command and receives a response from the motherboard, and in blue, after a successful greeting, the coffee machine turns on

image

I tried to repeat this case, but it turns out unsuccessfully, the coffee machine does not turn on, because it does not respond. When sending a command from ESPHome AA:AA:AA:FE:00:00:C8:87:1B:40:55:AA:AA:AA:FF:00:01:00:AC:E8:5A:E6:55, then there is no response from the motherboard
image

Now about the scheme itself. Where did this data come from? I took it from here
Motherboard diagram 1.9.30.330.00_v10.pdf

image

Based on this scheme, I redid the wiring pinout scheme.
image

I decided to check the 4 wire that WakeUP, assuming that he could somehow turn on the coffee machine and decided to measure the signals through an oscilloscope and a logic analyzer, and that's what I saw.

Voltage up to 200mv is supplied only when the coffee machine is turned on, and when the coffee machine is turned off, there is no voltage

Measurement through an oscilloscope

I managed to fix a signal where the voltage is applied up to 200 mv

image
image
image
image
image
image
image
image
image

Measurement of data through a logic analyzer

As you can see, there is no data, there are only 0, which means that only voltage up to 200mv is supplied via 4 wires

image
image
image

In general, I can't figure out how to make the coffee machine turn on. I will be glad if you offer options on how to do this.

@DivanX10
Copy link
Author

DivanX10 commented May 21, 2023

If you do not send commands, but simply restart the screen with a switch, then this is what will happen. The coffee machine does not turn on
Reloading the screen.txt


According to my observations from all logs, when we turn on the coffee machine with the touch button, it looks like this

The control panel sends the command

»»» AA:AA:AA:FE:00:00:C8:87:1B:40:55:AA:AA:AA:FF:00:01:00:AC:E8:5A:E6:55

next, the motherboard should answer us as well

««« AA:AA:AA:FE:00:00:C8:87:1B:40:55:AA:AA:AA:FF:00:01:00:AC:E8:5A:E6:55

then there is an exchange

>>> 00:AA:AA:AA:FE:00:00:C8:87:1B:40:55
<<< 00:AA:AA:AA:FE:00:00:C8:87:1B:40:55

and the final stage, after that the coffee machine starts to turn on

>>> AA:AA:AA:93:00:01:01:81:90:AD:E0:55:AA:AA:AA:93:00:01:01:81:90:AD:E0:55
<<< AA:AA:AA:93:00:01:01:81:90:AD:E0:55:AA:AA:AA:93:00:01:01:81:90:AD:E0:55

@TillFleisch
Copy link
Owner

Here are a couple ideas in no particular order:

Is there something happening on the RX2/TX2 lines? This could be some sort of debug port.

Where is the wake up Signal coming from? Does the Mainboard wake up the display or vice versa?

In the image where you tried to repeat the turn on commands the last one is not duplicated. Multiple copies may be necessary.

Can you verify that the transistors removes the power using you switch configuration on gpio14?
This component requires a pin to be configured which is used for flipping the transistor.

The response message of the Mainboard starts after 18.5ms.
Assuming the timing is always the same, you are sending the your second message at the same time at which the Mainboard is sending its first request.
You should send the second message from the display after the first acknowledgement of the Mainboard has arrived entirely.
The delay may be different from run to run. I would recommend waiting for the acknowledgement and then sending the second command to ensure the delay is correct.

You could also choose a larger delay (22 ms for instance). If the Mainboard isn't to picky about the timing this may work as well.

@DivanX10
Copy link
Author

Is there something happening on the RX2/TX2 lines? This could be some sort of debug port.

Judging by the scheme, this is a programmable port, I will check it and try to look through the analyzer


Where is the wake up Signal coming from? Does the Mainboard wake up the display or vice versa?

It comes from both sides, both from the screen and from the motherboard. If you break the wire, then the coffee machine turns on, so it put me in doubt that this wire makes any sense. I broke the wire and measured both from the screen and from the motherboard and they both showed the same voltage up to 200 mv


Can you verify that the transistors removes the power using you switch configuration on gpio14?
This component requires a pin to be configured which is used for flipping the transistor.

Yes, it turns off the power. If I turn off the transistor, there will be no voltage and the coffee machine will not turn on through the touch button


As for the rest of the questions, they are still open, as I am going through various options for sending commands. I know that there are only 4 of them

AA:AA:AA:FE:00:00:C8:87:1B:40:55:AA:AA:AA:FF:00:01:00:AC:E8:5A:E6:55
AA:AA:AA:FE:00:00:C8:87:1B:40:55
AA:AA:AA:FF:00:01:00:AC:E8:5A:E6:55
AA:AA:AA:93:00:01:01:81:90:AD:E0:55

@nighteagle1974
Copy link

If you break the wire, then the coffee machine turns on, so it put me in doubt that this wire makes any sense. I broke the wire and measured both from the screen and from the motherboard and they both showed the same voltage up to 200 mv<

So it looks like this wire is an Interrupt-Wire? Can you log this wire all the time on your Analyzer?

@DivanX10
Copy link
Author

If you break the wire, then the coffee machine turns on, so it put me in doubt that this wire makes any sense. I broke the wire and measured both from the screen and from the motherboard and they both showed the same voltage up to 200 mv<

So it looks like this wire is an Interrupt-Wire? Can you log this wire all the time on your Analyzer?

It is unlikely that we will see something with a logic analyzer, since the logic analyzer does not measure the voltage of the controlled signals, the logic analyzer shows in what state a particular node is in, in the state of logical 1 or logical 0. There are no controlled signals on the 4th wire, so it makes no sense to measure with a logic analyzer, if only with an oscilloscope to see what will happen at that moment, when the coffee machine goes into standby mode. When the coffee machine goes into standby mode, the voltage drops.

I disassembled the control panel and examined it, and also removed the sticker from the chip and found out what kind of chip. I published the details here

@DivanX10
Copy link
Author

DivanX10 commented May 24, 2023

I figured out a bit about the bytes and found the bytes responsible for the sensors of the drink counter. Here's what happened

image
image

AA:AA:AA:FF:B0:01:B0:30:A5:65:E8:55 - Drinks counter (Cappuccino) - number 65
AA:AA:AA:FF:CB:01:CB:35:8A:16:77:55 - Drink counter (Latte ma.) - digit 16
AA:AA:AA:FF:2D:01:2D:6A:61:10:93:55 - Drinks counter (Hot) - digit 10
AA:AA:AA:FF:B4:01:B4:F5:C9:01:E8:55 - Drinks counter (Coffee with mo.) - digit 01
AA:AA:AA:FF:18:01:18:32:82:03:E7:55 - Drink counter (Espresso) - digit 03
AA:AA:AA:FF:36:01:36:17:E4:06:09:55 - Drinks counter (Dairy) - digit 6
AA:AA:AA:FF:23:01:23:67:61:36:7E:55 - The drinks counter (Coffee with m.) is the number 36
AA:AA:AA:FF:D1:01:D1:E9:55:C5:9B:55 - Drinks counter (Express) - digit 197
AA:AA:AA:FF:66:01:66:53:9B:D1:0E:55 - Beverage counter (America.) - digit 521
AA:AA:AA:FF:A5:01:A5:40:20:55:9F:55 - Drinks counter (Coffee) - number 55

image

Now I have another problem, I do not know how to write sensors with variables for bytes in esphome. Bytes that carry information on the coffee counter, they change as we make a cup of coffee and it is wrong to use static conditions.

Now my code looks like this

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


 - 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: BOTH
     dummy_receiver: false
     sequence: 
      - lambda: |-
          UARTDebug::log_hex(direction, bytes, ':');
            if (bytes[0]==0xAA && bytes[3]==0xFF && bytes[4]==0xD1 && bytes[5]==0x01 && bytes[9]==0xC5 && bytes[11]==0x55) { id(idDrinkscountEspress).publish_state("197"); }
            else if (bytes[0]==0xAA && bytes[3]==0xFF && bytes[4]==0x18 && bytes[5]==0x01 && bytes[9]==0x03 && bytes[11]==0x55) { id(idDrinkscounterEspresso).publish_state("03"); }
            else if (bytes[0]==0xAA && bytes[3]==0xFF && bytes[4]==0x23 && bytes[5]==0x01 && bytes[9]==0x36 && bytes[11]==0x55) { id(idDrinkscounterCoffeeMilk).publish_state("36"); }
            else if (bytes[0]==0xAA && bytes[3]==0xFF && bytes[4]==0xA5 && bytes[5]==0x01 && bytes[9]==0x55 && bytes[11]==0x55) { id(idDrinkscounterCoffee).publish_state("55"); }
            else if (bytes[0]==0xAA && bytes[3]==0xFF && bytes[4]==0x66 && bytes[5]==0x01 && bytes[9]==0xD1 && bytes[11]==0x55) { id(idDrinkscounterAmerica).publish_state("521"); }


text_sensor:
##### Drinks counter
#Drink counter: Espresso 1
  - platform: template
    id: idDrinkscountEspress
    name: "Espress counter"
    update_interval: 30s

#Drink counter: Espresso 2
  - platform: template
    id: idDrinkscounterEspresso
    name: "Espresso counter"
    update_interval: 30s

#Beverage Counter: Coffee
  - platform: template
    id: idDrinkscounterCoffee
    name: "Coffee Counter"
    update_interval: 30s

#Beverage counter: Coffee with milk (Coffee with m.)
  - platform: template
    id: idDrinkscounterCoffeeMilk
    name: "Coffee Counter with Milk"
    update_interval: 30s

#Drinks counter: America.
  - platform: template
    id: idDrinkscounterAmerica
    name: "Counter Americano"
    update_interval: 30s

Below I made a config with the iron-specified bits. For example bytes[9]==0xC5 is the number 197 if translated from HEX to a number. So the data bytes[7]==XX && bytes[8]==XX && bytes[9]==XX && bytes[10]==XX change here, but it needs to be displayed in the sensor as numbers

That's what GhatGPT offers me, utter nonsense. I will give examples to understand why I don't trust GhatGPT

text_sensor:
  - platform: template
    id: idDrinkscounterEspresso1
    name: "Drink counter: Espresso 1"
    update_interval: 60s
    lambda: |-
      if (id(uart_mainboard).state.length() >= 12 &&
          id(uart_mainboard).state[0] == 0xAA &&
          id(uart_mainboard).state[3] == 0xFF &&
          id(uart_mainboard).state[9] == 0xE0 &&
          id(uart_mainboard).state[11] == 0x55) {
        char byte4Str[3];
        snprintf(byte4Str, sizeof(byte4Str), "%02X", id(uart_mainboard).state[4]);
        return std::string(byte4Str);
      } else {
        return std::string("");
      }
text_sensor:
  - platform: template
    id: idDrinkscounterEspresso1
    name: "Drink counter: Espresso 1"
    update_interval: 60s
    lambda: |-
      if (bytes[0] == 0xAA && bytes[3] == 0xFF && bytes[9] == 0xE0 && bytes[11] == 0x55) {
        char byte4Str[3];
        snprintf(byte4Str, sizeof(byte4Str), "%02X", bytes[4]);
        return std::string(byte4Str);
      } else {
        return std::string("");
      }

and when you try to upload the firmware, I get this error

/config/esphome/esp32-smart-coffee-philips.yaml: In lambda function:
/config/esphome/esp32-smart-coffee-philips.yaml:135:11: error: 'bytes' was not declared in this scope
       if (bytes[0] == 0xAA && bytes[3] == 0xFF && bytes[9] == 0xE0 && bytes[11] == 0x55) {
           ^~~~~
/config/esphome/esp32-smart-coffee-philips.yaml:135:11: note: suggested alternative: 'byte'
       if (bytes[0] == 0xAA && bytes[3] == 0xFF && bytes[9] == 0xE0 && bytes[11] == 0x55) {
           ^~~~~
           byte
/config/esphome/esp32-smart-coffee-philips.yaml:142:3: warning: control reaches end of non-void function [-Wreturn-type]
 
   ^
*** [/data/esp32-smart-coffee-philips/.pioenvs/esp32-smart-coffee-philips/src/main.cpp.o] Error 1
========================== [FAILED] Took 7.20 seconds ==========================

@DivanX10
Copy link
Author

I managed to partially decrypt the protocol. I found almost all the sensors and they work.

image

I wrote the code as best I could, I can't do more, since I don't know these lambdas and I can't use custom sensors. Those interested can use this data and write a working project. You can read how I decoded the protocol here. I tried to describe in detail how to search for the necessary bytes

Function Description

AA:AA:AA:83 - at the moment it is unclear what it is
AA:AA:AA:91 - at the moment it is unclear what it is
AA:AA:AA:93 - at the moment it is unclear what it is
AA:AA:AA:B0 - sensors of water container, tray, coffee grounds, coffee preparation statuses
AA:AA:AA:B5 - counters for making coffee and milk drinks
AA:AA:AA:BA - apparently service information, firmware version, date
AA:AA:AA:BB - rarely comes across
AA:AA:AA:FF - data from the control panel
AA:AA:AA:FE - turning off the coffee machine

substitutions:
  board_name: ESP32 Smart Coffee Philips
  node_name: esp32-smart-coffee-philips

esphome:
  name: ${node_name}
  friendly_name: esp32-smart-coffee-philips
  comment: ESP32 Smart Coffee Philips

esp32:
  board: esp32dev
  framework:
    type: arduino

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  fast_connect: on
  reboot_timeout: 10min
  ap:
    ssid: ESP SmartCoffeePhilips
    password: !secret ap_esp_password

captive_portal:

web_server:
  port: 80

logger:
  level: DEBUG
  baud_rate: 0

ota:
  password: "esphome"

api:
  encryption:
    key: !secret api_key


external_components:
  - source: github://TillFleisch/ESPHome-Philips-Smart-Coffee@main


uart:
 - 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: TX
     dummy_receiver: false


 - 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: TX
     dummy_receiver: false
     sequence: 
      - lambda: |-
          UARTDebug::log_hex(direction, bytes, ':');
          //AA:AA:AA:B0
          if (bytes[0]==0xAA && bytes[3]==0xB0 && bytes[6]==0x06 && bytes[9]==0x00) { 
            id(idWater).publish_state("There is water");
            id(idCoffeeGroundsContainer).publish_state("Inserted");
            id(idMakingCoffee).publish_state("Choose a drink");
            }
          //AA:AA:AA:B0 "Took out the container with water"
          else if (bytes[0]==0xAA && bytes[3]==0xB0 && bytes[6]==0x0E && bytes[9]==0x40) { id(idWater).publish_state("There is no water"); }
          //AA:AA:AA:B0 "Removed the pallet"  
          else if (bytes[0]==0xAA && bytes[3]==0xB0 && bytes[6]==0x0E && bytes[9]==0x80) { id(idCoffeeGroundsContainer).publish_state("Retrieved"); }

          //AA:AA:AA:B0 "The pallet and the container with water were taken out"
          else if (bytes[0]==0xAA && bytes[3]==0xB0 && bytes[6]==0x0E && bytes[9]==0xC0) { 
            id(idWater).publish_state("There is no water"); 
            id(idCoffeeGroundsContainer).publish_state("Retrieved");
            }

          //AA:AA:AA:B0 "Making coffee"
          else if (bytes[0]==0xAA && bytes[3]==0xB0 && bytes[5]==0x07 && bytes[6]==0x0C && bytes[7]==0x01) { id(idMakingCoffee).publish_state("Enjoy (01)"); }
          else if (bytes[0]==0xAA && bytes[3]==0xB0 && bytes[5]==0x07 && bytes[6]==0x07 && bytes[7]==0x0E) { id(idMakingCoffee).publish_state("Pause (0E)"); }
          else if (bytes[0]==0xAA && bytes[3]==0xB0 && bytes[5]==0x07 && bytes[6]==0x07 && bytes[7]==0x0D) { id(idMakingCoffee).publish_state("Grinding grains (0D)"); }
          else if (bytes[0]==0xAA && bytes[3]==0xB0 && bytes[5]==0x07 && bytes[6]==0x07 && bytes[7]==0x10) { id(idMakingCoffee).publish_state("Pour milk (10)"); }
          else if (bytes[0]==0xAA && bytes[3]==0xB0 && bytes[5]==0x07 && bytes[6]==0x07 && bytes[7]==0x11) { id(idMakingCoffee).publish_state("Pour coffee (11)"); }
          else if (bytes[0]==0xAA && bytes[3]==0xB0 && bytes[5]==0x07 && bytes[6]==0x07 && bytes[7]==0x12) { id(idMakingCoffee).publish_state("12"); }
          else if (bytes[0]==0xAA && bytes[3]==0xB0 && bytes[5]==0x07 && bytes[6]==0x07 && bytes[7]==0x13) { id(idMakingCoffee).publish_state("Creating pressure for milk (13)"); }
          else if (bytes[0]==0xAA && bytes[3]==0xB0 && bytes[5]==0x07 && bytes[6]==0x07 && bytes[7]==0x14) { id(idMakingCoffee).publish_state("14"); }
          else if (bytes[0]==0xAA && bytes[3]==0xB0 && bytes[5]==0x07 && bytes[6]==0x07 && bytes[7]==0x15) { id(idMakingCoffee).publish_state("15"); }
          
          //AA:AA:AA:B5 "Status 1"
          if (bytes[0]==0xAA && bytes[3]==0xB5 && bytes[5]==0x06 && bytes[10]==0x00 && bytes[11]==0x00) { id(idStatusUnknown1).publish_state("00"); }
          else if (bytes[0]==0xAA && bytes[3]==0xB5 && bytes[5]==0x06 && bytes[10]==0x00 && bytes[11]==0x0B) { id(idStatusUnknown1).publish_state("0B"); }
          else if (bytes[0]==0xAA && bytes[3]==0xB5 && bytes[5]==0x06 && bytes[10]==0x00 && bytes[11]==0xE6) { id(idStatusUnknown1).publish_state("E6"); }
          else if (bytes[0]==0xAA && bytes[3]==0xB5 && bytes[5]==0x06 && bytes[10]==0x00 && bytes[11]==0x80) { id(idStatusUnknown1).publish_state("80"); }
          else if (bytes[0]==0xAA && bytes[3]==0xB5 && bytes[5]==0x06 && bytes[10]==0x00 && bytes[11]==0xCB) { id(idStatusUnknown1).publish_state("CB"); }
          else if (bytes[0]==0xAA && bytes[3]==0xB5 && bytes[5]==0x06 &&& bytes[10]==0x00 & bytes[11]==0xFF) { id(idStatusUnknown1).publish_state("FF"); }
          else if (bytes[0]==0xAA && bytes[3]==0xB5 && bytes[5]==0x06 && bytes[10]==0x00 && bytes[11]==0xA0) { id(idStatusUnknown1).publish_state("A0"); }
          
          //AA:AA:AA:B5 "Status 2"
          else if (bytes[0]==0xAA && bytes[3]==0xB5 && bytes[5]==0x06 && bytes[10]==0x00) { id(idStatusUnknown2).publish_state("00"); }
          else if (bytes[0]==0xAA && bytes[3]==0xB5 && bytes[5]==0x06 && bytes[10]==0x01) { id(idStatusUnknown2).publish_state("01"); }



philips_series_2200:
  display_uart: uart_display
  mainboard_uart: uart_mainboard
  power_pin: GPIO12
  id: philip


text_sensor:
  - platform: template
    id: idWater
    name: "Water"
    update_interval: 10s

  - platform: template
    id: idCoffeeGroundsContainer
    name: "Coffee Grounds Container"
    update_interval: 10s

  - platform: template
    id: idUnknown
    name: "Unknown"
    update_interval: 10s

  - platform: template
    id: idStatusCoffee
    name: "Status Coffee"
    update_interval: 10s

  - platform: template
    id: idMakingCoffee
    name: "Stages of coffee preparation"
    update_interval: 10s


button:
  - platform: restart
    name: Restart
    icon: mdi:restart

  - platform: template
    name: "Turn off" 
    on_press:
      - uart.write:
          id: uart_mainboard
          data: [0xAA, 0xAA, 0xAA, 0xFE, 0x00, 0x00, 0xC8, 0x87, 0x1B, 0x40, 0x55] #AA:AA:AA:FE:00:00:C8:87:1B:40:55

@DivanX10 DivanX10 mentioned this issue May 27, 2023
@DivanX10
Copy link
Author

Hooray 🥳, I found how to operate a coffee machine. To make coffee, we look in the logs for the address and functions that are listed below, this is the command to start making coffee. Start recording in the log, select the parameters we need (strength, amount of water, number of cups) to make coffee and run, then we find the command in the logs. Why is that? Because then we run what we set in the settings, so you can create a lot of different scripts with different parameters.

AA AA AA 93 
AA AA AA 90 
AA AA AA 91

The commands must go strictly in this order, although they may be scattered in the logs, but in ESPHome we specify in this sequence

AA AA AA 93 07 01 01 04 86 E2 E5 55 
AA AA AA 90 08 0A 00 02 00 02 03 00 1E 00 00 00 98 80 81 70 55
AA AA AA 91 09 01 03 A9 02 7B AB 55
This is how the commands in the logs look like

image
image
image

Example of a button to run a command from a log in ESPHome

button:
  - platform: template
    name: "Espresso X1" 
    on_press:
      - uart.write:
          id: uart_mainboard
          data: [0xAA, 0xAA, 0xAA, 0x93, 0x07, 0x01, 0x01, 0x04, 0x86, 0xE2, 0xE5, 0x55]
      - uart.write:    
          id: uart_mainboard
          data: [0xAA, 0xAA, 0xAA, 0x90, 0x08, 0x0A, 0x00, 0x02, 0x00, 0x02, 0x03, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x98, 0x80, 0x81, 0x70, 0x55]
      - uart.write:    
          id: uart_mainboard
          data: [0xAA, 0xAA, 0xAA, 0x91, 0x09, 0x01, 0x03, 0xA9, 0x02, 0x7B, 0xAB, 0x55]

@Sandst4
Copy link

Sandst4 commented Nov 26, 2023

@DivanX10 Thanks for your awesome work! I've just received my 5400 and can't wait to connect everything. I appreciate the work you have put into the 3d print for a part that will keep the cleaning water away from the cup. However, I was wondering if you ever tried to capture the command that is send from the control panel to the main board when the on button is pressed not to long after a shutdown. Since if the temperature is still high the machine will startup without a cleaning cycle.

If I understand correctly from @TillFleisch this works for the 2200 version. I've tested and if I turn the 5400 on after waiting not to long after a shutdown it will indeed start without a cleaning cycle, so this should be possible. Would be great if you could help.
I'm still waiting for some parts before I can connect everything but do appreciate your feedback/insights,

Thanks!

@DivanX10
Copy link
Author

Thanks for your awesome work! I've just received my 5400 and can't wait to connect everything. I appreciate the work you have put into the 3d print for a part that will keep the cleaning water away from the cup. However, I was wondering if you ever tried to capture the command that is send from the control panel to the main board when the on button is pressed not to long after a shutdown. Since if the temperature is still high the machine will startup without a cleaning cycle.

I have tried many times to find a way to turn on the coffee machine remotely without using a relay to turn on the coffee machine. Then I was helped with this question by a person who is well versed in electronics and he is also a C++ programmer. He wrote the code to control the coffee machine and thanks to him a project appeared.

https://community.home-assistant.io/t/esp-smart-offee-machine-philips-5400-series/568545/35?u=divanx10

I was offered this connection option, but I didn't try it, because I made the relay before I met him and before he offered me this option
https://community.home-assistant.io/t/esp-smart-offee-machine-philips-5400-series/568545/86?u=divanx10

@Sandst4
Copy link

Sandst4 commented Nov 27, 2023

Thanks! I'll give it a try once all parts have arrived

@DivanX10
Copy link
Author

Thanks! I'll give it a try once all parts have arrived

If you manage to turn on/off remotely and save the operation of the touch button of the coffee machine, let me know

@Sandst4
Copy link

Sandst4 commented Dec 18, 2023

I'm connecting an ESP32 using the below mentioned diagram as mentioned on this project with an IRLZ44N Mosfet. Of course the gpio pins are different.

image

The code you (@DivanX10 ) have for power on and off at the moment (for the 5400) is this:

#Turn on the coffee machine
  - platform: template
    name: "Power ON"
    icon: mdi:power
    on_press:
      - switch.turn_on: idRelaySwitch
      - delay: 1s
      - switch.turn_off: idRelaySwitch

#Turn off the coffee machine
  - platform: template
    name: "Power OFF"
    icon: mdi:power
    on_press:
      #Turn on the relay
      - switch.turn_on: idRelaySwitch
      #Delay of 2 seconds
      - delay: 2s
      #Turn off the relay
      - switch.turn_off: idRelaySwitch

#Additional switch-off button of the coffee machine, in case it does not turn off via the main switch-off button
  - platform: template
    name: "Power OFF AA:FE"
    icon: mdi:power
    on_press:
      #We send a command to turn off the coffee machine
      - lambda: |-
          {
            uint8_t data[]={0xFE,0,0};
            id(philip)->send_packet_main(data,3);
          }

I need to change the power on to send the packets with and without cleaning cycle. For this project (the 2200) the code used is this (written bij @TillFleisch ):

            void Power::write_state(bool state)
            {
                if (state)
                {
                    // Send pre-power on message
                    for (unsigned int i = 0; i <= MESSAGE_REPETITIONS; i++)
                        mainboard_uart_->write_array({0xD5, 0x55, 0x0A, 0x01, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0E, 0x12});

                    // Send power on message
                    if (cleaning_)
                    {
                        // Send power on command with cleaning
                        for (unsigned int i = 0; i <= MESSAGE_REPETITIONS; i++)
                            mainboard_uart_->write_array({0xD5, 0x55, 0x02, 0x01, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x38, 0x15});
                    }
                    else
                    {
                        // Send power on command without cleaning
                        for (unsigned int i = 0; i <= MESSAGE_REPETITIONS; i++)
                            mainboard_uart_->write_array({0xD5, 0x55, 0x01, 0x01, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x25, 0x27});
                    }

                    mainboard_uart_->flush();

                    // Perform power trip (invert state twice)
                    power_pin_->digital_write(!power_pin_->digital_read());
                    delay(power_trip_delay_);
                    power_pin_->digital_write(!power_pin_->digital_read());
                }
                else
                {
                    // Send power off message
                    for (unsigned int i = 0; i <= MESSAGE_REPETITIONS; i++)
                        mainboard_uart_->write_array({0xD5, 0x55, 0x00, 0x01, 0x02, 0x00, 0x02, 0x01, 0x00, 0x00, 0x1D, 0x3B});
                    mainboard_uart_->flush();
                }

                // The state will be published once the display starts sending messages
            }

TillFleisch states the following on how he found the startup with and without cleaning commands:

I found out about the cleaning/non-cleaning power-on by logging the communication using the UART debug functionality.
The machine skips the cleaning cycle, if it has been pre-heated recently (the display unit issues the command, therefore it also decides when to perform cleaning).

@DivanX10 Could you help me in the right direct how to implement this for the 5400 in your code? How would you go on finding these packets for startup without cleaning since the 5400 seems to have a different protocol? I don't mind testing it out if you could help with finding the command and giving an example on how to adjust your power on/off code.

Thanks!

@DivanX10
Copy link
Author

I described all my actions on the Home Assistant forum. He also showed how to decrypt the protocol. I described in detail all the protocols on the ESP Philips 5400. You will not be able to turn it on via mosfet and this method is not suitable for the 5400. To wake up the coffee machine, you must first apply voltage to the chip, and after the processor wakes up, it begins to communicate with the motherboard. When we pull the mosfet, we wake up the motherboard, but the chip itself continues to sleep and the coffee machine does not turn on.

I used this code for a relay to simulate pressing a touch button. I empirically determined the time to turn on and off the coffee machine. If you touch the touch button that turns on the coffee machine with your finger and hold it for more than 2 seconds, it will reset to default settings; if you hold it for 1 second, it turns on; if you hold it for 2 seconds, it turns off.

#Turn on the coffee machine
  - platform: template
    name: "Power ON"
    icon: mdi:power
    on_press:
      - switch.turn_on: idRelaySwitch
      - delay: 1s
      - switch.turn_off: idRelaySwitch

#Turn off the coffee machine
  - platform: template
    name: "Power OFF"
    icon: mdi:power
    on_press:
      #Turn on the relay
      - switch.turn_on: idRelaySwitch
      #Delay of 2 seconds
      - delay: 2s
      #Turn off the relay
      - switch.turn_off: idRelaySwitch

@Sandst4
Copy link

Sandst4 commented Dec 20, 2023

@DivanX10 Thanks for the quick reply. I have missed that information while reading through your posts. I might go experimenting a bit with it in January. In the mean time, using the relay switch will that break the manual usage of the power button? Or can you still use the power button as normal after implementing that?

Thanks!

@DivanX10
Copy link
Author

@DivanX10 Thanks for the quick reply. I have missed that information while reading through your posts. I might go experimenting a bit with it in January. In the mean time, using the relay switch will that break the manual usage of the power button? Or can you still use the power button as normal after implementing that?

Thanks!

I can't turn on the coffee machine via a physical button. Having soldered a wire to a resistor R110 with a nominal value of 4.7 kOhm, I inadvertently tore off the resistor along with the track. Somehow I managed to restore the track and solder a softer wire. I damaged resistor R110, so I replaced it with another 10 kOhm one that I had on hand. I'm not very good at soldering and I'm afraid of ruining everything again. That's why I don't want to touch the board. I was offered a scheme where you can keep the physical button working and at the same time be able to turn it on remotely, but this is in theory, and I have not tested it, and no one has yet unsubscribed whether this scheme works or not. So I don't know. The diagram can be found here

@Stenan11
Copy link

изображение

23.04.2023 приобрел новую кофемашину Philips EP5444 /90 серии 5400 LatteGo и собираюсь повторить ваш опыт. Отзыв гарантии меня не пугает, я могу отремонтировать ее сам, если с ней что-то случится. Я хотел бы уточнить насчет подключения дисплея к ESP8266 WeMos D1 Mini. Вы пишете о транзисторе, но не указали, какой транзистор подключать.

изображение

Какой транзистор мне следует подключить? У меня есть транзистор TIP120

изображение

Вот так выглядит проводка к дисплею, как у вас, которым можно управлять удаленно. Как вы думаете, это сработает?

изображение

Правильно ли я понимаю, что необходимо отсоединить этот кабель от дисплея, подсоединить часть проводов к ESP8266 WeMos D1 Mini и уже подсоединить проводку от ESP8266 WeMos D1 Mini к разъему?

IMG_20240324_225532
Й

@Stenan11
Copy link

Uploading IMG_20240324_225532.jpg…
Привет 👋

@DivanX10
Copy link
Author

  1. A transistor is not needed here at all
  2. ESP8266 WeMos D1 Mini is rather weak and will not cope with fast data processing, since the protocol involves a counter. ESP32 only
  3. Cut the wire in the middle so that it is convenient to solder the wires and extend them to connect to the ESP32
  4. You can view the finished project here

  1. Транзистор здесь не нужен вообще
  2. ESP8266 WeMos D1 Mini слабоват, не справится с быстрой обработкой данных, так как в протоколе задействован счетчик. Только ESP32
  3. Провод разрезать по середине, чтобы удобно было подпаять провода и нарастить их для подключения к ESP32
  4. С готовым проектом можете ознакомиться здесь

@Stenan11
Copy link

Stenan11 commented Jun 2, 2024

Привет 👋Screenshot_20240602_142151.png

Что?

@DivanX10
Copy link
Author

DivanX10 commented Jun 2, 2024

I don't know what kind of connector it is. You can try to find out what kind of connector it is from a PHILIPS service center or contact PHILIPS technical support if they tell you, but, as usual, PHILIPS will recommend contacting a service center, and the service center is unlikely to tell you what kind of connector it is.

image

@TillFleisch
Copy link
Owner

The more interesting "connector"/pads would be the one on the left labeled TX/RX/GND/5V.
Could be a debugging/programming port for some chip on the PCB.
Maybe, this can provide more fine-grained access.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants