Activate GPIOzero and I2C pins in Raspberry Pi 3b with Ubuntu 18.04.3 server arm64

This guide explains how to activate GPIOzero and I2C pins in Raspberry Pi 3b with Ubuntu 18.04.3 server arm64. Is recommended to use the following image: http://cdimage.ubuntu.com/releases/bionic/release/ubuntu-18.04.3-preinstalled-server-arm64+raspi3.img.xz. That image contains Ubuntu 18.04.3 server for arm64 and have been tested in Raspberry Pi 3b.

Activating GPIOzero Pins

This section is based on the following link: https://wiki.ubuntu.com/ARM/RaspberryPi#Packages

  sudo add-apt-repository ppa:ubuntu-raspi2/ppa
 
  sudo apt update
 
  sudo apt install python3-pip
 
  sudo apt install linux-firmware-raspi2 linux-raspi2 u-boot-rpi flash-kernel

The following packages are optional:

sudo apt install libraspberrypi-bin libraspberrypi-bin-nonfree xserver-xorg-video-fbturbo hello-dkms

This section is mandatory:

  sudo groupadd -f --system gpio
  sudo groupadd -f --system i2c
  sudo groupadd -f --system input
  sudo groupadd -f --system spi

Some important dependences:

This dependencies are really important to run python codes:

  sudo pip3 install smbus
 
  sudo pip3 install gpiozero
 
  sudo pip3 install pigpio
 
  sudo apt install rpi.gpio

Activating I2C and SPI pins

Is necessary to create some configuration files:

  sudo touch /etc/modprobe.d/raspi-blacklist.conf
  emacs /etc/modprobe.d/raspi-blacklist.conf

Fill file with the following information:

  # blacklist spi and i2c by default (many users don't need them)
 
  blacklist spi-bcm2708
  blacklist i2c-bcm2708

For the second file, called /etc/modules, add at the end of the file this lines and should look like this:

  # /etc/modules: kernel modules to load at boot time.
  #
  # This file contains the names of kernel modules that should be loaded
  # at boot time, one per line. Lines beginning with "#" are ignored.
 
  snd-bcm2835
  i2c-dev

Then, run the following commands:

  sudo apt  install i2c-tools
  sudo apt  install python-smbus
  sudo adduser pi i2c
  sudo reboot

You can run sudo i2cdetect -y 0, to verify the address of your dispositive already connected to your Raspberry Pi.

  • tutorials/activate_gpiozero_and_i2c_pins_in_raspberry_pi_3b_with_ubuntu_18.04.3_server_arm64.txt
  • Last modified: 2020/02/03 16:16
  • by lyannicelliv