Wiring

Raspberry Pi

You can hook up an OLED to the Raspberry Pi using either the Pi's I2C or SPI interface. If your OLED supports both I2C and SPI, make sure to check how the solder jumpers are configured to expose the right interface.

In general, I2C uses fewer pins but is slower. SPI is way fast, but requires a bunch extra pins. Choose your adventure based on your needs!

I2C

To use the Pi with an I2C display wire it up as follows:

NOTE: Make sure to enable I2C on your Pi before wiring it up!

  • Connect display ground to Raspberry Pi ground (black wire).
  • Connect display VIN to Raspberry Pi 3.3 volt (red wire).
  • Connect display RST to Raspberry Pi GPIO 24 (blue wire). You can alternatively use any free digital GPIO pin for the reset pin.
  • Connect display SCL to Raspberry Pi SCL (purple wire).
  • Connect display SDA to Raspberry Pi SDA (orange wire).

SPI

To use the Pi with an SPI display, wire it up as follows:
  • Connect display ground to Raspberry Pi ground (black wire).
  • Connect display VIN to Raspberry Pi 3.3 volt (red wire).
  • Connect display CS to Raspberry Pi CE0 (yellow wire).
  • Connect display RST to Raspberry Pi GPIO 24 (blue wire). You can alternatively use any free digital GPIO pin for the reset pin.
  • Connect display DC to Raspberry Pi GPIO 23 (cyan wire). You can alternatively use any free digital GPIO pin for the DC pin.
  • Connect display CLK to Raspberry Pi SCLK (orange wire).
  • Connect display Data to Raspberry Pi MOSI (purple wire).
Note that the wiring above will use the Raspberry Pi's hardware SPI bus to communicate with the display. If you haven't done so already with your Pi, make sure to edit the blacklist.conf file to comment the line which disables SPI. Reboot your Pi and you should see the files /dev/spidev0.0 and /dev/spidev0.1 are now available.

Using hardware SPI is great for getting the fastest response from the display, however if you need more flexibility with pin usage you can use a software-based SPI implementation with any 5 free digital GPIO pins. See the example code usage on the next page for more information about configuring software SPI.

BeagleBone Black

Just like with the Raspberry Pi, you can use an OLED display with the BeagleBone Black over either the SPI or I2C interface.

I2C

To use the BeagleBone Black with an I2C display, wire it up as follows:

  • Connect display ground to BeagleBone Black ground (black wire).
  • Connect display VIN to BeagleBone Black 3.3 volt (red wire).
  • Connect display RST to BeagleBone Black P9_12 (blue wire). You can alternatively use any free digital GPIO pin for the reset pin.
  • Connect display SCL to BeagleBone Black I2C2_SCL pin P9_19 (purple wire).
  • Connect display SDA to BeagleBone Black I2C2_SDA pin P9_20 (orange wire).
Note that the BeagleBone Black has two I2C interfaces and this wiring will use the /dev/i2c-1 interface. Make sure there aren't any device tree overlays loaded which use these I2C pins for other purposes. The default BeagleBone Black device tree configuration with no overlays loaded will expose the necessary I2C interface for the wiring above.

SPI

To use the BeagleBone Black with an SPI display, wire it up as follows:
  • Connect display ground to BeagleBone Black ground (black wire).
  • Connect display VIN to BeagleBone Black 3.3 volt power (red wire).
  • Connect display CS to BeagleBone Black SPI0_CS0 pin P9_17 (yellow wire).
  • Connect display RST to BeagleBone Black P9_12 (blue wire). You can alternatively use any free digital GPIO pin for the reset pin.
  • Connect display DC to BeagleBone Black P9_15 (cyan wire). You can alternatively use any free digital GPIO pin for the DC pin.
  • Connect display CLK to BeagleBone Black SPI0_SCLK pin P9_22 (orange wire).
  • Connect display Data to BeagleBone Black SPI0_D1 pin P9_18 (purple wire).
Like with the Raspberry Pi, the wiring above assumes using a hardware SPI interface on the BeagleBone Black, specifically /dev/spidev1.0. Before you can use this SPI interface you must enable a device tree overlay to turn on the SPI pin functionality. The easiest way to enable this device tree overlay is to configure the BeagleBone Black to load the overlay automatically on boot.

With the BeagleBone Black connected to your computer over USB, open the USB mass storage drive named 'boot' and edit the file uEnv.txt on the drive. Add the following line to the file:

optargs=capemgr.enable_partno=BB-SPIDEV0

NOTE: Be careful editing the uEnv.txt file on Windows, as changing the line endings can cause your BeagleBone Black not to boot and require an OS reinstall! The safest option is to connect to the BeagleBone Black in a command window and follow the steps at the end of this page to mount and edit uEnv.txt on the BeagleBone Black.

Reboot your device and you should see the files /dev/spidev1.0 and /dev/spidev1.1 now exist.
Last updated on 2015-05-04 at 04.27.56 PM Published on 2014-06-25 at 01.58.27 PM