Like most people we have a washing machine. No problem. There is however one annoying thing.
The washing machine is on the ground floor. And my girlfriend (who operates it, how bout that division of tasks) who is a painter has her work-place on the second floor of our house.
Now the washing machine will just shut down when it has finished its task. However when she is in her work-room she can't see that. So she has no other indication wether the machine has finished its task, as to leave her work every now and then and go downstairs to have a look. Waste of time and annoying. Surely there has to be an easier way, and there is.
The first thing to do to find an easier way to check if the washing machine has finished it's job is to look how it operates. Well that is fairly simple.
When the machine is put to work the led display and all kinds of indicators are on.
When the machine finishes it shuts itself down putting all indicators off. This offers possibilities.
It is about the same as checking wether the refridgerator door is open or closed like I did in this story:
I just wanted to make it a bit more fancy.
The ESP8266 is what I am going to build this with. I could not use the ESP-01 as I needed an analog input for the LDR, next to more I/O pins. So I used a NodeMcu. I am going to check the display of the washing machine with an LDR. Next to that I am going to attach a pushbutton to start the monitoring and a led that indicates that monitoring has indeed started. That is all we need for the hardware.
When the washing machine has finished I want it to send a signal to my girlfriends mobile phone. I am going to program the NodeMCU in ESP-Basic and use the Maker Channel from IFTTT for sending notice to the mobile phone.
For detailed information on installing ESP-Basic and use check this page:
Not much to it. Here is a list of what you'll need:
- USB Power supply (or powerbank)
- 1 led (I choose a green one)
- 1 220 ohm delimiting resistor for the led
- 1 Push-button
- 1 10K pull-up resistor for the button
- 1 LDR
- 1 10K pull-down resistor for the LDR
So for testing purposes I put everything on a breadboard.
And here is how the prototype looks in real-life.
First a timer is set that will jump to the [test] routine which checks the LDR value every second. And an interrupt is defined that checks wether the button has been pushed.
Then the software starts with building a webpage which you can look at on your computer, phone or tablet. This is not necessary however convenient for testing and debugging. You can find the webpage by looking in your router at the IP-adress of the ESP and then pointing your web-browser to that IP adress like discussed here:
The [test] routine then checks every second the value of the LDR.
The if statements tests wether the LDR measurement is below a certain value AND the LED is ON. If that is the case the washmachine has finished and the monitor program is working. The alert is send to IFTTT. The LED is then set OFF so that if the test is run again, no alert is send unless the LED has been set on again by pushing the button.
Replace YOUR-PERSONAL-KEY with your own personal IFTTT key, and if you like replace wash-finished with any other name you like as a trigger. Just make sure you use the same name in the next steps where you will create the IFTTT applet.
The [change] routine tests the state of the button and if that is 0 (button pressed) the LED is set ON.
That is all.
Start with commenting-out the IFTTT trigger in the ESP-Basic program. Otherwise you will get notifications on your phone with each test you perform. You can do that by setting a ' in front of the line you do not want to run. In this case in front of the print wget( etc etc etc line.
For testing purposes I taped the LDR to the washing machine with some dark painters tape. I carefully looked at the values that appeared on the webpage when the lights of the washing machine where on and off. I tested with different environment lightning like open and closed curtains and on and off ceiling lights.Then values are shown on the ESP's webpage which will look as follows:
That gave me the right values that the LDR would register and I put those in the Basic program at the following line:
if (value < 600) and (io(laststat,d7) = 1) then
Replace the figure 600 with the value you will find.
Now uncomment the wget line by removing the '
Create an IFTTT applet
First make sure you have an IFTTT account and are connected to the Maker Channel. If everything went well you will have your personal IFTTT key. Fill that key in at the right place in the ESP-Basic program.
Start with choosing to make a new applet.
Click on the blue +this
Now choose a service. You are presented with many possibillities bus just type in web and then webhooks will emerge.
Complete the trigger fields. I typed Wasmachine monitor but replaced with wash-finished. Use exactly the same name as is filled in in the ESP-Basic program. Otherwise the IFTTT part will not work.
Now click on the blue +that
The IF part is done now we need to make the THAT part. Choose an action presents you again with many possibillities however type in no at the search functions and Notifications will emerge. Click on that.
Again not many choices so use the "Send a notification" action.
The final check
And you're done.
Autostarting the program.
Go back to the ESP-Basic editor and rename the program in default.bas and save it.
Now go to the SETTINGS page
Make sure you check, at the bottom, that default.bas is run at startup.
You will have to have IFTTT installed on your phone/tablet and running
Plug the USB-Power plug in the wall and wait about a minute. The NodeMCU will by then have booted and the default.bas program will be running.
Set the washing machine ON and press the button on the breadboard.
The LED on the breadboard will go ON.
Just wait till the washmachine has finished, or shut the power down manually.
The LED on the breadboard will go OFF and you will get (when activated) an audible alert and maybe a blinking led on the phone/tablet.
On the start-screen of your phone you will see the IFTTT logo on the left upper part.
And this is what the notification screen on your phone will look like.
If you would open your webbrowser and point it to the ESP you will also find a notification on the webpage.
Girlfriend Happy !!
And that is the best part.
Now I only have to put the hardware on a stripboard and then design and print a nice casing.
Till next time.
Have fun and keep your partner happy.