Allowing access to GPIO, i2c and spi on Pi under Ubuntu 20.04
To use data acquisition boards users need access to the GPIO pins, i2c and spi.
By default in Ubuntu 20.04 for Pis the gpio and spi groups do not exist. The i2c group does (not always).
- Make sure that the following packages are installed
rpi.gpio-common python3-pigpio python3-gpiozero python3-rpi.gpio
. - You can avoid having to create a gpio group, by assigning users who need gpio access to the dialout group. Check that
/dev/gpiomem
is part of that group and that the dialout group has rw access. If not you will need to set it. - Users also need to be members of the i2c group. If it does not exist create it and then make that the group for
/dev/i2c-1
with group rw permissions. THIS MAY NOT BE NECESSARY. - The spi group needs to be created (
addgroup?
). - Additionally the spi group needs to be given rw access to the spi devices at each boot. To do this create a one line rule in a file named
/etc/udev/rules.d/50-spidev.rules
containingSUBSYSTEM=="spidev", GROUP="spi", MODE="0660"
. The file should have rw permission for root and read permission for everyone else.