17

In order to use pigpio Module in Python (remote GPIO for Raspberry Pi ), pigpiod has to be loaded to memory on each RPi.

  1. what is the right way to to it ? during Ubuntu's boot or a part of Python's script ?
  2. since It needs sudo pigpiod- how is it done (both Ubuntu and Python )?
0

3 Answers 3

27
sudo systemctl enable pigpiod

will enable it to auto-start on boot.

sudo systemctl start pigpiod 

will start it immediately (just a posh way of doing

sudo pigpiod

:)

If you change your mind,

sudo systemctl disable pigpiod

will undo the start-up behaviour. Similarly,

sudo systemctl stop pigpiod

will have an immediate effect.

1

Ubuntu:

ou can add the command in the /etc/rc.local script that is executed at the end of startup.

Write the command before exit 0. Anything written after exit 0 will never be executed.

Raspbian:

to execute commands "at boot", if autologin is enabled (since what it really does it execute them when the pi user logs in), i'd suggest editing the autostart file wich is in the ~/.config/lxsession/LXDE-pi/ directory. just add these two lines at the end of the file:

@export DISPLAY=:0
@epiphany /path/to/your/file.png &

P.S. you need to have root permissions to edit autostart

Python:

if you want to execute commands in a python script just do this:

from os import system
system("sudo pigpiod")
2
  • 2
    For Raspbian, just use the Raspberry Pi Configuration utility and enable Remote GPIO in the Interfaces tab (the Remote GPIO chapter in the updated gpiozero docs cover this). If I recall correctly, pigpiod should be started by default anyway but is limited to localhost only without this option
    – Dave Jones
    Aug 2, 2017 at 20:38
  • 2
    @DaveJones Remote GPIO is set to "ON", but pigpiod still need to be executed.
    – guyd
    Aug 5, 2017 at 20:48
0

Answered extensively in gpio zero doc

or link from RaspberryPi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.