____ ________ / __ \___ _ __/ ____/ /_ ___ _ __ / / / / _ \ | / / / / __ \/ _ \ | /| / / / /_/ / __/ |/ / /___/ / / / __/ |/ |/ / /_____/\___/|___/\____/_/ /_/\___/|__/|__/

Octoprint on raspberrypi witch portainer

How to setup Octoprint on raspberrypi witch portainer and gpio access

Hardware used:

  • raspberry pi model 3
  • ender 3

Software

  • raspbian lite x32 for os
  • docker
  • portainer

Steps

0. Install clean o on raspberry pi sdcard,

if you doesnt have portaienr on raspberry pi foloww this guide [/posts/raspberryPiHomeServer](Raspberry pi homeserver)

1. Gather usb info

if printer is connected to raspberry pi, login via ssh and run this command

ls /dev | grep 'ttyUSB\|ttyACM'

this command should list all sserial devices connected. write down its name, in my case its ttyACM0

if there is only one then simply remeber its name. in other case you can in another step try different ones or connect all at one and remove unnecessary

Now lets find usb camera

v4l2-ctl --list-devices

you should see sections with name and device addres. in my case device name is USB2.0 Camera and addres /dev/video0

2 create Stack

Login to portainer, open yout envirnoment and select Stacks in sidebar, then create new by clicking on "create" on top right corner of ui

Put your stack name, in my case its Octoprint

Select Web editor and put this docker compose content

version: '2'
volumes:
  octoprint: 
services:
  ender:
    image: octoprint/octoprint
    ports:
      - 5001:80
    volumes:
      - octoprint:/octoprint
      - /sys:/sys
    devices:
      - /dev/ttyACM0:/dev/ttyACM0
      - /dev/video0:/dev/video0
      - /dev/gpiomem:/dev/gpiomem
    environment:
      - MJPG_STREAMER_INPUT=-n -r 1280x720 -f 30
      - ENABLE_MJPG_STREAMER=true
    restart: always

GPIO

    volumes:
      ...
      - /sys:/sys <- this line add direct access to gpio if plugin use filebased acces
    devices:
      ...
      - /dev/gpiomem:/dev/gpiomem <- this is acces to gpio for if plugin use api

Devices

 devices:
      - /dev/ttyACM0:/dev/ttyACM0 <- your printer address
      - /dev/video0:/dev/video0 <- your webcam address