• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
KaliTut

KaliTut

Kali Linux tutorial and Linux system tips

  • Home
  • Raspberry Pi
  • Privacy Policy
  • About us

How to install pigpio on raspberry pi

Last Updated on July 19, 2020 by Kalitut Leave a Comment

Control and program Raspberry Pi pigpio (shell/bash)

raspberry pi pigpio

Compared to controlling and programming the GPIOs via “sysfs”, “pigpio” on the command line is a simplification. The command line tool “pigs” also supports the programming of a GPIO as PWM and servo.
“pigpio” is also the preferred method for controlling and programming the GPIOs on the command line.

install pigpio on raspberry pi

If not already installed, the installation of “pigpio” is done with the following command.

sudo apt-get install pigpio

The control of the GPIOs is done with the command line tool “pigs”. For this to work, you must first start the pigpio daemon.

sudo systemctl start pigpiod

If you want the daemon to start automatically at system startup, then execute the following command.

sudo systemctl enable pigpiod

Then you can configure the individual GPIOs.

Configure raspberry pi GPIO as input or output
Here we select the GPIO 17 (pin 11) and GPIO 18 (pin 12) as examples to configure them as output and input. For this the BCM numbering of the chip is used. So the number of the GPIO and not the pin.

  • Raspberry Pi GPIO assignment

If the GPIO 17 is to be configured as output, the following command applies.

pigs modes 17 w

By default, the output gets the state “low” or “0”.

If the GPIO 18 is to be configured as an input, the following command applies.

pigs modes 18 r

State of a GPIO output set
Basically you can only set outputs. To set the state of a GPIO output to “high”, the following command is sufficient.

pigs w 17 1

To set the state of a GPIO output to “low” the following command is sufficient.

pigs w 17 0

Determine / read GPIO status
To determine the state, ie “high” or “low”, at a GPIO, the following command is sufficient. The GPIO can be both an input and an output.

pigs r 18

The output “1” stands for “high” or “0” for “low”.

Troubleshooting
When executing the pigs commands, the error message “socket connect failed” appears. This does not mean that the pigpiod daemon is not running. You have to start it yet.

Commands to control “pigpiod”
Start pigpio daemon automatically at system startup:

sudo systemctl enable pigpiod

Disable system startup:

sudo systemctl disable pigpiod

Start pigpio daemon:

sudo systemctl start pigpiod

Stop pigpio daemon:

sudo systemctl stop pigpiod

Show status of the pigpio daemon:

sudo systemctl status pigpiod

Filed Under: Raspberry Pi Tagged With: raspberry pi pigpio

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Follow us

  • Facebook
  • Twitter
  • YouTube

Categories

  • Android pentesting tools
  • Arduino
  • Books
  • Darknet
  • database
  • General
  • Github Tools
  • Hacking
  • Kali Linux
  • Linux
  • Linux Commands
  • Network Administrator
  • Penetration Testing
  • Penetration Testing Tools
  • PowerShell
  • Raspberry Pi
  • resources
  • Review
  • Termux
  • Tutorials
  • Ubuntu
  • Uncategorized
  • Video Tutorials
  • vmware
  • WiFi Adapter
  • WiFi Pentesting
  • Wireless Router
  • Wireshark

Recent Posts

  • Hijacked Wi-Fi? Thorough explanation of hacking techniques
  • Windows PowerShell tutorial for beginners
  • Learn to Hack Steps from Beginner to Hacker
  • PowerShell Tutorial – GUIDE introduction with basics
  • Top Hacking Tools
  • Home
  • About us
  • Privacy Policy
  • Affiliate disclaimer

Copyright © 2023