Let me know

Is there any feature I should add? Add a comment on my new Chat Page

Octoprint remote printer on/off

A project that I have meaning to complete for a few years now.  I bought the parts and they have been sitting in a drawer.   Excellent time to complete it.


The newly setup Pi 3B with the latest Octopi 0.17.0 installed.  The Raspberry Pi fitted in the Flirc metal heat-sink case. 


There are several OctoPrint plugins that control smart switches over WiFi and also commands to talk to your printer to shut its power supply down [computer power supply types].   

I wanted hardwired external relays controlled from the OctoPrint screen triggered from the Raspberry Pi that it runs on. 

The homemade breakout board for the Pi header.  This connects to the 5V and Ground pins plus three GPIO outputs - relay triggers 1 & 2 and the Pi-shutdown

The mini header board in the relay box

The reset switch soldered to a small board

This control is based on code by Jeffeb3 on thingiverse [thing:1428478] which adds really nice additional text to the OctoPrint shutdown drop box tab via "system commands".

Check out his page but it basically requires that you add four small small scripts to "/usr/local/bin/" directory of the Pi.   These allow writing ON or OFF commands to the selected Pi GPIOs. 

Example code to make GPIO-23 go low; "write 23 1" would be high to trigger relay.  Some relays switch low so just adjust as required:

printer_off.sh:
#!/bin/bash
gpio export 23 out
gpio -g write 23 0

Then in the OctroPrint config.yaml you add an extra"system command" script to create and show the commands on the OctoPrint drop down menu.

system:
  actions:
  - action: poff
    command: printer_off.sh
    confirm: Are you sure you want to turn off the printer?
    name: PrinterOff

(I just changed name: text to Printer Off [relay-23])


I can now control the power ON and OFF of my printer and also a lamp from anywhere on my home network.  As a nice extra, I have used the "Shutdown Printer" plugin to trigger the relays.    "Shutdown Printer" can issue GCODE commands - these can trigger custom OCTO GCodes which can point towards raspberry pi commands.


So using "GCODE System Command" plugin I can activate the scripts. I added a master script that turns off both printer and lamp [OCTO904 below]

The Rapsberry Pi command shutdown is based on Andreas Spiess "the guy with the Swiss accent" and his suggested "dtoverlay=gpio-shutdown,gpio_pin=3,active_low=1,gpio_pull=up" added to the config.txt file.


Parts used:
Flirc aluminium Pi3 case
SF-Innovations "mains switch widgets"  - https://www.sf-innovations.co.uk/automation
Raspberry Pi 3B and power supply
32GB SanDisk Ultra micro SD card
Octoprint Octopi 0.17.0 image file  - https://octoprint.org/download/
Plugin - GCode System Command - https://plugins.octoprint.org/plugins/gcodesystemcommands/
Plugin - Automatic Shutdown - https://plugins.octoprint.org/plugins/automaticshutdown/
Plastic dual gang back box [UK size] and lid
Switches [mini pcb type] and header pins, power cables etc.
Jeffreb3 - Thingiverse - https://www.thingiverse.com/thing:1428478
Andreas Spiess - https://www.sensorsiot.org/raspberry-pi-tricks/
Joe Mike Terranella  - excellent series of OctoPrint tutorials inc the watch folder setup - https://www.youtube.com/watch?v=RQ3ufPo95lg

IMPORTANT - THIS PROJECT INVOLVES LIVE HIGH VOLTAGE MAINS SWITCHING!  If you do not understand how to work with high voltage electrical circuits - do not touch them. Get a qualified electrician to assist.


Nigel's second head watching proceedings.  Protected with his Prusa Covid19 visor 



Comments

  1. ROFL, I just finished looking at the octoprint, not a full minute ago. What are the odds?
    Interesting build. I hope it works for you.
    Oh, the face shields? FYI: I watched a video on that earlier this morning. The person warned that makers are finding their donations turned down. Some hospitals don't need them. Or, they will only accept the donation if it is printed and handled in a sterile environment.

    ReplyDelete
    Replies
    1. Hi, hope your keeping well. There are issues with the visors and keeping them sterile. I've supplied to our local doctors and ambulance teams and they clean them again themselves. The Prusa design lacks a top cover so some hospitals don't want them. At the moment I'm supplying to local care homes and cannot print enough. Over a 100 made myself and also now working with someone local who has 5x 3D machines so between us we produce a lot.
      OctoPrint is great. Couldn't live without it. I've used it since I first started printing with my old Wanhoa i3. Talking of which, finally finishing off upgrading the Wanhoa now I'v got some time to tinker around. Nearly there, keep getting distracted though. I feel a new video coming soon!

      Delete

Post a Comment