Sunday, October 23, 2016

Qidi Avatar IV, OrangePi Lite and OctoPrint

Pre-condition: I have configured a user named 'user' with the home folder '/home/user', and I'm running on armbian 3.4.112 (see previous post for the setup).

Installation of OctoPrint
Here are a bunch of commands to install python and python-dev (it should work with apt-get, but at the time of writing some libs with the right version are missing in the repositoy, and I couldn't get it using exact this version)
---cut here begin---
cd /home/user/

wget http://ftp.us.debian.org/debian/pool/main/p/python2.7/python2.7-dev_2.7.9-2+deb8u1_armhf.deb
wget http://ftp.us.debian.org/debian/pool/main/p/python2.7/python2.7_2.7.9-2+deb8u1_armhf.deb
wget http://ftp.us.debian.org/debian/pool/main/p/python-defaults/libpython-stdlib_2.7.9-1_armhf.deb
wget http://ftp.us.debian.org/debian/pool/main/p/python2.7/python2.7-minimal_2.7.9-2+deb8u1_armhf.deb
wget http://ftp.us.debian.org/debian/pool/main/p/python-defaults/python-minimal_2.7.9-1_armhf.deb
wget http://ftp.us.debian.org/debian/pool/main/p/python-defaults/python_2.7.9-1_armhf.deb
wget http://ftp.us.debian.org/debian/pool/main/p/python2.7/libpython2.7-minimal_2.7.9-2+deb8u1_armhf.deb
wget http://ftp.us.debian.org/debian/pool/main/p/python2.7/libpython2.7-stdlib_2.7.9-2+deb8u1_armhf.deb
wget http://ftp.us.debian.org/debian/pool/main/p/python2.7/libpython2.7_2.7.9-2+deb8u1_armhf.deb
wget http://ftp.us.debian.org/debian/pool/main/e/expat/libexpat1-dev_2.1.0-6+deb8u3_armhf.deb
wget http://ftp.us.debian.org/debian/pool/main/g/glibc/multiarch-support_2.19-18+deb8u6_armhf.deb
wget http://ftp.us.debian.org/debian/pool/main/p/python2.7/libpython2.7-dev_2.7.9-2+deb8u1_armhf.deb
wget http://ftp.us.debian.org/debian/pool/main/p/python-defaults/libpython-dev_2.7.9-1_armhf.deb
wget http://ftp.us.debian.org/debian/pool/main/p/python-defaults/python-dev_2.7.9-1_armhf.deb

dpkg -i libpython2.7-minimal_2.7.9-2+deb8u1_armhf.deb
dpkg -i libpython2.7-stdlib_2.7.9-2+deb8u1_armhf.deb
dpkg -i multiarch-support_2.19-18+deb8u6_armhf.deb
dpkg -i libpython2.7_2.7.9-2+deb8u1_armhf.deb
dpkg -i libexpat1-dev_2.1.0-6+deb8u3_armhf.deb
dpkg -i libpython2.7-dev_2.7.9-2+deb8u1_armhf.deb
dpkg -i libpython-dev_2.7.9-1_armhf.deb
dpkg -i python2.7-minimal_2.7.9-2+deb8u1_armhf.deb
dpkg -i python-minimal_2.7.9-1_armhf.deb
dpkg -i libpython-stdlib_2.7.9-1_armhf.deb
dpkg -i python2.7_2.7.9-2+deb8u1_armhf.deb
dpkg -i python_2.7.9-1_armhf.deb
dpkg -i python2.7-dev_2.7.9-2+deb8u1_armhf.deb
dpkg -i python-dev_2.7.9-1_armhf.deb
rm *.deb
---cut here end---

Installation of additional packages, set of user permissions and initial run of OctoPrint:
---cut here begin---
apt-get install python-pip python-setuptools python-virtualenv git libyaml-dev build-essential
apt-get autoremove
pip install virtualenv --upgrade
usermod -a -G tty user
usermod -a -G dialout user

su - user
git clone https://github.com/foosel/OctoPrint.git
cd OctoPrint
virtualenv venv
./venv/bin/python setup.py install
 /home/user/OctoPrint/venv/bin/octoprint
---cut here end---

Additional configuration
The OctoPrint server will start on port 5000, in my case it is 'http://192.168.0.5:5000'. Setup username and password, then login.
For the Qidi Avatar (or Makerbot or any Makerbot clone) follow these steps (as the serial port doesn't understand the standard G-code but only a binary language called x3g):
Go to 'Settings', 'Plugin Manager', get to 'Get more...' plugins and search for 'GPX' in order to install the GPX plugin.
Go to 'Setting', select the 'GPX' plugin and select your printer, for the Qidi Avatar IV it's the 'Replicator 1 - dual extruder', this will create the file '/home/user/.octoprint/data/GPX/gpx.ini'.

Go to 'Settings, 'Printer profile', click on edit and adjust the profile, for the Qidi Avatar IV:
Model: Qidi Avatar IV
Origin: Center
Volume X: 230mm
Volume Y: 145mm
Volume Z: 150mm
Number of Extruders: 2


Connect the OrangePi with an USB cable to your printer, and set the serial port name and speed. For the Qidi Avatar it is '/dev/ttyACM0' with a baudrate of '115200'. (You can check the name of the serial ports availabe over the ssh session, type 'dmesg | grep tty' to get the name of the serial port).

Autostart OctoPrint

Edit the file '/home/user/OctoPrint/scripts/octoprint.init', adjusting 'DEAMON':

DAEMON=/home/user/OctoPrint/venv/bin/octoprint

Edit the file '/home/user/OctoPrint/scripts/octoprint.default', adjusting 'OCTOPRINT_USER' and 'DEAMON':
OCTOPRINT_USER=user
DAEMON=/home/user/OctoPrint/venv/bin/octoprint

Copy these two files to the standard startup directories and automatic startup for OctoPrint:
---cut here begin---
cp /home/user/OctoPrint/scripts/octoprint.init /etc/init.d/octoprint
chmod +x /etc/init.d/octoprint
cp /home/user/OctoPrint/scripts/octoprint.default /etc/default/octoprint
update-rc.d octoprint defaults
---cut here end---

To manually start, restart, stop OctoPrint simply execute:
---cut here begin---
 service octoprint start
service octoprint restart
service octoprint stop
---cut here end---

Printing
Upload a G-code file to octoprint and then print it.

Note:
The Qidi Avatar (and other Makerbot clones) can't read or write to the SD card, due to firmware limitations. Therefore it is not possible to upload or download files on the SD card.
It should be possible to print x3g files directly from the SD card, but you won't be able to see any progress indicator and you won't be able to visualize the G-code as there's none. I didn't try this, I prefer handling G-code files over x3g, and I prefer a wireless web-interface over for printing over physical knobs.

2 comments:

  1. Admiring the time and energy you put into your website and detailed information you present. It's good to come across a blog every once in a while that isn't the same old rehashed information. Excellent read! I've bookmarked your site and I'm including your RSS feeds to my Google account.

    ReplyDelete
  2. Superb website you have here but I was wondering if you knew of any forums that cover the same topics discussed in this article? I'd really like to be a part of community where I can get comments from other knowledgeable people that share the same interest. If you have any suggestions, please let me know. Many thanks!

    ReplyDelete