Octoprint Usb Relay Printer Control

by browsem in Circuits > Computers

642 Views, 0 Favorites, 0 Comments

Octoprint Usb Relay Printer Control

203248710_max.jpg
aneta8.png
chromebox.png

Im using a hp chromebox, converted to running linux/galiumos for controlling my 3d printer, instead of the usual raspberry pi.

This has the upside of providing a lot of storage, and a lot of cpu power.

It has the downside of NOT providing any of the usual gpio of the usual raspberry pi.

So what to do , if you want to be able to turn your printer on remotely, and have it stop automatically when done ?

Supplies

Cheap ebay usb relay card

Computer running octoprint

Octoprint USB Relay control plugin

Octoprint Shutdown printer plugin.

Talend API tester (chrome plugin, hopefully this instructable can spare you from this)

Installing the Things

Firstly i installed the plugins.

Then i connected the usb relay, and a powersupply that's able to drive the relays. I didn¨t connect it to the printer just yet, as i wanted to make sure every thing worked.

But in the end, i connected the relay to the chromebox using a usb cable, and connected one of the 220V wires for the printer through the first relay. That way i can use this relay to turn the printer on/off

Configuring USB Relay Control Plugin

relayconf.png

I followed the setup instructions from the plugin, regarding files and what not.

Then I just added the relay that i wanted to use for turning the printer on/off to the list.


Configuring Shutdown Plugin

This is where the problems started for me. Im hoping to spare you some.

First i went to the Application keys setting. There i created a new api key, that i called shutdown.

Then i went on to the shutdown printer. I made sure nothing was enabled.

Then i enabled the "mode API"

Added the Api key from above to the API field.

and wrote the following

Plugin ID usbrelaycontrol

Port 5000

JSON {"command":"turnUSBRelayOff","id":"0"}

The id:0, defines the 1. relay, you can add more numbers if you need to :-)


The solution uses the REST interface of octoprint, to Turn the relay off.

I did have a TON of problems getting the interface to work for me, and ended up figuring the correct syntax using Talend API tester.

Best of luck