Introduction: Arduino Washer Dryer Alert - Push Notification to Phone With Blynk

About: Just experimenting

Our washing machine is in the garage and we can't hear the beeps to indicate that the wash is complete. I wanted to find a way to get notified, wherever we are in the house, when the cycle was finished. I've been tinkering with Arduino, ESP8266 WiFi for some time, and recently started with Blynk - I thought this might provide a relatively simple but flexible solution.

My initial thoughts were to use the washing machine to power the Arduino, and connect the washing machine buzzer to a digitial input pin to trigger the notification. After a few hours investigating the washing machine controls, without a circuit diagram, and a couple of unexpected electric shocks (even after tesing connections, pins with my multimeter . . .) I decided that a less invasive approach would be better . . .

With help from Mr Google and a rummage through my Arduino sensor boxes I settled on a vibration sensor attached to the outside of the washing machine, connected to WiFi, and the Blynk platform to manage the push notification to our phones (I tried email and twitter, but these were less immediate and required additional alert/notification settings on the iPhone).

This instructable will describe what you will need (hardware, app and Arduino code); tips and lessons learnt along the way - for Arduino, ESP8266 (on a WEMOS D1 Mini Pro board).

Lets get started . . .

Step 1: What You Will Need

1. WEMOS D1 Mini Pro - a mini wifi board with 16MB flash, external antenna connector and built in ceramic antenna based on ESP8266EX.

2. GY-521 (MPU-6050) Gyroscope/Accelerometer.

3. Blynk account and app on your smartphone.

4. Reset SW and Power Switch (optional), Various breadboard, hook up wires etc for testing.

5. Heavy Duty Double-sided tape.

6. Hot glue gun or other adhesive to firmly attach the sensor to the case.

* The sensor will need to be firmly attached to the case, and the case to the washing machine. If its not firm enough you will get spurious vibrations and lose some sensitivity in your measurement.

Step 2: Build Your Prototype and Test

Connect the GY-521 to the D1 Mini:

GY-521 D1 Mini

VCC -------> +5V

GND -------> GND

SCL -------> D1

SDA -------> D2

Load the sketch and once you confirm (serial monitor) that the GY-521 is returning X, Y and Z coordinates (there are plenty of basic GY-521 tutorials and sample sketches on the internet). For simplicity I have only used the X axis to measure vibration.

Now temporarily attach the GY-521 to your washing machine and allow a full cycle to run. This will gather the maximum and minimum X values which can be used to determine when the machine is running and when it is stopped (comments in the final sketch explain the logic).

NOTE: Pins D1 and D2 are for the WEMOS D1 Mini Pro, they may be different pins on your Arduino/ESP board - look online for pin map diagrams.

Next setup your Blynk project.

Step 3: The Arduino Sketch

I will assume that you know how to use the Arduino IDE and upload and run sketches to compatible boards. There are lots of comments in the sketch itself, so I wont go into too much detail here.

The basic steps for the sketch are as follows:

1. Read the current value of X axis, store this value. If X is > xMax then save it as xMax. If X is < xMin then save it as xMin.

2. Every 5 minutes do a check to see if the machine has stopped: "if XMax - xMin <=2". I chose 5 minutes as this allows for pauses in the wash cycle and avoids false notifications.

3. If the machine has stopped, then notify Blynk to send a push notification to your phone - Washing is Done!

* I use the millis() funtion to manage the 5 minute timer. Blynk strongly advise NOT to use delay() as this stoppes the loop() and causes the link to the Blynk server to fail. millis() is trickey to get you head around at first, but worth persevering, its a great timer with the advantage that other element of the code continue to run (eg read pins, send data etc), whereas delay() stops all processes.

* Blynk has links to the BlynkSimpleEsp8266.h library. This manages all Blynk interaction between the ESP8266 chip on the D1 mini and all Blynk functions.

* Wire.h library is included in the Arduino IDE by default. This manages the I2C communication between the D1 mini and Gy-521.

Step 4: Build Your Blynk Project

Even though you use an app on your phone, Blynk refer to individual projects and widgets (they only become apps after you decide to publish them, a feature available from Blynk that I have not used, you do not need to publish to use the projects for your own use).

I won't descibe setting up Blynk as they have extensive tutorials and support through their website and support community.

My Blynk project includes the widget to manage the iPhone Push notification (Washing is Done!), and the values for X Axis and xMax and xMin. I included these as a quick visual check to confirm that the project is correctly connected to WiFi/Blynk and that the GY-521is returning valid data.

Once you have completed you project, if you set the delay time in the sketch to a low value (eg 10 seconds), then manually move the GY-521 to break the threshold you should NOT get push notification while the sensor is moving. If you then keep the sensor still you should then get push notification, (Washing is Done!), on your phone.

Finally set the delay back to 5 minutes (or whatever value suits you).

Step 5: Now Stop Messing Around and Do Your Washing!

Some final thoughts . . .

1. Start your washing then turn the project on. Check the X values on the app to ensure the sensor has started properly, I found sometimes that the sensor didnt start and returned 225 for all values, a quick reset will fix this.

2. The 5 minute delay means that in the worst case scenerio you may not get the notification until 5 minutes after the wash finishes - this is a compromise that I prefer, rather than false alarms during the wash cycle.

3. Don't forget to enable notification for the Blynk app on your phone. Configure the phone settings to allow notification when the phone is locked.

Any comments or questions let me know

cul

billd

First Time Author Contest 2018

Participated in the
First Time Author Contest 2018