Usage of the SSD1306 OLED Display

First install the I2C driver:

You don’t need to install I2C, if you using the SD-card image from our website.

The new Raspbian distro already have the I2C driver installed but they are disabled by default. To enable it all you need to do is comment out a line by putting # in front. At the prompt type:

then add a # on the 3rd line

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

#blacklist spi-bcm2708
#blacklist i2c-bcm2708 —Added a # to the start of the line
blacklist snd-soc-pcm512x
blacklist snd-soc-wm8804

Press CTRL X then y to save and exit.

Next edit the modules file by:

Add i2c-dev to a new line:

# /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.
# Parameters can be specified after the module name.

snd-bcm2835
i2c-dev—Add this text

Press CTRL X then y to save and exit.

Now install the i2c-tools package by:

If you get a 404 error do an update first:

then run the install the i2c-tools again.

Note : The installation could take a few minutes to do, depend on how busy the server is.

Now add a new user to the i2c group:

Reboot the machine by:

After the reboot test to see any device connected by:

If your board is the Rev 2 type this:

You should see something like this:

Now install the SSD1306 python library:

Before using the library you will need to make sure you have a few dependencies installed.

First install the Python Imaging Library and smbus library by executing:

Now to download and install the SSD1306 python library code and examples, execute the following commands:

Inside the examples subdirectory you’ll find python scripts which demonstrate the usage of the library.

EduBoard OLED examples

To download our ready made examples,  follow the next few steps.

Navigate to the Adafruit_Python_SSD1306 folder using the following command:

Only if you not already there.

Download our examples using the command:

GNU Wget is a free utility for non-interactive download of files from the Web. It supports HTTP, HTTPS, and FTP protocols, as well as retrieval through HTTP proxies.

Extract the content using the following command: (unzip content)

Once extracted, remove the .ZIP file using the following command:

Change the directory using the following command:

The terminal prompt should look like this:
pi@raspberrypi ~/Adafruit_Python_SSD1306/EduBoard_examples $

You can now run the IP script using the command:

(ip.py has default fonts, will run straight away. The rest of the script has modified fonts, which will be detailed in the next tutorial)

To clear the display, run the reset.py script using the following command:

(Library used: Adafruit)

Usage of the SSD1306 OLED Display, fonts) part 2