Introduction
This covers various bits of using i2c on various ARM devices.
Displays
Camera module
On Fedora 29. Add this line
start_x=1
to /boot/efi/config.txt
and load the bcm2835-v4l2
module at boot
echo bcm2835-v4l2 > /etc/modules-load.d/bcm2835-v4l2.conf
and reboot.
You should now see this device /dev/video0
OLED display on the Raspberry Pi 3
- Tested on Raspberry Pi 3
- Display chipset: ssd1306
- Interface: i2c
- Dimensions: 128 x 64
Create a group that can access the i2c devices without root permissions, and add your user to such group
$ sudo groupadd i2cuser $ sudo usermod $USER -G i2cuser -a
Create a rule in UDEV, in order to create i2c devices with the right group and permissions
$ echo "SUBSYSTEM==\"i2c-dev\", GROUP=\"i2cuser\", MODE=\"0660\"" | sudo tee /etc/udev/rules.d/50-i2c.rules
Logout from the current session and login again.
Install i2c-tools package
$ sudo dnf install i2c-tools
Verify that the i2c adapter is visible by the system
$ i2cdetect -l -a
The output should be something lik this:
i2c-1 i2c bcm2835 I2C adapter I2C adapter i2c-2 i2c bcm2835 I2C adapter I2C adapter i2c-0 i2c bcm2835 I2C adapter I2C adapter
Connect the OLED display to the Raspberry:
GND -> pin 39 VCC -> pin 1 SCL -> pin 5 SDA -> pin 3
Verify that the i2c device is listed
$ i2cdetect -y 1
This should be the output
0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- --
Let's install some packages
$ sudo dnf install git gcc python3-pillow redhat-rpm-config python3-devel zlib-devel libjpeg-devel
You can use the luma Python module https://luma-oled.readthedocs.io/en/latest/intro.html, it seems pretty simple to use
$ pip3 install --upgrade luma.oled --user
Let's clone the luma examples from github
$ git clone https://github.com/rm-hull/luma.examples.git
And test if all is working
$ cd luma.examples/examples $ python3 ./welcome.py