Smart Coffee Machine

I’ve had an Expressi Cube coffee machine, available from Aldi in Australia, for about 6 months and finally got around to making it ‘Smart’ and integrating into HA today.

I used a Wemos D1 Mini with ESPHome and 4066 IC for control, and a HC-SR04 Ultrasonic Sensor to measure the water level in the tank, all powered by a Hi-Link HLK-PM01.

Everything fits well inside the machine, the only difference visible from the outside is the cable from the main body to the lid of the water tank for the sensor.

Still looks a bit messy on proto-board but planning to do a small batch of PCB’s.

I’ve set up an automation tied to my alarm clock that turns the machine on, wakes it up, and does the preparation rinse each morning, I can also see the water level and control it manually from my HA interface.

6 Likes

Hello , can you tell more about wiring? How you hacket buttons small , big cup and etc?

If you take off the left side of the machine, 2 torx screws underneath and slide up, there are 7 wires (6 white and 1 black) that come from the control buttons to a 7-pin JST connector on the main board.

Going left to right on the JST connector, black wire being on the right they are;

  1. Small button
  2. Large button
  3. Rinse button
  4. Common
  5. Rinse LED
  6. Large LED
  7. Small LED (Black wire)

I haven’t connected any of the LED wires, I just use the 4066 IC to ground the button wires to the common when triggered by the D1 mini.

This is the esphome config I use.

substitutions:
  devicename: coffee_machine_d1
  upper_devicename: Coffee Machine D1
  hotspot: Coffee Machine D1 WiFi
  password: !secret psk
  static_ip: 10.0.1.44

esphome:
  name: $devicename
  platform: ESP8266
  board: d1_mini_lite

wifi:
  ssid: !secret ssid
  password: !secret psk

  manual_ip:
    static_ip: $static_ip
    gateway: 10.0.1.1
    subnet: 255.255.255.0

  ap:
    ssid: $hotspot
    password: $password

captive_portal:

web_server:
  port: 80

logger:

api:
  password: !secret api_pwd

ota:
  password: !secret api_pwd

text_sensor:
  - platform: wifi_info
    ip_address:
      name: $upper_devicename IP Address

binary_sensor:
  - platform: status
    name: $upper_devicename Status

switch:
  - platform: gpio
    pin: D5
    id: rinse
    restore_mode: ALWAYS_OFF
  - platform: template
    name: Rinse
    icon: ""
    turn_on_action:
    - switch.turn_on: rinse
    - delay: 500ms
    - switch.turn_off: rinse
    
  - platform: gpio
    pin: D6
    id: espresso
    restore_mode: ALWAYS_OFF
  - platform: template
    name: Espresso
    icon: ""
    turn_on_action:
    - switch.turn_on: espresso
    - delay: 500ms
    - switch.turn_off: espresso

  - platform: gpio
    pin: D7
    id: large
    restore_mode: ALWAYS_OFF
  - platform: template
    name: Large
    icon: ""
    turn_on_action:
    - switch.turn_on: large
    - delay: 500ms
    - switch.turn_off: large

sensor:
  - platform: ultrasonic
    name: Water Level
    trigger_pin: D1
    echo_pin: D2
    update_interval: 10s
    unit_of_measurement: "%"
    accuracy_decimals: 0 
    filters:
      - calibrate_linear:
          - 0.02 -> 100
          - 0.20 -> 0

1 Like

I ordered the custom PCB’s yesterday which will make the wiring much neater inside the machine, they work out about $2 each plus postage if you would like one, should be here in about 2 weeks.

Dude I did this exact thing for the same machine about 18months ago would’ve saved you some time but then again that’s half the fun isn’t it.

1 Like

Haha awesome @jimpower as you say working it out is half the fun!

Got the custom PCB’s and installed over the weekend, much neater now!

With panelising I’ve ended up with 80 of the PCB’s so let me know if you’d like one.

3 Likes

How’s the ultrasonic holding up? Are measurements pretty stable for this application?

I’m reconsidering my approach after some recent failure.

I’d like a PCB, or two if you don’t mind (one for me and one for a friend).

Hey @forkwhilefork, where in the world are you?

Hey @Mahko_Mahko apologies I completely missed your question. The ultrasonic has held up pretty well but periodically I have to clear condensation from ther inside of the water tank lid. I’m playing around with an update to my original project and looking to use a VL53L0X time of flight sensor for both water and capsule bin levels.

No worries.

I went with a VL53LX for my coffee tank and it’s holding up well.

I use a moving median filter in ESPHome to filter off any spikes. Not sure if it’s even needed but doesn’t hurt.

1 Like

MD, USA (zip code 20743)

Hi, I have an Illy Y3.3 coffee machine, I would like to be able to control it with an ESP with ESPHome.

The machine has only 2 buttons:

  • Short coffee
  • Long coffee

To turn on the machine, you must press one of the two buttons.
Subsequently, when the water reaches the correct temperature, pressing one of the two buttons starts dispensing the coffee.
(The coffee machine switches off automatically after a period of inactivity)

I would like to be able to turn on the coffee machine (and this is simple), but having a button with double function (on / off and start of dispensing) how can I exclude accidental dispensing if I press the on button in the Home Assistant when the machine is already on?