10 10
tkaiser

[RfC] Make Armbian more IoT friendly?

Recommended Posts

8 hours ago, barish said:

I've no idea on what the path name depends

Thats's easy to find out. Look at the directory /sys/class/gpio, there is a link to /sys/devices/platform/whatsoever/gpio/gpiochip0, change whatsoever with the real findings and drop gpiochip0. That's the way I did it. Maybe it depends on the hardware (I use an opi one) or the Linux (I use Armbian 5.35 Debian Jessie 3.4.113).

Share this post


Link to post
Share on other sites

Hi @lagerschaden, you're right, for each user of a specific machine, it's easy to find out. But I was thinking about a more general udev rule that could be integrated into Armbian. In that case, the path would need to be set correctly for each board and kernel or whatever the path depends on.

Share this post


Link to post
Share on other sites

FWIW this is my 99-gpio.rules, I use RUN instead of PROGRAM because, according to this document

Quote

Do not confuse this with the PROGRAM functionality described above. PROGRAM is used for running programs which produce device names (and they shouldn't do anything other than that). When those programs are being executed, the device node has not yet been created, so acting upon the device in any way is not possible.

 

I'm using it on an OPi PC with legacy kernel, you can omit the echo line, it's there just for debugging purposes

 

SUBSYSTEM=="gpio", ACTION=="add", RUN="/bin/sh -c '\
   echo $DEVPATH >> /tmp/pippo;\
        chown -R root:gpio /sys/class/gpio && chmod -R 770 /sys/class/gpio;\
        chown -R root:gpio /sys$DEVPATH && chmod -R 770 /sys$DEVPATH\
'"

As I mentioned elsewhere,I had to patch the python library I use because the change of ownership is asynchronous.

Share this post


Link to post
Share on other sites
1 hour ago, Tido said:

Ultra-light process engine - 20x-50x lighter than Java or NodeRed

their definition of lightweight is insane (or marketing BS)... 

flogo.jpg.919283c0d9f61879217334eee0654225.jpg

 

If you use a recommended SD-Card 250mb disk space shouldn't be an issue. :lol:

 

The only thing I like is that adapters are programmed in GO. I heard from go but never used it on my own, could be an interesting 'learning experience', but I've too many other projects at the moment... 

 

 

 

Share this post


Link to post
Share on other sites
7 hours ago, chwe said:

is insane (or marketing BS).

The company behind the project is known, at least to me and it is OSS. Free of charge (beside your time) you can verify their slogans.

IoT also involves Sensors equiped with ESP8266  which usually come with little memory e.g. my ESP-03 which comes with little memory, but do not buy this version of it the "open holes" to connect are simply stupid in every way.

So I thought if it makes smaller executables it might be interesting to build everything in one Development Suite..

Share this post


Link to post
Share on other sites
5 hours ago, TonyMac32 said:

Well, if you have 16 or 32 MB of storage, that might be important.  ;-)

Ok, when using armbian, x mb shouldn't be a problem... :P  

 

1 hour ago, Tido said:

So I thought if it makes smaller executables it might be interesting to build everything in one Development Suite..

 

Everything in one is often nothing at all... :P (yeah, there's some sarcasm in this statement) 

To be a bit more serious... The whole 'IoT stuff' reminds me a little bit back to the end of 90's (do you still know altavista.com? :P ).  A lot of companies tried to make money in those days rest in peace now... :P Success for such projects is mainly driven by the size (and competence) of the community which uses it. But if you've a solution which catches everything and the maintainer loses his interest in the project - you're f... up.  That's why I try to split my projects into different parts - if one falls away, it wouldn't need much effort to replace it by something which does the job (e.g. Node-Red --> Mosquitto --> WemosD1 mini --> Sensor). I think it would need less than a day to replace Node-Red with flogo, Mosquitto can be replaced by every mqtt server, all the wemos boards by some generic wifi capable 'Arduino like' boards.

I like such projects,  but besides their website (which looks like they spend a lot of time in it :P) there's (at the moment) not much rumor/respond from the crowd.

 

Quote

Project Flogo™ - powered by the community & supported by TIBCO Software Inc.

 

Let's see if they fulfill it.  ;) But anyway, thanks for the info -  it's on my list now. 

Share this post


Link to post
Share on other sites
2 hours ago, chwe said:

Everything in one is often nothing at all... :P (yeah, there's some sarcasm in this statement) 

To be a bit more serious... The whole 'IoT stuff' reminds me a little bit back to the end of 90's (do you still know altavista.com? :P ).  A lot of companies tried to make money in those days rest in peace now... :P Success for such projects is mainly driven by the size (and competence) of the community which uses it. But if you've a solution which catches everything and the maintainer loses his interest in the project - you're f... up.  That's why I try to split my projects into different parts - if one falls away, it wouldn't need much effort to replace it by something which does the job (e.g. Node-Red --> Mosquitto --> WemosD1 mini --> Sensor). I think it would need less than a day to replace Node-Red with flogo, Mosquitto can be replaced by every mqtt server, all the wemos boards by some generic wifi capable 'Arduino like' boards.

 

 

I completely agree with you. When I first started home automation, I was using an all-in-one solution but as it grew on the only thing that's became really important for me is that everything goes by a MQTT server (every sensor, every action, every result of automation).

 

In the end I use Home Assistant for some stuff, hand made python script for thermostat / smart valve automation, ESP8266 for most of my home sensor, Arduino with HF, some Xiaomi Aqara sensors, ...

 

The only common point is that everything goes into a MQTT server.

 

Anyway thanks for the information I'll read the project documentation (marketting is always frustating)

Share this post


Link to post
Share on other sites
On 5.12.2017 at 12:18 PM, olivluca said:

SUBSYSTEM=="gpio", ACTION=="add", RUN="/bin/sh -c '\ echo $DEVPATH >> /tmp/pippo;\ chown -R root:gpio /sys/class/gpio && chmod -R 770 /sys/class/gpio;\ chown -R root:gpio /sys$DEVPATH && chmod -R 770 /sys$DEVPATH\ '"

Ok, I get the RUN instad of PROGRAM part, but where's $DEVPATH set? This variable is nonexistent/empty on my system.

Share this post


Link to post
Share on other sites

apt.armbian.com needs an AAAA record to be IoT friendly.

 

sudo apt-get update
Err:5 http://apt.armbian.com stretch InRelease                    
  Could not resolve 'apt.armbian.com'

 

Share this post


Link to post
Share on other sites
On 17/12/2017 at 3:38 AM, vlad59 said:

I guess the question is :

 

Is apt.armbian.com available with ipv6 only ?

 

For now dig says no.

Correct, the request was for AAAA records so apt.armbian.com can be accessed from IPv6-only nodes.

Share this post


Link to post
Share on other sites
2 hours ago, tracernz said:

Correct, the request was for AAAA records so apt.armbian.com can be accessed from IPv6-only nodes.


Current hosting provider can't provide IPV6 at the present location (apparently there was some error in comm) where we anyway have troubles with consuming all allocated bandwidth. We have to move again for this reason too. And. Few people are involved in this change while holidays are at the door. I doubt there will be any changes before mid-end January.

 

Share this post


Link to post
Share on other sites
17 hours ago, Igor said:


Current hosting provider can't provide IPV6 at the present location (apparently there was some error in comm) where we anyway have troubles with consuming all allocated bandwidth. We have to move again for this reason too. And. Few people are involved in this change while holidays are at the door. I doubt there will be any changes before mid-end January.

 

No worries. As long as it's on the radar I'm happy. :)

Share this post


Link to post
Share on other sites
On 8/18/2016 at 9:14 AM, tkaiser said:

Simple example: Default user pi in Raspbian has access to GPIO pins -- on Armbian it's currently root only. How's that done? A group called gpio exists in Raspbian, pi is added to it and /etc/udev/rules.d/99-com.rules does all the magic:

The main utility to read and write GPIO pins on Raspian is /usr/local/bin/gpio.  It was written by Gordon Henderson (http://wiringpi.com) and also comes with an api library suitable for C/C++ development.  A couple of years ago I found an excellent version ported for the Orange Pi (https://github.com/zhaolei/WiringOP.git).  The one thing that they both do is set the SUID bit on the GPIO utility, thus allowing any user to run it.

Share this post


Link to post
Share on other sites
On 2.12.2017 at 12:54 PM, arox said:

(I am asking myself if I want or need to use nodered and found some pretty long, complicated and boring tutorial ...)

Iam using Node-Red/Dashboard/MQTT/Mosquitto as a Internet-Radio with Web-Interface.

Also on the Web-Interface (Dashboard) I could see all temperatur reading of my serveral types of pi.

Every pi gives the temperatur via MQTT to my MQTT-Server and my Internet-Radio/Node-Red-pi is reading this Informations.

 

Also every pi tells the MQTT when he is booted up completely and another Pi is reading this information and did tell it to me via Text-to-Speech (espeak) or via serial line to my EMIC2 (DECtalk TTS).

So I have not to check when a pi is booted completely and I could start to ssh in after I know the pi is booted.

The instructions which I have written down for Node-Red arent long. With this little help-text I could easily setup in minutes Node-Red on a new pi:
 

Node-Red Install:
root@orangepizero:/# npm install -g --unsafe-perm node-red

root@orangepizero:/# node -v
v8.9.1
root@orangepizero:/# npm -v
5.5.1

run Node-Red manually:
node-red -v
Server now running at http://127.0.0.1:1880/
Server now running at http://192.168.6.23:1880/

Install Node-Red Dashboard:
npm i node-red-dashboard 
or via "Manage Palette"

Node-Red Autostart : https://nodered.org/docs/getting-started/running
npm install -g pm2
pm2 start /usr/bin/node-red --node-args="--max-old-space-size=128"
pm2 save
pm2 startup

 

Share this post


Link to post
Share on other sites
On 7.9.2016 at 10:44 PM, zador.blood.stained said:

We,, bcm2835-gpiomem driver looks simple and platform-independent, but maintaining sets of patches for all devices and kernels will be tricky, and this is not counting the userspace part.

just as a side-note, there is currently a patch for the tinkerboard (legacy kernel) which allows rootless userspace access of gpiomem (based on the RPI driver adjusted to RK by ASUS) in the development branch of armbians buildscript:

https://github.com/armbian/build/commit/b86881f813a7bd9143084ed4cc36efcd612eb5b7

Unfortunately compiling it as module, which would make sense from a security standpoint (not everyone wants rootless access to gpiomem), failed and the driver is not visible as module (I only gave it one shot, so maybe I missed something). It could be worth to check how much efforts it needs to port it to H3 boards cause a lot of libs accessing mem for GPIO handling (e.g. pyA20) and those libs would only need minor adjustments (e.g. pointing to gpiomem instead of mem)  to make them rootless capable. 

 

@guidol

or if you're really lazy.. just go here:

https://diyprojects.io/install-node-red-orange-pi-running-armbian/#.WsNiDlSWS00 (I didn't wrote that, but it works...)

 

and execute their bash-script which does all the work for you.. Okay, I think you need a 'apt-get install mosquitto'

 

bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)

 

Share this post


Link to post
Share on other sites

Greetings!
I am trying to access gpio from userspace on my orange pi one running 4.14.18-sunxi kernel, and am a bit stuck.

What I have done so far:

1. Add my user to the gpio group sudo groupadd gpio && sudo usermod -aG gpio pi

2. Create /etc/udev/rules/99-gpio.rules with:

 

    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/devices/platform/soc/1c20800.pinctrl/gpio && chmod -R 770 /sys/devices/platform/soc/1c20800.pinctrl/gpio;\
    '"

The paths for pinctrl I got from:

$ ls -la /sys/class/gpio/
total 0
drwxrwx---  2 root gpio    0 Apr 14 11:35 .
drwxr-xr-x 58 root root    0 Jan  1  1970 ..
-rwxrwx---  1 root gpio 4096 Apr 14 11:35 export
lrwxrwxrwx  1 root gpio    0 Apr 14 11:35 gpio110 -> ../../devices/platform/soc/1c20800.pinctrl/gpiochip0/gpio/gpio110
lrwxrwxrwx  1 root gpio    0 Apr 14 11:35 gpiochip0 -> ../../devices/platform/soc/1c20800.pinctrl/gpio/gpiochip0
lrwxrwxrwx  1 root gpio    0 Apr 14 11:35 gpiochip352 -> ../../devices/platform/soc/1f02c00.pinctrl/gpio/gpiochip352
-rwxrwx---  1 root gpio 4096 Apr 14 11:35 unexport


But when I try to test this from my user as non root :

echo 110 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio110/direction
echo 1 > /sys/class/gpio/gpio110/value

I am able to export/unexport the pins, but  run into -bash: /sys/class/gpio/gpio110/direction: Permission denied for any actions on the pins them selves.

What am I missing?

 

Share this post


Link to post
Share on other sites

Try this instead:

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\
'"

 

 

Share this post


Link to post
Share on other sites
5 hours ago, olivluca said:

Try this instead:


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\
'"

 

 

Ah! I should read the manpage :-) Thanks works like a charm now!

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
10 10