Home LearningBasics Connecting an I2C OLED display

Connecting an I2C OLED display

by shedboy71

Just recently I spotted various I2C OLED displays on sale at reasonable prices and fancied trying to connect these up one of my Arduino's. Being relatively small size, requiring only 2 connections SDA and SCL from the Arduino but still having good text and graphical capabilities I snapped a couple up cheaply on the net. Here is a picture of the OLED display I bought, these are common on many sites at the moment

i2c oled lcd

i2c oled lcd

The first problem was connecting it up, this proved straightforward enough as the display can take standard 5v and GND and as its an I2C device on my Arduino UNO I hooked up A4 and A5 which are SDA and SCL respectively

Connection

 

Pin Label Arduino PIN I2C Function Notes
GND Ground Ground 0V
VCC Power Power Regulated 5V supply.
SDA A4 SDA Serial data in
SCL A5 SCL  I2C clock

Code

Now finding a working library proved to be problematic, I tried various ones and no success, eventually I located the Multi LCD library and have mirrored it at the following link

There are a few examples but here is a basic hello world that will show you how to display some text

[c]

#include <Arduino.h>
#include <Wire.h>
#include <MicroLCD.h>

//LCD_SH1106 lcd; /* for SH1106 OLED module */
LCD_SSD1306 lcd; /* for SSD1306 OLED module */

void setup()
{
lcd.begin();
}

void loop()
{
lcd.clear();
lcd.setFontSize(FONT_SIZE_SMALL);
lcd.println(“Hello, world!”);
lcd.setFontSize(FONT_SIZE_MEDIUM);
lcd.println(“Hello, world!”);
delay(1000);
}

[/c]

 

Links
I2C 128X64 OLED LCD LED Display Module For Arduino on Amazon

I2C OLED displays on Amazon UK

0.96″ 128×64 I2C Interface White Color OLED Display Module for Arduino / RPi / AVR / ARM / PIC

Share

You may also like