Connection of a 128x32 monochrome OLED display

published: 10 October 2020 / updated 10 October 2020

Lire cette page en français

 

Choosing a display interface

The choice of a display interface is subject to several conditions:

A display interface is very useful on a stand-alone assembly to provide very clear textual or graphic information.

After several searches, the choice fell on an OLED display of this type:

It only costs a few € uros.

This display uses OLED technology, so no backlighting.

Its display resolution is 128x32 pixels. It can display text and images, but only in monochrome.

The consumption, in milliAmpers, is between 5 to 7 mA.

In DISPLAYOFF mode, power consumption is almost zero.

It is a very widespread and rather well documented product.

Online Documentation

Adafruit: technical documentation and controls for the OLED display
  SSD1306 - Advance Information

Adafruit: SSD1306 C library
  SSD 1306 C library

Adafruit: SSD1306 microPython
  SSD1306 microPython library

Punyforth: SSD1306 SPI Forth
  ssd1306 SPI display driver

TG9541: Forth Oled Display
  Forth Oled Display

Yunfan: SSD1306 128x32 i2c forth
  SSD1306 128x32 i2c forth

Connection of the SSD1306 OLED display

The SSD1306 128x32 OLED display must be used on the I2C bus of the ARDUINO card.

This I2C bus is present on all ARDUINO cards. Documentation here:
L'interface I2C des cartes ARDUINO

Connection to an ARDUINO NANO card:

As can be seen, 4 wires are sufficient: 2 for powering the OLED SSD1306 display (black and red wires), 2 for the connection on the I2C bus (blue and yellow wires).

The display power supply is taken from the ARDUINO card. It is not necessary to use an auxiliary power supply. The very low power consumption of this display allows it. The SSD1306 OLED display has an integrated circuit returning the voltage 5V at the voltage necessary for its operation.

Once connected, you must test the I2C link between the ARDUINO NANO card and the display OLED SSD1306 128x32. To do this, we first compile the contents of the i2c-new.txt file:
I2C interface management for FlashForth

The contents of the i2c-new.txt file are derived from the program made by Peter J. in 2014.

The modifications made to the initial code allow greater readability of the FORTH code.

here A collection of i2c related words, Matthias TRUTE proposes a standardization of the essential words to manage an I2C communication. Therefore some words have aliases;

\ Write one byte to bus 
: i2c.tx ( c ---) 
   i2c.c! drop ; 

To check the correct I2C communication with the SSD1306 128x32 OLED display, we just type i2c.detect. If all goes well you must have this to the terminal display:

i2c.detect
     00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
00 :                      -- -- -- -- -- -- -- -- --
10 : -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20 : -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30 : -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- --
40 : -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50 : -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60 : -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70 : -- -- -- -- -- -- -- --

The address 3c is the hexadecimal address of the SSD1306 128x32 OLED display on the I2C bus.

If the caller ID detection is successful, you can now type -i2c-detect, which will remove the word i2c.detect from the dictionary, allowing to recover the memory space taken by this word.