based on a tutorial by Bernd Zeimetz
first run the following command to find the vendor and product id of your printer:
lsusb -v | grep -iE '(^bus|idvendor|idproduct)'
Example output:
Bus 001 Device 013: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
idVendor 0x1a86 QinHeng Electronics
idProduct 0x7523 HL-340 USB-Serial adapter
Note down the idVendor and idProduct without the 0x. In this case:
- idVendor: 1a86
- idProduct: 7523
If you don't know which device is your printer run the command once with the printer disconnected and again with the printer connected and turned on and compare the outputs of the command.
create the file 90-3dprinter.rules
in the folder /etc/udev/rules.d
using the example content in this gist and replace the <idVendor>
and <idProduct>
placeholders with the values noted down above.
create the file octoprint_connect@%k.service
in the folder /etc/systemd/system
using the example content in this gist. Replace <baud_rate>
with the baud rate of your printer and <api_token>
with a valid octoprint api token. (you can generate one in the octoprint settings)
run sudo systemctl daemon-reload
Your printer should now automatically connect to octoprint when physically connected to the Pi and turned on