Laundry's Done!
Well there's still folding and stuff left but getting notified when the washer/dryer cycle finished was one of my first projects and is a big hit with the wife. An accelerometer detects when motion has ceased and sends a notification. I'm using micropython with an ESP32, MQTT, Home Assistant, and Twilio to send text messages but you can adapt any or all of those to suit your needs.
Supplies
- GY-521 - Accelerometer/Gyroscope
- ESP32 Mini - Perfect small package to mount the GY-521 on
- Soldering iron
- Double sided tape
When you purchase through links on this site, I may earn an affiliate commission.
Wiring
There are no actual wires per se... Solder one of the female pin headers to the ESP32 Mini row that has VCC/GND. Then break off a 4 pin strip of male headers and solder that to VCC<->SDA on the GY-521 (make sure the pins are oriented properly so the GY-521 will hang above the ESP32). Then insert the GY-521 onto the ESP32 Mini making sure you've lined up VCC/GND and you'll end up with SCL on IO16 and SDA on IO17. That's it!
Code
Getting Started With Micropython
MPU6050-ESP8266-MicroPython
Grab mpu6050.py and upload that to your ESP32.
micropython-mqtt
Grab mqtt_as/mqtt_as.py and upload that to your ESP32. Grab mqtt_as/mqtt_local.py but we'll need to tweak that with your WiFi and MQTT broker settings.
This project's code
Grab main.py and upload it to the root of your ESP32.
Update 06/25/23: Publish configuration to esp32/washer/config with retain set. You need to tweak the "sensitivity" based on your washer/dryer and lower it if it thinks it's done too early. Increase it if it never thinks it's done. You can also increase the "maxIdlePeriods" if necessary (it's the number of samples in a row that need to be less than the "sensitivity" to be considered all done).
Home Assistant
MQTT Integration
I have a Mosquitto MQTT broker running and integrated with HA. For the interface I just added a text field to show the last acceleration values to make fine-tuning easier and a switch to enable the monitoring.
Notification
I use Twilio to send texts when motion has ceased. It has good integration with Home Assistant and you can use a simple HA Automation or I prefer Node-Red.
Notes
- You may need to tune the sensitivity and/or the number of idle periods if you find it is notifying before the cycle is done or never notifies.
- If desired, separate accelerometers could be used for independent sensing of washer and dryer. I haven't tried it but for the GY-521 I linked to it says connecting VCC to AD0 will change the address of the second module so they can both be used at the same time.
- MQTT is my preferred way to have the ESP32 communicate. You could have the ESP32 handle everything by maybe adding a physical button to start monitoring and directly make a request to Twilio or your wireless carrier to send a notification.
- 9/7/23 - I just updated to Home Assistant 2023.9.0 and it didn't like how I was separating the acceleration values so I updated the config above to combine XYZ into a single number.