Skip to content
Control multiple OLED displays on one or more I2C buses simultaneously
Branch: master
Clone or download
bitbank2 Update
fixed compliance with standard
Latest commit 3acd0c8 Jan 31, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples Added line+pixel drawing functions and backbuffer support for non-AVR… Jan 12, 2019
demo.jpg added image Jan 8, 2019 Update Jan 31, 2019

Multi OLED library
Project started 1/1/2019
Copyright (c) 2019 BitBank Software, Inc.
Written by Larry Bank

The purpose of this code is to easily control mulitple SH1106/SSD1306 OLED displays using a minimum of GPIO lines. The number of displays is not tied to the number of I2C buses if they have unique addresses. For example, if you have 4 displays that all use address 0x3C, then you'll need 4 I2C buses to control them. This can be done with as few as 5 GPIO lines if you arrange them to share the SCL wire. In the other extreme, you can control 16 unique OLED displays with 9 wires (8 I2C buses) if you have 8 set to address 0x3C and 8 set to address 0x3D. The library addresses each display individually by bus and I2C address.

Here is a Youtube video of it in action on an nRF52840 Feather. The line draw function is very efficient, so even driving 2 displays over a bit-banged I2C bus, it can draw quite quickly.

Line drawing video


  • Supports 64x32, 128x32, 128x64 and 132x64 (SH1106) display sizes
  • Includes 3 sizes of fixed fonts (6x8, 8x8, 16x32)
  • Includes a function to load a Windows BMP file
  • Optional backing RAM for drawing lines and pixels for systems with enough RAM
  • Light enough to run on an ATtiny85

To initialize the library, you pass lists of the following:

1) Bus number
2) I2C Address
3) Boolean indicating to flip the display 180 degrees
4) Boolean indicating to invert the display
5) The total display count

Each access function (e.g. drawing text) takes the display number as the first parameter. This will index the correct bus number and I2C address based on the lists you provided to the initialization function.

See the example sketch for more info on how to call the functions.

This code depends on the Multi_BitBang library. You can download it here:

If you find this code useful, please consider buying me a cup of coffee


You can’t perform that action at this time.