In my last project I built a cyclone dust separator from an old shop vac. If you haven't see that check it out here.
I wanted to take it one step further (because why not) and automate it. Watch the video below to see how I hooked up my newly built dust collector to my miter saw dust hood and my homemade sander. I used a small bit of code (see below) on a Raspberry Pi 3 to control the dust collector to turn it on and off automatically every time I use the tools.
The wiring diagram below details how I wired the switches on each tool into the raspberry pi as well as the relay and the power cord to the dust collector (shop vac).
Below is the code that I am using on the Raspberry Pi.
import RPi.GPIO as GPIO
#Trigger Switch & Relay Set Up
GPIO.setup(18, GPIO.IN, GPIO.PUD_UP) #Read output from switch
GPIO.setup(16, GPIO.OUT) #Relay output pin
if i==0: #When input from switch is LOW (grounded)
print "switch is pressed"
GPIO.output(16, 0) #Turn on Relay
elif i==1: #When input from switch is HIGH
print "switch is not pressed"
GPIO.output(16, 1) #Turn off Relay