Install and Set Up the OctoPrint Serial IO Plugin and Control Board

by John Cassel in Circuits > Computers

502 Views, 1 Favorites, 0 Comments

Install and Set Up the OctoPrint Serial IO Plugin and Control Board

SIOController_WMR_R2_Enclosure_1.png

With current high price of a Raspberry Pi due to low availability, many have had to make use of small form factor PCs.

With that comes one main limitation. There is no IO (RPIO/GPIO) directly available on the standard PC. To correct for that, I have created an OctoPrint plugin and companion firmware to work together to get this feature when using a standard PC instead of a Raspberry Pi. The Plugin is called SIO Control. It makes controlling relays or reading and reacting to inputs like a filament runout sensor or emergency stop button as simple as possible. If you used one of the purpose built control boards, all you have to do is follow the wiring directions and connect your peripherals.

Supplies

  • A computer/device that is running OctoPrint and at least one available USB port.
  • A control board loaded with OctoPrint Serial IO compatible firmware.
  • A PL2303 USB to UART TTL cable that you can allocate permanently to this project.
  • A 3d printer that you want to control and monitor.

Prepare Serial IO Control Board

Board-Top2.PNG
USBToUART_TTL1.JPG

Set up your Serial IO Controller. If you used one of the controllers listed on GitHub with example firmware you should there are comments in the code that can be used as a guide to understand how to make connections.

The basics of this step are to decide on the controller of choice and flash it with the compatible firmware. If you are unsure of how to accomplish this step, the firmware creator has some options of where to purchase already configured controller boards.


Once you have a control board flashed, you can move go to the next step.

Install OctoPrint SerialIO Plugin

OctoPrint-PluginManager.PNG

In this step, you will install the Serial IO Plugin from the OctoPrint Plugin Manager dialog.


You can only install plugins when you are not actively printing with OctoPrint. Navigate to the Plugin Manager dialog by selecting the wrench icon at the top right of the OctoPrint interface. Then select from the left dialog menu "Plugin Manager"

  1. Select [+ Get More]
  2. Search for SerialIO
  3. Install the Plugin.

You will then be prompted to restart OctoPrint. Once this is completed, you can move on to the next step.

Prepare to Connect to the Serial IO Board

PrinterConnection_defaultView.PNG
PrinterConnection_SelectedView.PNG

Don't plug the USB cable for your SIO Control board just yet.


Before we connect the SIO Board and update it's settings, its been noted that OctoPrint can confuse the SIO Control board for your printer so you should ensure that you make sure that you know what port your printer is connected on. before you connect and set up your SIO Control board connection. Let's do that now.

At the top of the screen on the left side(Shown in the second image above) you will see the connection info for your printer. Most of the time this is all set to "AUTO", "AUTO", and "default". Your setup might vary a little. We want to ensure that OctoPrint selects the well-known port that our printer is on. You may need to disconnect from your printer to update these settings. Next select the correct port that your printer is connecting on. You can leave the "Baudrate" and "Printer Profile" as they are. Select the [Save connection settings] checkbox and mash that Connect button. (Shown in the image above). Something else you can do to help with this once you have your SIO Control board connected on a known port, you can add the SIO Control port to the Serial Connection Blacklisted serial ports list. This is found in the settings dialog as the very first item at the top left.

With your printer connected as expected you can continue to the next step. If not try following the above directions again. It should be enough to get you there.

Once you have updated the port and successfully connected to your printer, you can move on to the next step.

Getting the SerialIO Board Connected

InitialViewSIOControlSidebar.PNG
SIO_Control_dialog_SerialConnectionParams.PNG
LinuxSerialConnectionList.PNG

Ok, now we can take a look at the SIO Control setup dialog. To access the setup dialog, you can use the shortcut on the sidebar for the Plugin. It's the gear button inside the SIO Control sidebar section. Or you can take the long way around and go into the configuration Dialog using the wrench icon at the top right of the screen and then select [SIO Control] from the list on the left. It can be down a little ways depending on your setup it's in the PLUGINS section. This dialog is shown in the second image at the top of this step.

Plug in the SIO Controller and hit the port refresh button on the right side of Communications Port Select...


Depending on your OS and other items connected to your OctoPrint instance, you should see 1 or more ports listed in the selection box. On Windows, likely you will see just the new one created when you plugged in your board. On Linux (most of you) you will see a lot of items listed. Something like the 3rd image above. That image shows 2 USB Serial connections. Likely you will only have one of these listed. That is the Serial IO board connection. Select that and verify that the baud rate is set to 115200 then you can click the connect button to the right of the port selection. It sorta looks like an ear. Wait a few seconds and it should change the message there to connected.


Click save now and then reopen the dialog. If you leave the dialog without hitting save, your selection will be lost and next time you restart OctoPrint it will not have a port selected for the Serial IO settings.

On to the next step.



Configuring the IO for Visibility in OctoPrint

SIO_Control_Configured_Example_A.PNG

For this instructable, we will ignore the section labeled "PSUControl Sub plugin integration" and focus on the other 2 sections in the configuration.

Simple Integrations section

First up here is setting up to recognize an input as an Emergency Stop (E-Stop). To configure an input as an E-Stop, you will need to enable the integration by selecting the checkbox at the left of the number box. This enables (checked) or disables (unchecked) this feature. Once enabled, you can then select the IO number of the physical IO for the board. Keep in mind this is the SIO Mapped number not the Micro Controllers IO numbering. If the input is normally closed when not triggered, you should select the Active LOW checkbox so the SIO Plugin knows that when the switch is triggered, it will bring the IO point to a low state. When enabled and triggered this will cause a code “M112” to be sent to the printer causing it to do a full stop immediately. You will have to power cycle the printer to bring it back to a useful state. 


Now we can configure an input as a filament runout sensor. When triggered this will cause OctoPrint to "Pause" printing. To make this really useful, you will need to setup some sequence of operations within the GCode Scripts section of OctoPrint. The details of this are outside the scope of this instructable. To help you get started though, there is a good write up of how to set it up on the main page for this plugIn.


Moving on to general IO setup. This is done in the Configuration section at the bottom of the dialog.

It is important to note that you need to know what the Mapped IO points for your controller are before you start to do this setup. If you built your IO Board DIY style, you should know what this is.. If you purchased a Purpose built SIO Control board, the documentation that came with it will call this out and has additional information on how to do this configurations section that is specific to the board you purchased.

To add a new IO Point to control or monitor, select the blue plus button. This will add a new row for your IO point to the configuration dialog.

Each row has 5 items to set to configure that point.

The first there is [ Icon ], use the Icon selector to pick an icon that symbolizes the use of your IO Point. For example, a light bulb for a light that you might have connected to an output relay. Or a Lightning bolt for a connection to power up your printer.

Second [ Label ] is the Name for the IO point. Keep this short. A max of 18 letters works well. If you make it long it will display but its not nice to look at in the sidebar space.

Third [ IO# ] is the Mapped IO number. Select the IO point that is correct for the point you are defining.

The fourth item [ Active As ] does 2 things, it sets the type of IO you are trying to config and sets what logic level it is when Active.

For example "Out_High" means that the IO Point is an output and when it goes logic High it is considered "On"

The fifth and final configuration for a point is [Default To]. This is only applied to outputs. Set this to the state you would like the the output set to when OctoPrint starts up. This setting is only applied when OctoPrint starts. It will not be set if you reset the SIO Board.

The images at the top of this step show a completed IO configuration for 2 outputs and one input. The top shows the configuration settings screen and the bottom shows how it will display on the sidebar.

Tip: if you make changes to an existing IO Point configuration, you may need to refresh the main screen to get it to reflect in the sidebar.


Once you have configured your IO, you can hit save. This will close the dialog and you should see your IO show up for monitoring and control in the sidebar similar to what you see in the image at the stop of this step.


Happy IO Controlling