please choosego to mobile | Continue to access the PC version
View: 106567|Reply: 59

OrangePi Plus OctoPrint and 3D Printer

[Copy link]

3

threads

96

posts

539

credits

Senior member

Rank: 4

credits
539
Published in 2015-10-26 14:21:49 | Show all floors |Read mode
Edited by Survive-Pi at 2015-10-25 23:29

Well, great idea from @toxuin. Thanks! I had an Arduino clone connected to my Pi yesterday. Next step is connect to my 3D printer. Installed (most) of OctoPrint... had one error... Now I just have to figure out how to fix it and run it. They are sharing the same desk, no connection yet...

This thread contains more resources

You need to Log in to download or view,No account?    Register

x
Orange Pi Plus

2

threads

34

posts

419

credits

Intermediate member

Rank: 3Rank: 3

credits
419
Published in 2015-10-28 05:53:32 | Show all floors
Edited by toxuin at 2015-10-27 20:36

Here's a wild instruction for setting up your OrangePi as an Octoprint server with webcam and everything.
All the actions were performed on Loboris' Ubuntu Wily mini fresh install. I won't be describing how to install it on your specific board though.

Target:
- To have a Octoprint autostart with system boot
- Webcam service startable from Web UI
- OrangePi shutdownable from Web UI

1. Create a new user for Octoprint.
  1. sudo adduser octoprint
  2. sudo usermod -a -G tty octoprint
  3. sudo usermod -a -G dialout octoprint
Copy code


2. Add octoprint to sudoers group to be able to execute system things from UI
  1. sudo adduser octoprint sudo
  2. sudo visudo
Copy code

Put this on the last line of the opened file:
  1. octoprint ALL=(ALL) NOPASSWD:ALL
Copy code

Now, remove any password from octoprint user
  1. sudo passwd octoprint -d
Copy code


3. Install needed packages for Octoprint
  1. sudo apt-get install python-pip python-dev git python-setuptools psmisc
Copy code


4. Log in as octoprint user
  1. sudo su octoprint
Copy code


5. Make sure you're using the right version of pyserial (2.7)
  1. cd ~
  2. wget https://pypi.python.org/packages/source/p/pyserial/pyserial-2.7.tar.gz
  3. tar -zxf pyserial-2.7.tar.gz
  4. cd pyserial-2.7
  5. sudo python setup.py install
Copy code


6. Get and install the latest Octoprint
  1. cd ~
  2. git clone https://github.com/foosel/OctoPrint.git
  3. cd OctoPrint
  4. sudo python setup.py install
Copy code


7. Get the webcam server
(first, make sure your webcam is visible as /dev/video0)
  1. cd ~
  2. wget https://dl.dropboxusercontent.com/u/5758571/orangepi/mjpg-streamer.tar.gz
  3. tar -xzf mjpg-streamer.tar.gz
Copy code


8. Start your octoprint installation
  1. cd ~/OctoPrint
  2. ./run
Copy code

Open your browser, go to the machine address at port 5000. The address should look like this: http://192.168.0.11:5000/
To determine you OrangePi's IP address:
  1. ifconfig
Copy code

Look for anything starting with 192.168. – probably shouldn't be too much output there.

If you did everything correct your Octoprint UI should come up (give it a minute or two for the first launch).
Here you will be asked to enter admin password – DO IT. That's not your orangepi-orangepi default password, that's a password you'll be using to log in to Octoprint web interface. Make something up.

Next, you need log in and go to Settings (top right corner). Here you can set up your webcam paths:
For stream url: /webcam/?action=stream
For still image: /webcam/?action=snapshot
You can click save and go back to your terminal. There, press Ctrl+C on your running Octoprint process and it should say "Good bye" – that's okay.
We need to edit it's config file to give it ability to start and stop the webcam server and to shutdown the OrangePi from the browser. Neato!
  1. nano ~/.octoprint/config.yaml
Copy code

Here, you need to add additional block to the end of the file (save all the spaces and indentation):

  1. system:
  2.   actions:
  3.   - action: streamon
  4.     command: /home/octoprint/mjpg-streamer/run.sh
  5.     confirm: false
  6.     name: Start Webcam
  7.   - action: streamoff
  8.     command: killall mjpg_streamer
  9.     confirm: false
  10.     name: Stop Webcam
  11.   - action: powerdown
  12.     command: sudo poweroff
  13.     confirm: true
  14.     name: Shutdown System
Copy code



9. Install HAProxy
  1. sudo apt-get install haproxy
  2. sudo nano /etc/haproxy/haproxy.cfg
Copy code

Now make that file look like this:

  1. global
  2.         maxconn 4096
  3.         user haproxy
  4.         group haproxy
  5.         daemon
  6.         log 127.0.0.1 local0 debug

  7. defaults
  8.         log     global
  9.         mode    http
  10.         option  httplog
  11.         option  dontlognull
  12.         retries 3
  13.         option redispatch
  14.         option http-server-close
  15.         option forwardfor
  16.         maxconn 2000
  17.         timeout connect 5s
  18.         timeout client  15min
  19.         timeout server  15min

  20. frontend public
  21.         bind *:80
  22.         use_backend webcam if { path_beg /webcam/ }
  23.         default_backend octoprint

  24. backend octoprint
  25.         option forwardfor
  26.         server octoprint1 127.0.0.1:5000

  27. backend webcam
  28.         reqrep ^([^\ :]*)\ /webcam/(.*)     \1\ /\2
  29.         server webcam1  127.0.0.1:8080
Copy code


10. Start your HAProxy
  1. sudo service haproxy start
Copy code


11. Install FFMPEG to make timelapse videos!
  1. sudo apt-get install ffmpeg
Copy code


12. Make Octoprint a service with autostart
  1. sudo nano ~/OctoPrint/scripts/octoprint.default
Copy code

Find "username" and change it to "octoprint".
  1. sudo cp ~/OctoPrint/scripts/octoprint.init /etc/init.d/octoprint
  2. sudo cp ~/OctoPrint/scripts/octoprint.default /etc/default/octoprint
  3. sudo chmod +x /etc/init.d/octoprint
  4. sudo update-rc.d octoprint defaults
Copy code


Make sure you have something in your /usr/local/bin/octoprint. To test if not:
  1. cat /usr/local/bin/octoprint
Copy code

There should be some output with python code.

13. Install CuraEngine to slice your STL's right on OrangePi!
  1. cd ~
  2. wget https://dl.dropboxusercontent.com/u/5758571/orangepi/CuraEngine
Copy code


14. Configure your Octoprint installation
  1. sudo reboot
Copy code

Wait about 2 minutes while your OrangePi reboots. Then, you should be able to go to your IP address (without :5000, like http://192.168.0.13/ ).
Test if you can start and stop your webcam (System menu on the right top corner once you log in) – messages should be green and you should be able to see through your webcam on the Control tab.
Now, if everything is all right – you can close the terminal.

15. Configure your Octoprint installation
Open Settings menu from top right corner and go through the menus setting vaules as decribed:
- Path to CuraEngine: /home/octoprint/CuraEngine
- Path to FFMPEG: ffmpeg

From this point go throught Settings again and adjust everything according to your taste.
To make CuraEngine slice STL's for you you'll need a .ini with your printer profile. To create one use desktop installation of Cura 15.04 (NOT 15.06+!!!), punch all your settings to your desktop Cura and press Export profile from the menu. You'll get a file that you have to upload to your Octoprint at CuraEngine section in Settings.

To send GCode to your printer from Slic3r set some API Key in your octoprint and put it in your Slic3r settings. You can also use Autoselect plugin for Octoprint to automatically select/start fresh print jobs once a file is uploaded (and no job is active).

I hope it helps!

0

threads

3

posts

12

credits

Novice

Rank: 1

credits
12
Published in 2015-11-16 10:45:02 | Show all floors
mjpg-streamer won't work with this camera module/driver combination.

mjpg-streamer wants a MJPEG or YUV image stream from the camera. Unfortunately, it looks like the implementation of the driver for this camera module does not let it enter that mode. The only mode that works is UYVY mode which the motion software does support. The driver  for this module from Android appears to be a better/more complete implementation but it is not ready to be compiled for this platform(due to android specific dependencies in the code).

For now your best off using motion to stream video from this module (or getting a different webcam if you really want to use mjpg-streamer).

2

threads

34

posts

419

credits

Intermediate member

Rank: 3Rank: 3

credits
419
Published in 2015-10-31 10:29:36 | Show all floors
Edited by toxuin at 2015-10-30 18:30
Survive-Pi replied at 2015-10-30 17:49
What commands do I need to to copy a file from boot on sd card to /usr/local/bin? Thanks.

Is your sd card mounted as /boot ?.. If yes:
  1. sudo cp /boot/filename /usr/local/bin
Copy code

If not:
  1. cd ~
  2. mkdir sd
  3. sudo mount /dev/mmcblk0p2 sd
  4. sudo cp sd/filename /usr/local/bin
Copy code


Are you talking about some specific file or just a abstract thing?..
Here's the idea: command "cp" copies files. First argument is where from, second is where to.
Some locations are "protected" by system and you cannot normally copy things there or from there – like /usr/local/boot. To tell system that you're sure you are doing the right thing we need a sudo command.


This thread contains more resources

You need to Log in to download or view,No account?    Register

x

2

threads

34

posts

419

credits

Intermediate member

Rank: 3Rank: 3

credits
419
Published in 2015-10-30 07:51:40 | Show all floors
You'll be able to log in to 127.0.0.1:5000 only from the same machine since 127.0.0.1 means "localhost". You can log in on 5000 port from every other machine on the same network. You can log in on port 80 ( = not specifying port at all) if your haproxy is configured and running.
By the way it just crossed my mind – HAProxy not configured can prohibit you from seeing anything from your webcam on Control tab. However try to start the webcam server through octoprint UI and then open http://192.168.xx.xx:8080/?action=stream – change the xx.xx to you orangePi's IP. Should be an image there even if HAProxy is not configured.
My printer is on service now. Installing custom cut heated bed... -_-

2

threads

34

posts

419

credits

Intermediate member

Rank: 3Rank: 3

credits
419
Published in 2015-10-29 06:10:39 | Show all floors
Survive-Pi replied at 2015-10-28 13:45
orangepi@OrangePI:~$ sudo modprobe gc2035
sudo: unable to resolve host OrangePI
[sudo] password for  ...

To quickly solve this annoying thing:
  1. sudo: unable to resolve host OrangePI
Copy code
do the
  1. sudo nano /etc/hosts
Copy code
and find line
  1. 127.0.0.1       localhost
Copy code
make it look like this:
  1. 127.0.0.1       localhost OrangePI
Copy code
Hit Ctrl+X, Y.

Other thing, the module problem:

it's not vfe_v412, it's vfe_v4l2 there's small L, not 1 (one):-D That probably stands for "Virtual Frame Buffer _ Video 4(for) Linux v2.Kernel Object" :-)

  1. modprobe: FATAL: Module vfe_v412 not found.
Copy code
means there is no driver for the ribbon camera in your kernel/system. Did you run loboris's update_kernel.sh script btw?.. Looks like you didn't.
Try to do the
  1. uname -r
Copy code
if the output contains "-lobo" – you did. If not – do this:
go here https://mega.nz/#F!wh8l2BjK!OBep3nMldBletvNNwkH2Jg download file update_kernel.sh, put it on your orangepi somehow (like dropbox+wget or just FileZilla will do it). Then, given you've put it into your ~ directory, do
  1. chmod +x update_kernel.sh
  2. sudo ./update_kernel.sh
Copy code

Then, reboot and again, do the thing from my last post with modprobe. Should work since I can see the vfe_v4l2.ko driver present in the new kernel update.

2

threads

34

posts

419

credits

Intermediate member

Rank: 3Rank: 3

credits
419
Published in 2015-10-28 13:22:10 | Show all floors
[Errno 98] Address already in use
Means, your octoprint is already running! Go to your browser, punch in the IP of your Orange Pi with port 5000 and BEHOLD.

2

threads

34

posts

419

credits

Intermediate member

Rank: 3Rank: 3

credits
419
Published in 2015-10-27 16:13:32 | Show all floors
Whoa, you are actually running a desktop environment on the same machine as octoprint, lol!
To open up the Octoprint you fire up your browser and go to localhost – if your browser is on the same machine, or IP address of your OrangePI at port 5000 if not. (like http://192.168.1.11:5000/ ).
I might as well just make a SD image of my Octoprint OrangePI and post it here. Need to check if I removed any sensible information from it first though.

3

threads

96

posts

539

credits

Senior member

Rank: 4

credits
539
 Author| Published in 2015-10-28 06:21:05 | Show all floors
toxuin replied at 2015-10-27 14:53
Here's a wild instruction for setting up your OrangePi as an Octoprint server with webcam and everyt ...

Thanks! That looks like some step-by-step instructions I can follow! LOL. I had to install a Desktop to find anything! Then I go back and forth between terminal/putty/desktop and try things.You have OctoPrint working on wily, I had wily running properly on my Pi 3-4 days ago so I can get back to there and then follow your instructions.
Thanks so much for your efforts!

Awesome printer btw, I like the thought that went into it! Could you print 2 sets of cantilevers on the small printer and support both sides of the bed at same time? Saves printing something to throw away and gives you the necesary support. (I did'nt register to view the other cad files for final version, not sure how you support the bed in that one.).

Thanks again.

Orange Pi Plus

2

threads

34

posts

419

credits

Intermediate member

Rank: 3Rank: 3

credits
419
Published in 2015-10-28 09:12:09 | Show all floors
Survive-Pi replied at 2015-10-27 14:21
Thanks! That looks like some step-by-step instructions I can follow! LOL. I had to install a Deskt ...

Pretty much! Only you'd better throw away the cantilevered stage support – you'll replace it with wider (190mm) part that you can print while using old part (90mm). Like space rockets and their stages of some sort.
Cantilevered bed only relies on 2 smooth rods at one side. Non-cantilever bed is supported on both sides with 4 rods in total. To avoid wiggle along the X axis you really want to make those support rods as far from each other as possible – hence the wide stage supports.
My buddy told me he's using a cantilever bed on his crazy 550 mm setup without any issues. I wouldn't go that way though – cantilevered bed on a printer that big is a path to fail, sooner or later.

Anyways, that's a bit off-topic :-D

3

threads

96

posts

539

credits

Senior member

Rank: 4

credits
539
 Author| Published in 2015-10-28 10:31:40 | Show all floors
Edited by Survive-Pi at 2015-10-27 19:33

Is fatal error halfway down important? Step #6. Proceeded to a happy end...


Installed /usr/local/lib/python2.7/dist-packages/Flask_Login-0   .2.2-py2.7.egg
Searching for PyYAML==3.10
Reading https://pypi.python.org/simple/PyYAML/
Best match: PyYAML 3.10
Downloading https://pypi.python.org/packages/source/P/PyYAML/P   yYAML-3.10.zip#md5=b1a2b30cdf481da4249c917c3307f129
Processing PyYAML-3.10.zip
Writing /tmp/easy_install-bA38Kg/PyYAML-3.10/setup.cfg
Running PyYAML-3.10/setup.py -q bdist_egg --dist-dir /tmp/easy   _install-bA38Kg/PyYAML-3.10/egg-dist-tmp-4tJX3e
build/temp.linux-armv7l-2.7/check_libyaml.c:2:18: fatal error:    yaml.h: No such file or directory
compilation terminated.


libyaml is not found or a compiler error: forcing --without-li   byaml
(if libyaml is installed correctly, you may need to
specify the option --include-dirs or uncomment and
modify the parameter include_dirs in setup.cfg)
zip_safe flag not set; analyzing archive contents...
Moving PyYAML-3.10-py2.7-linux-armv7l.egg to /usr/local/lib/py   thon2.7/dist-packages
Adding PyYAML 3.10 to easy-install.pth file
Orange Pi Plus

3

threads

96

posts

539

credits

Senior member

Rank: 4

credits
539
 Author| Published in 2015-10-28 10:41:24 | Show all floors
And then steps 7 and 8...8 doesn't work...

octoprint@OrangePI:~$ tar -xzf mjpg-streamer.tar.gz
octoprint@OrangePI:~$ cd OctoPrint
octoprint@OrangePI:~/OctoPrint$ cd
octoprint@OrangePI:~$ cd ~/OctoPrint
octoprint@OrangePI:~/OctoPrint$ ./run.sh
bash: ./run.sh: No such file or directory
octoprint@OrangePI:~/OctoPrint$
Orange Pi Plus

3

threads

96

posts

539

credits

Senior member

Rank: 4

credits
539
 Author| Published in 2015-10-28 11:25:45 | Show all floors
octoprint@OrangePI:~/OctoPrint$ ls -a
.                .git              src
..               .gitattributes    tests
AUTHORS.md       .gitignore        translations
babel.cfg        LICENSE           .travis.yml
build            MANIFEST.in       .tx
CHANGELOG.md     README.md         .versioneer-lookup
CONTRIBUTING.md  requirements.txt  versioneer.py
dist             run               versioneer.pyc
docs             scripts
.editorconfig    setup.py
octoprint@OrangePI:~/OctoPrint$
Orange Pi Plus

2

threads

34

posts

419

credits

Intermediate member

Rank: 3Rank: 3

credits
419
Published in 2015-10-28 12:35:52 | Show all floors
Yep, my bad. It's not ./run.sh, it's just ./run. I'll update the instruction.

3

threads

96

posts

539

credits

Senior member

Rank: 4

credits
539
 Author| Published in 2015-10-28 13:14:32 | Show all floors
Edited by Survive-Pi at 2015-10-30 08:44
toxuin replied at 2015-10-27 21:35
Yep, my bad. It's not ./run.sh, it's just ./run. I'll update the instruction.

octoprint@OrangePI:~$ cd OctoPrint
octoprint@OrangePI:~/OctoPrint$ ./run
********************************
error: [Errno 98] Address already in use
octoprint@OrangePI:~/OctoPrint$


Orange Pi Plus
You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list