Skip to content

Latest commit

 

History

History

AdafruitOLEDBonnet

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Adafruit 128x64 OLED Bonnet for Raspberry Pi

The OLED Bonnet 128x64 (monochrome) from Adafruit is awesome! You can develop, with Circuitpython/Python, fast and easily applications and UI's. It offers completely new possibilities to bring the Raspberry Pi to a next level.

Objective

The aim of this tutorial is to describe the installation of the OLED device.

Attention: There is no need to solder the components beforehand!

OLED Bonnet with Flirc case

My OLED Bonnet on Raspberry Pi Zero and Flirc Case.

Precondition

You should already have read (and successful carried out) the following tutorials.

Install needed and/or optional packages

Install (or ensure they are installed) following packages.

# update system (optional)
$ sudo apt update -y && sudo apt upgrade -y

# install optional packages (optional)
$ sudo apt install -y vim

# install needed packages
$ sudo apt install -y python3-pip python3-pil

OLED Bonnet (128x64 monochrome)

Preparation

Enable the I2C interface on the Raspberry Pi.

# start console based raspi-config application
$ sudo raspi-config

Enable I2C

Select Interfacing Options, next I2C and activate <Yes>.

Install OLED Bonnet Python libraries

# install circuitpython library
$ sudo pip3 install adafruit-circuitpython-ssd1306

# install adafruit-python-shell
$ sudo pip3 install adafruit-python-shell

# download python-blinka
$ wget https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/raspi-blinka.py

# install python-blinka
$ sudo python3 raspi-blinka.py

# reboot (recommended)
$ sudo reboot

Verify installation

Verify I2C and SPI devices.

# verify for i2c device (optional)
$ ls /dev/i2c*
...
/dev/i2c-1

# verify for spi device (optional)
$ ls /dev/spi*
...
/dev/spidev0.0  /dev/spidev0.1

Verify Python-blinka installation. Here you will find the content.

# create test file
$ touch blinka-test.py

# start editor
$ vim blinka-test.py

# change permissions
$ chmod +x blinka-test.py

# execute test file
$ ./blinka-test.py

Verify OLED Bonnet

Shutdown the Raspberry Pi, plug in the OLED Bonnet device and start the Raspberry Pi again.

# scan the I2C bus for OLED bonnet
$ sudo i2cdetect -y 1
...
     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: -- -- -- -- -- -- -- -- 

Start with development

Now you can start with the Python development. There are some examples on GitHub, which are quite helpful. Here is the best script to start and understand.

# create file
$ touch bonnet-buttons.py

# start editor
$ vim bonnet-buttons.py

# change permissions
$ chmod +x bonnet-buttons.py

# execute file
$ ./bonnet-buttons.py

Go Back