Introduction: Smart Nespresso Machine Using HomeAssistant, Alexa, or Web Browser
In my quest to become even lazier, and to awaken myself with minimum effort in the mornings, I have decided to upgrade my coffee machine.
If you would like to do this, and are willing to void your machine's warranty, then try and follow along!
There are a few things you will require prior to starting this project:
- Nespresso Coffee Machine - Inissia
- ESP8266 NodeMCU - WiFi enabled microcontroller
- HomeAssistant Software - Centre for your smart home - Last extra step avoids this
- MQTT Broker - Easy message sending software for between HomeAssistant and ESP8266 - Last extra step avoids this
- Amazon Echo Dot - Voice control HomeAssistant - Last extra step avoids this
- N-Type MOSFET
- 1 KΩ Resistor
- 9V Battery
- Battery Case
Step 1: Opening Up the Machine
The bolts on the side of the horseshoe shaped lever appear to be an anti-fiddle size, however a firm grip and a flat head screwdriver allowed me to undo them.
After that, using a flat head screw driver, pry open the plastic covering (*gently*).
It should reveal [1] & [2].
Then, you must pry further to open the point where the buttons are [3].
Underneath the buttons you should see something like this [4].
These two rings are an opening in the circuit, which by pressing the button down are connected telling the machine to activate.
Step 2: Controlling the Nespresso's Switch
The double ring switch operates a circuit of ~ 14 Volts. This means that you cannot control it directly from the ESP8266 NodeMCU as it can only output 3V.
To get around this it I used a N-type MOSFET, in particular I used the BUZZ11.
This allows you to control the 14V on or off, using the 3V of the ESP8266 NodeMCU.
The circuit looks like this [5] & [6].
I recommend soldering onto the Nespresso machine's switch rings very quickly, and using a dab of solder.
You should have to wires leaving the machine one from the positive and another from the negative terminal [7].
Step 3: The ESP8266 NodeMCU's Code
Writing code for this module can be done in the Arduino IDE.
Here is the code
//////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// ////////////// Skelectronics Coffee Machine //////////////////////// //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// #include <ESP8266WiFi.h> #include <PubSubClient.h> // Update these with values suitable for your network. const char* ssid = "YOUR_WIFI_NAME"; const char* password ="YOUR_WIFI_PASSWORD"; #define mqtt_server "YOUR_MQTT_SERVER_IP_ADDRESS" #define mqtt_user "YOUR_MQTT_USERNAME" #define mqtt_password "YOUR_MQTT_PASSWORD" #define mqtt_topic "dev/coffeeMachine" WiFiClient espClient; PubSubClient client(espClient); String strTopic; String strPayload; int switchingPin = D8; void setup_wifi() { WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println("WiFi connected"); delay(500); } void callback(char* topic, byte* payload, unsigned int length) { payload[length] = '\0'; strTopic = String((char*)topic); if(strTopic == mqtt_topic) { strPayload = String((char*)payload); if(strPayload == "onn")<br> { digitalWrite(switchingPin, 1); delay(500); digitalWrite(switchingPin, 0);<br> delay(500); digitalWrite(switchingPin, 1);<br> delay(500); digitalWrite(switchingPin, 0);<br> client.publish(mqtt_topic, String("done").c_str(), true); } } } void reconnect() { // Loop until we're reconnected while (!client.connected()) { Serial.print("Attempting MQTT connection..."); // Attempt to connect if (client.connect("CoffeeClient", mqtt_user, mqtt_password)) { Serial.println("connected"); // Once connected, publish an announcement... client.subscribe(mqtt_topic); } else { Serial.print("failed, rc="); Serial.print(client.state()); Serial.println(" try again in 5 seconds"); // Wait 5 seconds before retrying delay(5000); } } } void setup() { pinMode(switchedPin, OUTPUT); Serial.begin(9600); setup_wifi(); client.setServer(mqtt_server, 1883); client.setCallback(callback); } void loop() { if (!client.connected()) { reconnect(); } client.loop(); }
Step 4: Adding to Your HomeAssistant
In your HomeAssistant configuration.yaml file add this:
switch: - platform: mqtt name: "Coffee Machine" command_topic: "dev/coffeeMachine" qos: 0 payload_on: "onn"
And in your groups.yaml add:
###Views### default_view: view: yes entities: - switch.coffee_machine
Then add switch.coffee_machine to your main screen, it should look like [8].
Step 5: Adding Alexa
To add Amazon's Alexa control to any of your switches in HomeAssistant, it is as simple as adding this to your configuration.yaml file, and then scanning for smart home devices in your Alexa app.
emulated hue:
From there, it should be as simple as saying "Alexa, please turn on the coffee machine" [9].
Step 6: More Fun With Home Assistant
If you would like to include your new automated coffee machine into your alarm, then a great HomeAssistant community member and guru has made a clear set up to add an alarm clock to your HomeAssistant GUI and automations can include your coffee machine!
Include these additions to your configuration, automation, and groups files:
configuration.yaml
mqtt: broker: yourbroker_address username: !secret mqtt_username password: !secret mqtt_password sensor: - platform: template sensors: alarm_time: friendly_name: 'Time' value_template: '{{ "%0.02d:%0.02d" | format(states("input_slider.alarmhour") | int, states("input_slider.alarmminutes") | int) }}' - platform: time_date display_options: - 'time' - 'date' - 'date_time' - 'time_date' - 'time_utc' switch: - platform: mqtt name: "Coffee Machine" state_topic: "dev/coffeeMachine" command_topic: "dev/coffeeMachine" qos: 0 payload_on: "onn" input_slider: alarmhour: name: Hour icon: mdi:timer initial: 9 min: 0 max: 23 step: 1 alarmminutes: name: Minutes icon: mdi:timer initial: 0 min: 0 max: 59 step: 5 input_boolean: alarmstatus: name: Alarm Status initial: off icon: mdi:timer alarmweekday: name: Weekdays Only initial: off icon: mdi:calendar morningcoffee: name: Coffee initial: off icon: mdi:coffee-outline
automation.yaml
- alias: 'Wake Me Up' trigger: platform: template value_template: '{{ states.sensor.time.state == states.sensor.alarm_time.state }}' condition: condition: and conditions: - condition: state entity_id: input_boolean.alarmstatus state: 'on' - condition: or conditions: - condition: and conditions: - condition: state entity_id: input_boolean.alarmweekday state: 'on' - condition: time weekday: - mon - tue - wed - thu - fri - condition: state entity_id: input_boolean.alarmweekday state: 'off' action: - condition: state entity_id: input_boolean.morningcoffee state: 'on' - service: switch.turn_on entity_id: switch.coffee_machine
groups.yaml
###Views### default_view: view: yes icon: mdi:home entities: - group.alarmclock ###groups### alarmclock: name: Wake Me Up entities: - input_boolean.alarmstatus - sensor.alarm_time - input_slider.alarmhour - input_slider.alarmminutes - input_boolean.alarmweekday - input_boolean.morningcoffee
Ayy [10]!
Step 7: Extra: for Those Who Don't Have HomeAssistant
The ESP8266 can host a webpage which you means you can control it from your browser to turn on your coffee machine.
//////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// ////////////// Skelectronics Coffee Machine //////////////////////// //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// #include <ESP8266WiFi.h> const char* ssid = "YOUR_WIFI_NAME"; const char* password = "YOUR_WIFI_PASSWORD"; int switchingPin = D8; WiFiServer server(80); void setup() { Serial.begin(9600); delay(10); pinMode(switchingPin, OUTPUT); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); } server.begin(); Serial.print("Use this URL to connect: "); Serial.print("http://"); Serial.print(WiFi.localIP()); Serial.println("/"); delay(3000); } void loop() { // Check if a client has connected WiFiClient client = server.available(); if (!client) { return; } // Wait until the client sends some data Serial.println("new client"); while (!client.available()) { delay(1); } // Read the first line of the request String request = client.readStringUntil('\r'); Serial.println(request); client.flush(); // Match the request if (request.indexOf("/coffeeMachine") > 0) { digitalWrite(switchingPin, 1); delay(500); digitalWrite(switchingPin, 0); delay(500); digitalWrite(switchingPin, 1); delay(500); digitalWrite(switchingPin, 0); } // Return the response client.println("HTTP/1.1 200 OK"); client.println("Content-Type: text/html"); client.println(""); // do not forget this one client.println(""); client.println(""); client.println(""); client.println(""); client.println(""); client.println(""); client.println(""); client.println("<hr><hr>"); client.println("<h4 style="font-size: 250.0%;"><center> Coffee Machine Controlling Website Ay </center></h4>"); client.println("<br><br>"); client.println("<br><br>"); client.println("<center>"); client.println("Nespresso"); client.println("<button><a>Turn On </a></button>"); client.println("</center>"); client.println(""); client.println(""); delay(1); Serial.println("Client disonnected"); Serial.println(""); }
When you upload this to your ESP8266 NodeMCU, and open the serial monitor you should see the IP address where the website is located [11].
When you put this IP address in the url bar of your browser, you should receive the webpage [12].
Just click the button and it will control your coffee machine!
Step 8: Final Comments
Battery life seems to be a problem; 0.2A, 5.1V - I will investigate sleep mode for the ESP8266 NodeMCU. But, for the moment I will just use a phone charger to supply power.
I will try and make my solution a bit more pretty once I get started with 3D printing.
The Nespresso requires two button pushes on turning on to make the first coffee. However, after the machine has warmed up, it only requires one push to make a coffee. This isnt a problem for me, as I usually only have one coffee in the morning using this machine. It should be easy to adapt the code to tap the switch once after the machine has heated up.
Here, are some good tutorials I have found:
I will try and answer questions,
Skelectronics

Participated in the
Wireless Contest
6 Comments
6 weeks ago
Hi skelectronics, I was finally going to create a tutorial on how to use the Nespresso machine with Alexa emulating the Wemo switch. And already started an "instructables" page on it. But as I am working on it I see that more than 70% of the work corresponds to your project, including pictures etc. I was going to credit you, but seeing the hug amount of data that is the same, I prefer to get your blessing first. I will credit you several time and refer you page(s) but let me know if you are happy with this if not I will stop what I am doing altogether, no worries.
BTW big thanks again for your project, I am still enjoying it every day when I wake up and have Alexa brew my fresh cup 8-))
Have fun,
Andy
Reply 6 weeks ago
Hey I think it’s great that you have made another instructable and are enjoying automated coffees! I have a new account under the name T3chFlicks where I have done many more projects please check me out! I am happy for you to use any of my materials as long as you credit where possible
3 years ago
hi, looking to try this build, do you have any updates since you made this guide? thanks!
Question 4 years ago
Hi instead of providing 14V to the machine is possible to use a 3.3V relay that emulate the push button?
5 years ago
Hi, thanks a million, your instructions really did help me ! Some suggestions; instead of soldering wires on the coffee machine, there is a connector connected to this small PCB board, you can piggyback 2 of those breadboard connectors on that connector. Also instead of going the HomeAssistant way, you can mak the ESP8266 emulate a Wemo switched have Alexa find it that way 8-))...Thanks again !!
Reply 5 years ago
Hi Andy, thanks for letting me know! The plan was to 3d print a case to attach the wires at that point. See the pic, it fits the curve nicely :)
The Wemo switch looks awesome!
Ive also changed my code to stop the machine going into setup mode when you want coffee before it has returned to sleep mode