Rootless GPIOs and I2C on Odroid XU3/4, C1 and C2
Every DIY knows GPIOs and the simplicity of GPIOs for Microcontrollers. Therefore, we usually take a microcontroller that will handle communication with Real world elements. This is normal on a Computer as they are not standard and most of the time have no accessible GPIOs. Therefore, we end up writing a communication in ASCII for fast development or with FIRMATA or ROSSERIAL for bigger projects.
Yes we have many GPIOs on our Embedded computer (Aka Odroid/RPi, …)… But it requires root and my application might be malfunctionning with root priviledge (and, side effect, it is unsafe ;) ). Solution? UDEV. The following steps will show you how to install the GPIO access library, the pin numbering and the UDEV magic for rootless connections ;)
# GPIO Access:
WiringPi2 and RPi.GPIO are super simple to use with Python. I chose to use WiringPi2 for pin numbering reasons.
# Power level
The RPi are using 5V, but the Odroid XU4 is using unprotected 1.8V pins directly connected to the CPU. Therefore, you need to use the Shifter Shield that provides protection, 3.3v and 5v outputs for all I/O except ADCs.
# Pin Numbering
While the RaspberryPi is documented all over the Web, the XU4 has unclear documentation. I recomment using WiringPi2, with the normal wpi.wiringPiSetup() config and the following diagram (https://wiki.odroid.com/odroid-xu4/application_note/gpio/wiringpi) for the pinout.
# GPIOs/i2c requires root
UDEV is your friend! A simple rule can make the access rootless! ;)
The following commands will add a group odroid; add yourself to the same group; add UDEV rules to allow the group gpio to use the GPIOs and I2C bus without ROOT.