OctoPrint-Enclosure icon indicating copy to clipboard operation
OctoPrint-Enclosure copied to clipboard

Orange Pi Support [NEED BOARD TO IMPLEMENT]

Open coolduke666 opened this issue 6 years ago • 21 comments

the orange pi zero is an optimal octoprint server - includes wifi and is very fast, small and cheap and there is also an "wiring pi" equivalent for the orange pi, namely https://github.com/xpertsavenue/WiringOP-Zero

sadly your plugin does NOT work on the orange pi zero - there is a problem with the GPIO:

2017-10-08 07:56:46,675 - octoprint.plugins.enclosure - WARNING - An exception of type RuntimeError occurred on updateOutputUI. Arguments: ('Please set pin numbering mode using GPIO.setmode(GPIO.BOARD) or GPIO.setmode(GPIO.BCM)',)

I don't know the effort it requires, but it would be great if you support orange pi as well - your plugin is really great!

As an alternative your can simply add text-field to invoke shell-scripts once the gpio-has to be switched... because the it will work perfectly...

if you need someone for testing, please let me know!

thx!

coolduke666 avatar Oct 08 '17 06:10 coolduke666

The documentation of this plugin is clear: it only is supposed to work on Raspberry Pi family. That been said, I had a lot of requests to make it work on orange pi, vide @marcoamr2002 issue, and other emails that I got. I'm willing to make the changes and test the implementation of the Orange Pi. But I do not have an orange pi board, and I'm not going to buy one just for this purpose. So either someone donate / lend me one board so I can proper test and implement, or we will need to wait until someone does the changes and push it to my github. On the past, few people asked me to implement other temperature sensors and they shipped me the sensors so I could test them. It is almost impossible to make the changes and rely the community to test, I tried this before with no luck.

vitormhenrique avatar Oct 08 '17 16:10 vitormhenrique

thanks for the feedback. this is the answer I expected ;)

Is there anybody out there who can adapt the plugin to orange pi? would be highly appreciated!

coolduke666 avatar Oct 08 '17 16:10 coolduke666

@coolduke666 why not help get this going and support the developer at the same time by sending him an orange pi or a gift card for one? If you want to be a super awesome supporter send him enough to get one and something else to solve another users request or just extra for him to spend on something completely unrelated.

mcmasterp avatar Oct 08 '17 16:10 mcmasterp

as a general approach you could simply add options for shell scripts... so the plugin will be not only for raspberry.

eg: textfields for scripts: gpio on gpio off gpio state - return code as state

when turning gpio on/off your plugin has to invoke the script on or off. in the simple shell script everybody can utilise the proper gio implementation which works every time.

could you please implement that simple approch. so either direct switching via python GPIO or via shell script.

good idea? thx

coolduke666 avatar Oct 08 '17 16:10 coolduke666

@mcmasterp simple because I only have one and shipping another from china will take 6+ weeks...

coolduke666 avatar Oct 08 '17 16:10 coolduke666

@coolduke666 no problem Amazon to the rescue: Orange Pi One Single Board Computer Quad Core 1.3GHz 512MB DDR3 with Case and Heatsink https://www.amazon.com/dp/B01CXE2SMS/ref=cm_sw_r_cp_apa_4EL2zb2CA63PM

Good price and only two days shipping!

Best part is you can send an Amazon gift card through email super easy and a little extra could pay for something really cool he could use.

mcmasterp avatar Oct 08 '17 17:10 mcmasterp

@coolduke666 shell scrips won't be a viable solution, because of two things:

  1. This plugin uses interrupts for most of it's features, you can use as filament sensor, button to react and so something, turn on and off other gpios, smoke sensor, etc... If I use shell scripts all that functionality will be lost, and I would have to maintain two different "ways" to handle only the heater and cooling, it is just not worth. The first release was using shell scripts and I changed to pure python.
  2. Another issue is with security, octoprint does not run as sudo, so shell scripts inside the python don't have enough security to access the gpio pins, you need to manually add octoprint to gpio access and tweak a bunch of security issues.

vitormhenrique avatar Oct 09 '17 01:10 vitormhenrique

I wrote also a comment to the owner of the wiringpi zero git (https://github.com/xpertsavenue/WiringOP-Zero)... maybe he can fix this issue easily, because it look like there is a slight incompatibility with the original wiring pi for raspberry.

coolduke666 avatar Oct 09 '17 07:10 coolduke666

@mcmasterp a good idea in general... firstly I am located in europe, therefore I can't use amazon.com, I only can purchase from amazon.de, who only delivers to germany and austria.

secondly, I am a poor student and have to look at my spendings. that is the reason why I purchased a far cheaper orange pi zero, instead of a raspberry pi 3 (10 euros vs 35 euros).

when looking at your website, I realised that you are a successful business man and maybe you could help out and send the amazon gift card to the the owner - that would be great and highly appreciated by a lot the orange pi users.

coolduke666 avatar Oct 09 '17 08:10 coolduke666

@coolduke666 those are all very good reasons. I hope your studies go well and I like that you tinker with 3d printers and pi's at the same time, we need more people like you.

I did consider sending the orange pi myself since your not the first to ask about it. At the moment I have zero dollars as is the life of a self employed person but if my luck changes as it does from time to time it's on my list now. Let's both hope for a upswing soon lol. Make that all three of us, you me and my wife lol

mcmasterp avatar Oct 09 '17 12:10 mcmasterp

Guys, lets keep the conversation on this page related to the plugin. I had dedicated a lot of my free time on this plugin. And this specific change, despite I don't think would require a lot of coding it will require a lot of testing, more than 8 hours to setup and every single possibility and proper test the plugin. I have a full time job, and I do all this on my free time to help everyone, I don't usually ask for donations. If I had 25 dollars spare, I would get an orange pi and implement this, but now I can't. If 4 people contribute 6 bucks they could get an board and ship it to me. If you can't that is fine as well, you will have to wait until I can get the board / or someone ship one to me. If you have a board, you can also learn to code, learn the octoprint development documentation, make the changes and push to my github. There are a lot of ways to help.

vitormhenrique avatar Oct 09 '17 14:10 vitormhenrique

My apologies. Will do

mcmasterp avatar Oct 09 '17 14:10 mcmasterp

If you put a "Donate" button somewhere I guess you Will got the money for that. I have my dollar bill ready :-)

xinuxnt avatar Oct 29 '18 14:10 xinuxnt

@xinuxnt there is an "buy me a coffee" on the main page ;)

vitormhenrique avatar Nov 08 '18 05:11 vitormhenrique

Oh yes, but that is for you and your effort not to buy things for others! 👍 You know, I mean something apart from who was interested on an Orange Pi implementation.

On Thu, Nov 8, 2018 at 2:10 AM Vitor de Miranda Henrique < [email protected]> wrote:

@xinuxnt https://github.com/xinuxnt there is an "buy me a coffee" on the main page ;)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/vitormhenrique/OctoPrint-Enclosure/issues/67#issuecomment-436875219, or mute the thread https://github.com/notifications/unsubscribe-auth/ASiaY77c14xO21ZEU3UCfEnYVBM1HH4fks5us7y6gaJpZM4Pxm29 .

xinuxnt avatar Nov 08 '18 13:11 xinuxnt

Hi to everybody.

Any progress? :)

Kiron21 avatar May 20 '19 11:05 Kiron21

Hi again.

It seems to work!!

  1. install OPi.GPIO https://pypi.org/project/OPi.GPIO/ under your octoprint python version

sudo runuser -l octoprint -c '/home/octoprint/OctoPrint/venv/bin/pip install --upgrade OPi.GPIO'

  1. make group gpio and insert your octoprint user into:

sudo groupadd gpio; sudo usermod -aG gpio octoprint

  1. enable using GPIO in userspace:

sudo nano /etc/udev/rules.d/99-gpio.rules

and insert:

SUBSYSTEM=="gpio", ACTION=="add", RUN="/bin/sh -c '\
  chown -R root:gpio /sys/class/gpio && chmod -R 770 /sys/class/gpio;\
  chown -R root:gpio /sys$DEVPATH && chmod -R 770 /sys$DEVPATH"`
  1. Change file of enclosure plugin:

sudo nano /home/octoprint/OctoPrint/venv/local/lib/python2.7/site-packages/octoprint_enclosure/__init__.pyb

and replace line: import RPi.GPIO as GPIO to: import OPi.GPIO as GPIO

  1. Restart and test. You have to found goog pin numbers. :)

Kiron21 avatar May 21 '19 07:05 Kiron21

Hi to all,

I was trying steps above but my problem is that my file of enclosure plugin is empty. I was also trying to reinstall the plugin but with no luck - still the same.

AfteCan you help me please? I have Orange Pi Lite.

Thank your that I tried to copy that file from github page and edited it to import OPi.GPIO as GPIO but plugin isn't working.

Can you help me please?

Thank you

IInickII avatar Sep 18 '19 12:09 IInickII

Hello IInickII

With sudo nano /home/octoprint/OctoPrint/venv/local/lib/python2.7/site- packages/octoprint_enclosure/init.py

Please comment if You have success.

On Wed, Sep 18, 2019 at 9:34 AM IInickII [email protected] wrote:

Hi to all,

I was trying steps above but my problem is that my file of enclosure plugin is empty. I was also trying to reinstall the plugin but with no luck 0 still the same. Can you help me please? I have Orange Pi Lite.

Thank you

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/vitormhenrique/OctoPrint-Enclosure/issues/67?email_source=notifications&email_token=AEUJUYZPWLYKMOS7ISW5X4LQKIN6HA5CNFSM4D6GNW62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6743DY#issuecomment-532663695, or mute the thread https://github.com/notifications/unsubscribe-auth/AEUJUY5XWO4GS5NB3PZG2MLQKIN6HANCNFSM4D6GNW6Q .

xinuxnt avatar Oct 06 '19 01:10 xinuxnt

Hi, I solved it before but thank you for your reply. I also edited pin mappings for me let it match pin numbering of the board.

IInickII avatar Oct 07 '19 05:10 IInickII

Hello, did someone get it work on an Orange pi zero 2 in 2024? When I install the plugin, I get the following errors:

WARNING: Ignoring invalid distribution -ctoprint-enclosure (/home/pi/oprint/lib/python3.9/site-packages)
WARNING: Ignoring invalid distribution -ctoprint-enclosure (/home/pi/oprint/lib/python3.9/site-packages)
WARNING: Ignoring invalid distribution -ctoprint-enclosure (/home/pi/oprint/lib/python3.9/site-packages)

And after the install the plugin is not listed...

I don't have much money but I think I can give about 10, maybe 15€ if that would help you developing this great plugin for the orange pi zero 2 :) My OS: Orange Pi 3.0.6 Bullseye with Linux 5.16.17-sun50iw9

kokospalme avatar Mar 22 '24 18:03 kokospalme