Power control with Octoprint running on a Raspberry Pi.
Solid state relay controls the main power.
As the Makerfarm i3v board still gets power from the USB connection I added the two board relay.
One relay controls the USB - sliced unto a USB cable and fished out the (red) power wire.
Second relay controls the light.
The Home Depot LED light (about $19) has the transformer on the plug so the wires to the light are only carrying about 7 volts DC.
Wired the light switch so that the existing switch or the relay can provide the completed circuit.
The LED light was switching on the neutral/negative side - I would have preferred positive side but didn't want to change the wiring completely. You can see the small nick I made to test the polarity and voltage.
Added and Emergency Stop - this runs between the low voltage - so it just cuts the power to solid state relay and that drops the power on the high voltage side.
Backside of Emergency Stop used spade connectors so I could disassemble if needed.
Emergency Stop - powered.
At the end of a print I get an email and ios notification with filename, print time and snapshot.
To get it all working I created three bash scripts - turn on, turn off and print finished:
Bash Scripts:
printer_on.sh #!/bin/bash #pwr gpio export 23 out gpio -g write 23 1 #usb pwr gpio export 24 out gpio -g write 24 0 #light pwr gpio export 18 out gpio -g write 18 0 printer_off.sh #!/bin/bash #pwr gpio export 23 out gpio -g write 23 0 #usb pwr gpio export 24 out gpio -g write 24 1 #light pwr gpio export 18 out gpio -g write 18 1 printDone.sh
#!/bin/bash /bin/echo "" | /usr/bin/mail -s "$1" xxx@bxc.io /usr/bin/curl -s -o /tmp/printDone.jpg "http://localhost:8080/?action=snapshot" > /dev/null /usr/bin/mpack -s "$1" /tmp/printDone.jpg xxx@hotmail.com /home/pi/scripts/printer_off.shOctoprint config file:
system: actions: - action: printer on command: /home/pi/scripts/printer_on.sh name: Turn on the printer - action: printer off command: /home/pi/scripts/printer_off.sh confirm: You are about to turn off the printer. name: Turn off the printer events: enabled: True subscriptions: - event: PrintDone command: /home/pi/scripts/printDone.sh "Done {name} {time}" type: system - event: PrintCancelled command: /home/pi/scripts/printDone.sh "Cancelled {name}" type: system - event: PrintStarted Command: "/home/pi/scripts/webcam start" type: system
No comments:
Post a Comment