ESP8266 Washing Machine Notifier

Use the small, easily programmed and powered Wemos D1 Mini to turn your washing machine into a smart appliance.

Note

I first published this project over on hackster.io back in December 2016, I am republishing this on my blog as I may revisit this project in the future for a Version 2 that will hook into my home assistant setup. At the moment the below is working fine for me so my priorities is focused on automating everything else in my house!

(My washer is a Fisher and Paykel that has a series of leds across its control panel to indicate the cycle etc. if your washer doesn’t have this this project may not be for you. But maybe my dryer project here maybe an option if you run Home Assistant)

About

I have been keen on making a few IOT projects around the home using the fantastic ESP8266 and one of my first thoughts was to get a notification from my washing machine when the load is done. That’s when I stumbled across the fab-lab.eu project on hackster.io and using this as inspiration I have created my take on this project. To recap, we are using a LDR to read the washers ON LED, when it turns off we send a message via IFTTT. 

My personal preferred version of ESP8266 is the Wemos D1 Mini, it’s small, easily programmed and powered and the optional prototype shield makes for a neat project. You can get cheaper versions of the ESP8266 but the Wemos is still pretty cheap and less mucking around.

How to

Once you get you gear, flash the Nodemcu firmware to your ESP8266 with the NodeMCU Flasher Tool. A good tutorial on how to do this this is here. I used the default firmware that comes with the tool, as earlier experiments with some custom builds gave me nothing other than a value of 65535 on the ADC pin. This project needs to read the value of the ADC pin to figure out if our LDR can see if the LED on or off.

Once flashed you can load the Lua files below to get the program operation. I personally like using ESPlorer to do this. The only changes you will need to make to my Lua files is the SSID and password of your WiFi network in init.lua and your IFTTT maker key in ifttt.lua.

The IFTTT Part

To find your maker key go to IFTTT and find and click on maker, then click on settings. You need the string of characters at the end of your maker.iftttURL as shown below:

When it comes to setting up IFTTT, go to My ApptletsNew Apptlet, search for Maker, click on Receive a web request and enter WashDone in the Event Name Field. Create the trigger and then add whatever action you require like send a email.

I have tried to make the code as simple as possible, so there is no fancy OTA config or low power modes. This thing just sits there all day waiting for the washing machine LED to turn on. When the state of the LED changes from on to off the ifttt.lua code fires to send a WashDone event to IFTTT.

Speaking of IFTTT, I have taken the IFTTT code out of the original project file and put it in its own lua file for simplicity. The ifttt.lua file is borrowed from Noel Portugal’s excellent ESP8266 IFTTT Easy Button project.

Wiring up is as simple as putting the LDR from the 3V3 pin to the ADC Pin (labelled A0 on the Wemos) and a 10k resistor from the same ADC pin to ground.

Code

The code is written in Lua and is available on my github page here Don’t forget to add your wifi details on Line 8 of init.lua and your maker key on line 10 of ifttt.lua and to upload all 3 files.

If this doesn’t detect your washers on LED make sure no light can enter your sensor where you placed it over the LED from the side. Also you can watch the serial monitor in ESPlorer and see the system connect to wifi and print the LDR value on the screen. You can modify the trigger level on line 12 of washer.lua to suit your needs.

This was my first and only Lua based esp8266 project as I prefer to used arduino code or a prebuilt firmware solution like tasmota for my projects now. This project has been working reliably for over a year now so I have had no need to fiddle with things so far but version 2 may be a different story.