Home Automation
Using Home Assistant and ESPHome for helpful projects around the home.
Internet of Things
Whether you're a beginner or a seasoned expert - skilled in the art of making older machines and devices more connected, more helpful - I hope you enjoy these projects.
LaundryBot 1.0
👕👖
Intro
This might be of interest to you if you want to get alerts about the state of a pre-IoT appliance based on signal from a sensor. Or maybe you just want to get started in DIY and you want some inspiration. Either way, I applaud you for taking the next step in whichever journey you're on.
💡
Inventing smarter appliances
Ok - ready to get technical?
In this example I'm using an ESP32 coupled with an SW-420 vibration sensor to the back of a washer and dryer to enable remote notification based on laundry room activity. This will allow us to get a pop-up notification on our device of choice with a message that will make our lives easier.
👋Say hello to our versatile ESP32 and trusty SW-420
For about the price of a bottle of laundry detergent - we can upgrade our appliance and make them more helpful.
To follow this guide you will need Home Assistant running on the same network as the sensor unit. Get started by installing the ESPHome integration. The ESPHome Getting Started guide assumes some knowledge of Home Assistant which has it's own Getting Started guide.
Open source home automation that puts local control and privacy first.
There are other ways (IFTTT, Slack, Twitter) to get alerts from a sensor to your phone but these are a great topic for another excellent guide.
⚡
Disclaimer
This guide assumes that the reader has intermediate knowledge and experience with electronics prototyping, soldering, scripting, debugging, and safe practices. As with any project there are many ways to achieve the desired result and this is just one of them. While I hope this is helpful, I offer no warranty and assume no liability for the result of following any or all of the instructions in this guide.
Materials
Here's what you'll need
Home Assistant running on the local network
Home Assistant companion app running on iOS or Android
SW-420 Normally Closed Vibration Sensor Module
22AWG-28AWG stranded wire (either pre-terminated jumper wires with BLS connectors or using a BLS connector kit and crimping tool)
USB cable
Optional
Soldering Kit
Dust-resistant enclosure for SW-420 (I used some polypropylene cases I had sitting around)
Step 1: Set up the ESP32 with ESPHome
Connect ESP32 and SW-420 to a solderless breadboard. The red LED next to the USB port on the ESP32 (in this case - a Huzzah32) is directly connected to GPIO#13. As a quick test, I connected the data line of the SW-420 to GPIO#13 to see if things were registering on the ESP32. The LED on the ESP32 started blinking when I gave the board a gentle tap.
Install Home Assistant
Install ESPHome and continue through the steps to set up your first node.
Compile and upload LaundryBot.yaml script to ESP32 using ESPHome You may have noticed that I have this file set up for two different sensors connected to the same ESP32. If you only need one sensor you can delete the second one.
esphome:
name: laundry1
friendly_name: laundry1
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "encryption-key"
ota:
- platform: esphome
password: "ota-password"
wifi:
ssid: "network-id"
password: "network-password"
binary_sensor:
- platform: status
name: "LaundryBot"
- platform: gpio
pin: GPIO13
name: "washer"
device_class: vibration
filters:
- delayed_on: 10ms
- delayed_off: 5min
- platform: gpio
pin: GPIO33
name: "dryer"
device_class: vibration
filters:
- delayed_on: 10ms
- delayed_off: 5min
5. Once you've tested the hardware you may find that you need to fine tune the Delayed On / Off Binary Filter which will limit the sensor from registering more inputs than is actually helpful. In my application, I was seeing false positives. For instance, setting a bottle of detergent next to the dryer would register as vibration.
I didn't want to decrease the sensitivity of the sensor, so instead I used the filter settings shown below and it helped mitigate false positives. You may have a different experience based things like environmental factors and how sensitive the sensor is.
filters:
- delayed_on: 10ms
- delayed_off: 5min
Step 2: Build the assembly
Once you've collected all the materials, lay out the components roughly where they will be relative to one another. Sometimes I sketch out the assembly first with simplified symbols and lines showing the point to point connections. This can be helpful to avoid common wiring problems and to be able to refer back to for troubleshooting later.
Cut the boards.
If you have compound cutting shears like tin snips or similar you can easilly cut breadboard. Avoid using a motorized cutter because it could damage the delicate pads.
Solder or Crimp.
If you're comfortable with soldering, that might provide a more stable connection. Otherwise a crimp should be okay too.
Assemble and Install.
Assemble the wires, boards, and enclosures. Install the sensors securely - they need to be fastened in a way that when the machine vibrates, that vibration is transferred to the sensor. If it's too loose, this won't work.
Step 3: Install sensor
Install sensor in the optional enclosure and attach them to the appliance you want to monitor.
Step 4: Adjust the settings on the SW-420
Try to trigger the sensor and adjust the sensitivity control on the SW-420 until the desired threshold is achieved.
Adjust the SW-420
It's quite possible that the sensitivity of the SW-420 will need to be fine-tuned depending on how much vibration the appliance generates and how the sensor is attached.
Check Home Assistant
In Home Assistant, Settings, Entities: search for the sensors you named in ESPHome in step 1. In this case I was able to just search for 'dryer' and see that there was some vibration detected.
Step 5: Set up push notifications
Finally, it's time to get push notifications set up in Home Assistant.
Configure the sensor in Home Assistant in the Integrations tab (located in Settings, Devices and Services).
Create an Automation (located in Settings, Automations and Scenes, + Create Automation, Create New Automation) for each sensor using the visual editor.
Laundry ready!
If everything is working, you should be able to receive notifications in the Home Assistant iOS app!
🎉
You made that old appliance more modern!
If all went well, you just added a helpful modern feature to your trusty home appliance - maybe even extended it's useful life!
Acknowledgement
This project was inspired by the amazing members of the Seattle DIY IoT Meetup - which was a meetup I co-founded in 2018. Shout out to all who helped make that happen!
👏
You are amazing!
The CT sensor will help us see when the dryer is done.