Washing machine done notifier
Build it step by step
0 of 6 doneWire the sensor
Connect the ADXL345 to the ESP32-C3 as in the table.
Check the sensor
Upload and open the Serial Monitor at 115200 to see "Running" when you shake the board.
Mount
Stick the box on the side of the machine with double-sided tape or a magnet.
Tune the threshold
Run a short wash and raise or lower THRESHOLD until it only counts the real wash.
Add the notification
Put your Wi-Fi details and a notification address in the placeholders and test by shaking for a minute then leaving it.
Run a full cycle
Check you get one message about five minutes after the spin ends.
How do you build a washing machine done notifier?
A vibration sensor on the washing machine sends a phone message when it has stopped shaking for five minutes. You need ESP32-C3 SuperMini, ADXL345 accelerometer, USB A to USB-C cable (data) and 5 V 2 A USB adapter. It takes 6 steps and about 90 minutes.
- Level
- Beginner
- Time
- About 90 min
- Parts
- 4
Parts list
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| ADXL345 VCC | ESP32-C3 3V3 | Power |
| ADXL345 GND | ESP32-C3 GND | Ground |
| ADXL345 SDA | ESP32-C3 GPIO8 | I2C data |
| ADXL345 SCL | ESP32-C3 GPIO9 | I2C clock |
| USB-C cable | 5 V USB adapter | Power |
Code
Arduino IDE with the ESP32 boards package, board "ESP32C3 Dev Module" with USB CDC On Boot enabled. Install "Adafruit ADXL345" and "Adafruit Unified Sensor". Put your own Wi-Fi name, password and notification address in the placeholders and never share them in public code. The reading is one sample per second, so the vibration test runs a little slower than the machine's real motion; the average line removes gravity and tilt.
Runs on a virtual ESP32-C3 in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
#include <WiFi.h>
#include <WiFiClientSecure.h>
#include <HTTPClient.h>
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_ADXL345_U.h>
const char* WIFI_NAME = "YOUR_WIFI_NAME";
const char* WIFI_PASSWORD = "YOUR_WIFI_PASSWORD";
const char* WEBHOOK_URL = "https://YOUR_NOTIFICATION_URL"; // for example a push service topic you created
Adafruit_ADXL345_Unified accel(12345);
const float THRESHOLD = 0.15; // m/s2 above the resting reading counts as shaking
float avg = 9.81;
unsigned int highSecs = 0, stillSecs = 0;
bool running = false;
void notify() {
WiFiClientSecure client;
client.setInsecure(); // no certificate check: fine for a harmless alert, a trade-off
HTTPClient http;
if (http.begin(client, WEBHOOK_URL)) {
http.addHeader("Content-Type", "text/plain");
http.POST("The washing machine has finished");
http.end();
}
}
void setup() {
Serial.begin(115200);
Wire.begin(8, 9);
if (!accel.begin()) { Serial.println("ADXL345 not found"); while (true) delay(1000); }
accel.setRange(ADXL345_RANGE_2_G);
WiFi.begin(WIFI_NAME, WIFI_PASSWORD);
while (WiFi.status() != WL_CONNECTED) delay(500);
}
void loop() {
sensors_event_t e;
accel.getEvent(&e);
float mag = sqrt(e.acceleration.x * e.acceleration.x + e.acceleration.y * e.acceleration.y + e.acceleration.z * e.acceleration.z);
avg = 0.95 * avg + 0.05 * mag; // slow average of the resting value
float v = fabs(mag - avg);
if (v > THRESHOLD) { highSecs++; stillSecs = 0; }
else { stillSecs++; if (stillSecs > 30 && !running) highSecs = 0; }
if (!running && highSecs >= 60) { running = true; Serial.println("Running"); }
if (running && stillSecs >= 300) { Serial.println("Done"); notify(); running = false; highSecs = 0; }
delay(1000);
}What the serial monitor should show
Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual ESP32-C3 DevKitM-1 with its sensors at their default values. Your numbers will follow your real readings, but the format should match.
ADXL345 not found
Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Machine off | Serial stays quiet |
| Machine washing for a minute | Serial prints Running |
| Machine stops for 5 minutes | Serial prints Done and the phone alert arrives |
| Soak pause of 2 minutes mid-wash | No false alert |
If it does not work
ADXL345 not found
Check SDA on GPIO8, SCL on GPIO9 and 3V3 power.
Never reaches Running
Lower THRESHOLD or stick the sensor on a flatter, more rigid panel.
Alerts too early
Increase the 300 second still time or the soak-pause allowance.
No phone message
Check Wi-Fi, the notification address and that the router lets the ESP32 reach the internet.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the washing machine done notifier?
ESP32-C3 SuperMini, ADXL345 accelerometer, USB A to USB-C cable (data) and 5 V 2 A USB adapter.
How long does the washing machine done notifier take to build?
About 90 minutes for a beginner maker, in 6 steps.
How do I know the washing machine done notifier works?
Machine off: Serial stays quiet. Machine washing for a minute: Serial prints Running. Machine stops for 5 minutes: Serial prints Done and the phone alert arrives.
ADXL345 not found: what should I check?
Check SDA on GPIO8, SCL on GPIO9 and 3V3 power.
Never reaches Running: what should I check?
Lower THRESHOLD or stick the sensor on a flatter, more rigid panel.
Alerts too early: what should I check?
Increase the 300 second still time or the soak-pause allowance.
No phone message: what should I check?
Check Wi-Fi, the notification address and that the router lets the ESP32 reach the internet.
