Maker.io main logo

Smart Woodshop Dust Collection with Home Assistant

2024-08-30 | By Zach Hipps

License: See Original Project Misc Hand Tools Programmers Raspberry Pi

 

My workspace is divided into two spaces. Most of the time, you'll see me working on the ‎side where I'm working with electronics and 3D printing. However, occasionally, I need ‎to come over to the other side of the shop and use woodworking tools. Each time I use ‎one of the woodworking tools, I have to remember to turn on the dust collection system. ‎If I forget that, the whole room fills with fine dust particles, and I don't want those ‎getting into my lungs. Back in early 2018, I built a shop vac auto switch. I could plug in ‎any tool alongside my vacuum and as soon as the tool would turn on the shop vac ‎would also turn on collecting all the fine dust particles so that they didn't end up in my ‎lungs. It was a very simple design, but it had one major limitation. The tool and the ‎shop vac had to be plugged in at the same location. Ever since I completed that project, ‎I wanted to do a second iteration where a shop vac or even a dust collection system ‎could be controlled independently by any tool across the room, instead of using a ‎current sensor read by an Arduino board which then controls a relay module like I did ‎back in 2018.

plug_1

plug_2

plug_3

plug_4

This time around, I'm going to use a smart plug. This is the Sonoff S31, and I chose this ‎smart plug because it can measure the power being drawn by the tool plugged into it. ‎Another reason I chose the Sonoff S31 is because it uses an ESP Wi-Fi ‎microcontroller. I can write and flash custom firmware on this device to get it to do ‎whatever I need. Before I can flash this with custom firmware, it needs to be opened up. ‎I'm going to use a little plastic opening tool, and I'm going to pry up on the gray side of ‎the case. It should pop up and then once I've got that open, I can slide out two little ‎white pieces. By removing those pieces, I can see and remove the screws below them. ‎After the screws are removed, I can pull the cover off the S31, and that reveals a little ‎programming header right on the edge of the PCB.‎

sonoff_5

sonoff_6

sonoff_7

This is a typical UART programming header. It needs four signals: Power, Ground, TX, ‎and RX. The most important thing to remember when programming something with ‎UART, the TX pin on the programming side needs to connect to the RX pin on the ‎target side. Likewise, the RX pin on the programmer needs to be connected to the TX ‎pin on the target. Now I need to figure out the best way to connect those signals on the ‎programmer to the Sonoff S31. I've got a few options here. A lot of tutorials on the ‎Internet show people soldering jumper wires directly to these test points. That would ‎work fine if you're doing a single one. I plan on doing many, and I think I have a much ‎better solution. I picked up this little Pogo pin probe clip from DigiKey. It is perfect for ‎this situation; all I need to do is to clip the Pogo pins over the programming pads. From ‎there, I can connect jumper wires from the probe clip to my programmer. This is much ‎faster and cleaner than soldering jumper wires to each board for programming.‎

connect_8

connect_9

connect_10

connect_11

I've gone back and forth on how I want to approach the firmware portion of this project. ‎I've spent some time talking to some friends of mine, Ian, and Jonathan, who have ‎more experience in home automation than I do. They recommended that I get a ‎Raspberry Pi and install Home Assistant on the Raspberry Pi so that I can start setting ‎up this system. The best way to get an ESP microcontroller like this to talk with Home ‎Assistant is by flashing a custom firmware called ESPHome. Now that I have Home ‎Assistant installed on the Raspberry Pi and ESPHome added as an add-on within ‎Home Assistant, I can go to the dashboard and click on the “+ New Device” button. ‎From there I'll name it “table-saw” and I'll click continue so that it creates a basic ‎configuration. This basic configuration creates a YAML file. The YAML file is just a text ‎file written in a markup language, and it tells ESPHome exactly what to do to write the ‎firmware for my device. Fortunately, I don't have to write this YAML file from scratch ‎because if I go to the ESPHome website and search for “Sonoff S31”, there's already a ‎complete configuration file written for it. I'll copy that entire configuration file and go ‎back to ESPHome, click on my table configuration, and click “Edit.” This opens up the ‎current YAML file. Next, I select all the current configuration text, delete it, and then ‎paste the new Sonoff S31 configuration. The other thing I want to change is the name ‎of this device. You want a unique name for each device on your Home Assistant ‎network. I'm going to name this “table-saw”, then I can save the YAML file and then the ‎next step is to compile this into firmware that will be loaded onto the device.‎

file_12

file_13

file_14

file_15

To do that, I'll click the manual download option and that will compile the binary. Once ‎it's done, it will save it as a binary file on my computer, and then during the next step, I ‎can load that onto the device. Depending on the hardware you have running Home ‎Assistant, this can take quite a while. In my case, I'm running a Raspberry Pi, and ‎compiling code can take 20 or 30 minutes sometimes. Now that I have a compiled ‎binary file saved to my computer, it's time to upload that on the ESP device. I'm going to ‎use ESPHome Web. This next step can be tricky. I'll hold down the button on the ‎Sonoff S31 while I attach the probe clip. This will put it into bootloader mode and get it ‎ready for us to load the code file. I can't release the button until it has started to program. ‎I'm going to click “Connect,” choose my com port, and then click “Install”. Then, I'll ‎browse to the location where I saved the binary file, and with that file selected, I'll click ‎‎“Install”. Now it's connecting to the Sonoff S31 and it is installing. I can let go of the ‎button. This is the step where the binary file is transferred through the UART ‎programmer into the Sonoff device. Now that the configuration is installed, I can click ‎close, and go back to Home Assistant. If I look at my device, I can see that it's offline. To ‎fix that, I need to do a power cycle. I'll unclip and re-clip my probe just to power cycle. ‎After a couple of seconds, the status changes to online. That's pretty much it. This ‎device is programmed, and I can put it back together and start using it.

start_16

start_17

start_18

I'm going to have several of these devices throughout my shop, and I want to be able to ‎keep track of them. I'll use a label maker to print a label for each one. The Sonoff S31 is ‎now reassembled. I'll plug it into an outlet strip for testing purposes. I’ll go back into ‎Home Assistant, look at my notifications, and see that a new device was discovered. It ‎asks me, “Do you want to add ESPHome node ‘table-saw’ to Home Assistant?” Yes, I ‎do, click “Submit”. Now I can go into the dashboard I set up for my dust collection, see ‎that the table-saw relay is there, and I have a little button I can click. If I listen carefully, I ‎can hear it click when I press the button. Now I can control this relay from Home ‎Assistant, which is a huge milestone for this project.‎

relay_19

relay_20

relay_21

relay_22

Next, I want to test to see if current or power is flowing through the Sonoff S31 when I ‎plug in a tool. It's not practical to drag my table over here, so I'm going to use a jigsaw ‎and I'm going to plug it into the Sonoff plug. As I pull the trigger, I expect that power to ‎show in Home Assistant. When I pull the trigger… awesome! The power went up to ‎about 300 watts as I was pulling the trigger.

trigger_23

The next step is to do this all over again. I'm going to program a second Sonoff S31, but ‎instead of making it a tool like I did last time, this time I'm going to name it “dust-‎collector”.‎

I'll plug this in across the shop just for demonstration purposes to show that these don't ‎need to be right next to each other. The whole idea is that I want my desk collector on ‎one side of the shop, and any tool around should be able to turn that on. I'm going to ‎go plug this in, and then plug in my shop vac for now. It's loud enough that I'll be able ‎to tell when it turns on. Like before, I see in my notifications that I have a new device ‎called “dust-collector.” I'll hit configure and yes, I want to add it to my Home Assistant. ‎Once again, I see that the relay button shows up on the dust collector along with all the ‎other power-measuring information. I'll test that relay and see if I can hear the dust ‎collector turn on. Okay, that worked!

worked_24

Next, I need to create an automation so that when the tool turns on, the dust collector ‎also turns on. Then, when the tool turns off, the dust collector turns off. To create that ‎automation, go into Home Assistant and click “settings” and then on “Automations and ‎Scenes.” Right now, I don't have an automation, so I'll create a new one. First, I need a ‎trigger. Click “Device,” select “table-saw”, and select the “table saw current”. In the ‎‎“Above” field, I’ll put 2 so when it changes above two amps, I want to turn on the dust ‎collector.

collector_25

collector_26

So, let's try that out. The dust collector turned on when the current went up over two ‎amps! But there's a problem. When the current went back down to zero amps, the dust ‎collector was still on. I need to fix that in the automation. Now my automation has two ‎triggers. If the table saw current goes above two amps or it goes below two amps, it will ‎then go to the actions. If the dust collector relay is already on, it turns the relay off. ‎Otherwise, it turns the relay on.‎

try_27

try_28

Let's test that out again. When I turn on the table saw, the current will go above two ‎amps and it'll turn on the dust collector. As soon as I turn off the table saw that current ‎falls below two amps, so the dust collector should also turn off. It worked! The dust ‎collector turned on and immediately turned off as soon as the current dropped below ‎two amps.

amps_29

amps_30

Now all I need to do is just program more of these Sonoff S31s, add them to each of my ‎tools around my shop, and then create automations so it turns on the dust collector ‎when the current goes above a certain threshold.‎

Over here in my woodshop area, I'm going to plug my dust collector into the Sonoff ‎S31 that I programmed for it. Then, I'll plug my table saw into the Sonoff S31 that I ‎programmed for it. With both of those things plugged in, I'll make some test cuts on my ‎table saw and see if the dust collector turns on automatically. I also programmed ‎Sonoff S31s for my miter saw, band saw, and random orbital sander. Whenever I use ‎these tools, the dust collection system should kick on automatically.‎

auto_31

auto_32

auto_33

This is an awesome addition to my wood shop because it keeps my lungs protected, ‎and I don't have to remember to turn it on manually… but it's missing something, and ‎that something is blast gates. Next time, I'm going to show you how I designed and built ‎automatic blast gates that open and close when the tools turn on. That way I don't ‎waste suction in the areas of the workshop where it's not needed.‎

workshop_34

workshop_35

workshop_36

workshop_37

制造商零件编号 145335-1
OPENING TOOL 5-PACK
iFixit
¥43.56
Details
制造商零件编号 5433
POGO PIN PROBE CLIP - 6 PINS WIT
Adafruit Industries LLC
¥96.95
Details
制造商零件编号 SC1112
SBC 2.4GHZ 4 CORE 8GB RAM
Raspberry Pi
¥651.21
Details
Add all DigiKey Parts to Cart
TechForum

Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.

Visit TechForum