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 do itOnce 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
.
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.ifttt
URL as shown below:
When it comes to setting up IFTTT, go to My Apptlets
, New 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.
Comments