OLED Display Principles

Introduction to OLED Display (SSD1306)

1. What is OLED?

OLED stands for Organic Light Emitting Diodes. Unlike traditional LED displays which require a backlight, OLED displays consist of individual organic molecules that light up when an electric current is applied. This leads to displays that are thinner, lighter, and offer better contrast ratios compared to LCDs.

2. SSD1306 – OLED Controller

The SSD1306 is a widely-used controller for OLED displays. It can drive displays with resolutions up to 128x64 pixels. The most common sizes you'll encounter with the SSD1306 controller are 0.96" 128x64 and 0.91" 128x32.

3. Features

  • Resolution: Often found in 128x64 or 128x32 pixels.

  • Monochrome: Typically displays in white, blue, or yellow, though there are multi-color variants.

  • Communication: I2C (Inter-Integrated Circuit) and SPI (Serial Peripheral Interface) are supported. I2C is more commonly used due to fewer required connections.

  • Supply Voltage: Typically operates at 3.3V or 5V.

  • Compact Size: Its small footprint makes it perfect for wearable devices, small gadgets, and DIY projects.

4. Benefits of Using SSD1306 OLED Displays

  • High Contrast: Due to the self-emissive nature of OLEDs, the displays offer deep blacks, which translates to a high contrast ratio.

  • Low Power Consumption: Especially when displaying dark or black screens, as individual pixels can be turned off.

  • Wide Viewing Angles: The screen can be viewed from almost any angle without color shifts.

  • Fast Refresh Rate: Suitable for animations and rapidly updating displays.

The sample code for interfacing an OLED display (presumably with an SSD1306 controller) with an Infineon board using the ModusToolbox SSD1306 library.

  • Include necessary libraries

#include "mtb_ssd1306.h"
#include "GUI.h"
    cy_rslt_t result;
    cyhal_i2c_t i2c_obj;

    /* Initialize the device and board peripherals */
    result = cybsp_init();

    CY_ASSERT(result == CY_RSLT_SUCCESS);

    /* Initialize the I2C to use with the OLED display */
    result = cyhal_i2c_init(&i2c_obj, CYBSP_I2C_SDA, CYBSP_I2C_SCL, NULL);

    CY_ASSERT(result == CY_RSLT_SUCCESS);

    /* Initialize the OLED display */
    result = mtb_ssd1306_init_i2c(&i2c_obj);

    CY_ASSERT(result == CY_RSLT_SUCCESS);

    __enable_irq();
    GUI_Init();
    GUI_DispString("Hello world!");
  • Initialization: initialize the board and its peripherals.

  • I2C Configuration: configuring the I2C pins and initializing the I2C interface.

  • OLED Initialization: Initializing the OLED display using I2C.

  • Graphics Handling: used the GUI library to display the "Hello world!" text on the OLED.

Last updated

Assoc. Prof. Wiroon Sriborrirux, Founder of Advance Innovation Center (AIC) and Bangsaen Design House (BDH), Electrical Engineering Department, Faculty of Engineering, Burapha University