Home LCD Projects I2C OLED display example

I2C OLED display example

by shedboy71

This example shows how to connect an I2C OLED display to 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

 

 

[codesyntax lang=”cpp”]

#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);
}

[/codesyntax]

 

[/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

You may also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More