Tuesday, January 24, 2023

Octoprint on Pogoplug V4

If you have a Pogoplug V4 (other Pogoplugs variants will probably work), another use for it could be as an Octoprint server!


Here's how I set up mine.  FYI, I've updated my Pogoplug to Debian Buster, so YMMV.

There's two sections, one is for installing mjpg-streamer, and the other is for Octoprint itself.

 

1. MJPG-STREAMER

 

apt-get install build-essential libjpeg62-turbo-dev imagemagick libv4l-dev cmake git -y

mkdir ~/mjpg-streamer
cd ~/mjpg-streamer
 
git clone https://github.com/jacksonliam/mjpg-streamer.git
cd mjpg-streamer/mjpg-streamer-experimental
 
make
make install


Then, test:

/usr/local/bin/mjpg_streamer -i "input_uvc.so -f 15 -r 640x480" \
 -o "output_http.so -w /usr/local/share/mjpg-streamer/www"

I've place the command :

/usr/local/bin/mjpg_streamer -b -i "input_uvc.so -f 15 -r 1920x1080" -o "output_http.so -w /usr/local/share/mjpg-streamer/www"

in the last line of /etc/rc.local so it will load mjpg_streamer on startup and it is accessible on port 8080 (i.e. your Pogoplug's IP address is 192.168.1.78, then the url to view the webcam is http://192.168.1.78:8080/?action=stream)


2. OCTOPRINT

 

Prior to installing Octoprint, make sure you have enough TMP folder space, as some downloads will take up more than the available space for TMP folder.

I've resized my tmp folder by editing /etc/fstab and replacing the default values for tmpfs:

tmpfs          /tmp            tmpfs   rw,nodev,nosuid,size=5G  0       0

Then reboot and do a "df" command to see how much space is available for the tmp folder. 5GB is big enough for me, but it's up to you how much you want (I think 1GB is optimal).

In order to install Octoprint, you will need a non-root user, and these steps were copied from the manual install procedure of the Raspberry Pi so we will be using the user "pi" (but be free to use your own username).

Installing Octoprint in Pogoplug

Setup pogoplug:

apt install sudo

adduser pi (or any name)
usermod -aG sudo pi

Logon as non-root user:

cd ~
sudo apt update
sudo apt install python3 python3-pip python3-dev python3-setuptools python3-venv git libyaml-dev build-essential libffi-dev libssl-dev ffmpeg
mkdir OctoPrint && cd OctoPrint
python3 -m venv venv
source venv/bin/activate


You should now be in venv (virtual machine)

pip install pip --upgrade
pip install wheel
pip install octoprint

sudo usermod -a -G tty pi
sudo usermod -a -G dialout pi


Starting the server for the first time

You should then be able to start the OctoPrint server using the octoprint serve command:

~/OctoPrint/venv/bin/octoprint serve

2020-11-03 17:39:17,979 - octoprint.startup - INFO - ***************************
2020-11-03 17:39:17,980 - octoprint.startup - INFO - Starting OctoPrint 1.8.6
2020-11-03 17:39:17,980 - octoprint.startup - INFO - ***************************


Octoprint should  then be accessible thru port 5000 of the IP address of your Pogoplug (i.e. http://192.168.1.78:5000)

You will then set Octoprint to run on startup, or manually...