From Fedora Project Wiki
No edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 4: Line 4:
{| style="width: 50%; float: right; margin-left: 2em;"
{| style="width: 50%; float: right; margin-left: 2em;"
|-
|-
| style="border-width: 0;" | {{admon/tip | Have a question? | Join the Fedora ARM team on IRC in [irc://irc.freenode.net/fedora-arm #fedora-arm] on [http://freenode.net Freenode]
| style="border-width: 0;" | {{admon/tip | Have a question? | Join the Fedora ARM team on IRC in {{fpchat|#fedora-arm}} on [https://libera.chat Libera]
}}
}}
|}
|}
Line 13: Line 13:


= Displays =
= Displays =
== Camera module ==
On Fedora 29. Add this line
  start_x=1
to <code>/boot/efi/config.txt</code> and load the <code>bcm2835-v4l2</code> module at boot
  echo bcm2835-v4l2 > /etc/modules-load.d/bcm2835-v4l2.conf
and reboot.
You should now see this device <code>/dev/video0</code>


== OLED display on the Raspberry Pi 3 ==
== OLED display on the Raspberry Pi 3 ==


Tested on<br/>
* Tested on Raspberry Pi 3
Display chipset: ssd1306<br/>
* Display chipset: ssd1306
Interface: i2c<br/>
* Interface: i2c
Dimensions: 128 x 64
* Dimensions: 128 x 64


Create a group that can access the i2c devices without root permissions, and add your user to such group
Create a group that can access the i2c devices without root permissions, and add your user to such group
Line 72: Line 86:
Let's install some packages
Let's install some packages


  $ sudo dnf install git gcc python3-pillow redhat-rpm-config python3-devel
  $ 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
You can use the luma Python module https://luma-oled.readthedocs.io/en/latest/intro.html, it seems pretty simple to use

Latest revision as of 11:10, 2 July 2021

Shortcut:
Arch:ARM
Shortcut:
Arch:AArch64
Have a question?
Join the Fedora ARM team on IRC in #fedora-arm[?] on Libera

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

Sensors