Working with an SSD1306 0.96″ OLED display on the Raspberry Pi

I’m always on the lookout for cheap electronics on eBay and AliExpress. Following on from my previous tutorial on HD44780 screens, this time, I found a small OLED display.

I bought one of these from eBay for less than £5 plus postage. It is a 0.96″, 128×64 pixel OLED display. These things are really tiny, but useful if you’re after something to display status information. They run from the I2C bus, this one using address 0x3C. This means that all the other addresses are available for you to use to get I2C sensor readings from or to drive other displays. You can even change the address on these displays to allow you to use multiple of the same device.

I did a quick Google to find out how to use it with the Raspberry Pi. I used some of the instructions on this page but found them to be out of date, so I ended up doing things slightly differently.

First of all, make sure your Pi has some essential packages. Most are pre-installed, but you’ll get updates this way:

sudo apt-get install build-essential python-dev python-pip python-imaging python-smbus git

Then, grab the Adafruit library from GitHub:

git clone

Install the library for python3:

cd Adafruit_Python_SSD1306
sudo python3 install

Now take a look at the examples:

cd examples

In the examples, I changed the “disp =” statement to use the line with a 128×64 display running on I2C.

The example scripts provided by Adafruit are:

  • Animated text rolling across the screen.
  • Representation of some buttons (which is weird because it’s not a touch screen!).
  • A PPM image translated onto the screen.
  • Some geometric shapes.
  • Some stats from the Pi – the IP address, disk & memory usage and CPU load.

You can see how these scripts work in the video below. Pardon the shaky cam work, I’ve lost my little tripod!

All the scripts are pretty easy to understand and modify.

I’ve seen these used to display the time, Pi information such as that in the example screen and even as a status display for different robot modes, so they are really versatile.

Addendum: Also worth a look is this other Python library called luma-oled. Thanks to Brian Welsby for that!

3 comments for “Working with an SSD1306 0.96″ OLED display on the Raspberry Pi

  1. Tony Goodhew
    22 March 2018 at 3:34 pm

    Thanks for this follow-up display blog. I’ve just got hold of one, installed the software but am not sure of the correct voltage. Did you connect VCC to 3.3V or 5V?

    • Tony Goodhew
      22 March 2018 at 4:28 pm

      Works well on 3.3v.

  2. Tony Goodhew
    22 March 2018 at 6:27 pm

    This is a great piece of kit for the price.
    The button script really goes with Adafruit’s upgraded OLED Bonnet for Raspberry Pi with a mini switched joystick and addition buttons (much more expensive). The pin outs are given if you want to build it as a simple project.
    You can easily change the font and font size making this tiny display even more useful.

Leave a Reply

Your email address will not be published. Required fields are marked *