SIP
pigpio - Printable Version

+- SIP (https://nosack.com/sipforum)
+-- Forum: SIP (Sustainable Irrigation Platform) (https://nosack.com/sipforum/forumdisplay.php?fid=1)
+--- Forum: Feature requests (https://nosack.com/sipforum/forumdisplay.php?fid=4)
+--- Thread: pigpio (/showthread.php?tid=1)



pigpio - bkoblenz - 2015 Aug 16

I would like to recast the implementation to use pigpio library rather than direct GPIO calls.  This requires the library to be installed and running as part of the installation but then likely allows the rest of the program to run without root privileges.

This would involve changes to gpio_pins.py and plugins/relay_board.py.

I have already made changes to relay_board and they seem to work fine.  I am happy to make the other changes, but I am not sure how to deal with the installation piece.

Thoughts?
-brian

The way I got it installed on my system was:

wget abyz.co.uk/rpi/pigpio/pigpio.zip
unzip pigpio.zip
cd PIGPIO
make
make install
get or create /etc/init.d/pigpiod from somewhere
sudo chmod +x /etc/init.d/pigpiod
sudo update-rc.d pigpiod defaults
sudo update-rc.d pigpiod enable


RE: pigpio - dan - 2015 Aug 16

Not having to run sip as root would be an improvement in security.

There are a couple of issues though:

1. Pigpio does not support the Beagle Bone Black board that some users have. We would have to drop support for that I think. I'm not sure how many users it would affect.

2. We have been using the "board" pin numbering scheme which is guaranteed to not change across Raspi revisions. Pigpio uses Broadcom numbering and that would require checking the Pi's hardware version and adjusting pin numbering accordingly.

Would it be possible to provide the option of using pigpio or the current GPIO libraries?

Dan


RE: pigpio - bkoblenz - 2015 Aug 17

Clearly good points. I dont really have an opinion on the importance of Beagle Bone, but I did notice it is not supported in plugins/relay_board.py. I am assuming as we keep developing it is more likely some things wont work on that platform anyways. We could isolate a BB repository if desirable.

In terms of physical vs broadcom pins, that is a bit of a drag. For the pins we use (excluding relay_board) only one mapping is different between the different versions I see. As we go forward, I can see more things attached to pins and some of those things would certainly benefit from the functions in the pigpio library. Keeping both libraries leads to some complex looking code if you always have to deal with both.

I would be happy to make the changes that do the mapping and get everything I know about in plugins and gpio_pins and helpers to work with pigpio. I have a preference for that rather than to make all that code work in both contexts since every call has to change. We could add a third library and rewrite everything in terms of that, but that doesnt seem any better. Of course, I can only test my changes on RPI_VERSION==3 because that is what I have.

I am comfortable keeping all pin numbers as physical in the project, but we would map those physical to bcm before accessing the library. Something like GPIO.input(pin_rain_sense) would become pigpio.read(pin_rain_sense) and pin_rain_sense = pin_map[8] instead of the current pin_rain_sense = 8

What do you say?


RE: pigpio - dan - 2015 Aug 17

As far as support for Beagle Bone, we can add a branch on the SIP repo just before making the switch to pigpio. that way anyone that wants to use that hardware would have a working app. With the performance and low cost of the latest Raspi there really isn't much reason to continue support for both boards.

Mapping the pin numbering to the physical layout would probably be the way to go. It would eliminate the necessity to revise any existing documentation and should work across all hardware revs I think.


RE: pigpio - bkoblenz - 2015 Aug 17

I'll try to make all combinations (that currently work) continue to work while adding pigpio.

We'll see what challenges await!


RE: pigpio - KanyonKris - 2015 Nov 26

pigpio is a good library, especially if you need lots of PWM, serial, etc. But all SIP is doing is turning relays off and on. Other than the minor security issue of running SIP as root, I don't see a compelling reason to use this library, especially since it doesn't support physical pin numbering and Beaglebone Black. Rather than fork SIP, I suggest creating a new relay plugin that uses the pigpio library instead of RPi.GPIO.


RE: pigpio - dan - 2015 Nov 26

Hi Kris,

This is a rather old post and Brian has already implemented an option to use either GPIO library in the latest SIP revisions.

Regarding the security issue of being required to run as root in order to use the included GPIO library;That problem has gone away in the latest Raspbian rev - Jessie. You can now run as what ever user you wish. Jessie does use a different init system (systemd), but the old init script and commands still work. I will be updating the docs on the wiki to reflect the changes and there is a new init script (unit file)  for Jessie named "sip.service" already on GitHub.

Dan