128×64 I2C OLED display (How-to & Review)

When you need to read some kind of output from a DIY electronic device and a notebook is out of reach a small display might be the solution. In this post I’m writing about an inexpensive 128×64 pixel monochrome OLED display. Let’s get started!

This particular display is a bit different than others because the top 16 pixels are yellow and the remaining 48 are blue. There’s also an approximately 2 pixels high gap between the two parts of the screen so you’re basically forced to use the top part for a different purpose for example as a status bar.

The screen comes with a nice screen protector with a tab to easily remove it after installation. The PCB is prepared with 4 reasonable-sized holes in the corners for fixation and a 4 pin header already installed for powering and communicating with the display. It can be connected directly to an Arduino without any additional parts.

The communication is done with I2C protocol so only a data and clock line is needed.

IMG_20150926_174710

  • VCC to 5V on Arduino
  • GND to GND on Arduino
  • SCL to A5 on Arduino
  • SDA to A4 on Arduino

First, we need to find the address of the module. Since I2C is a bus, more than two devices can communicate using the same two wires. That’s why every device should have a unique 7-bit device address on the same bus. This address is normally in the datasheet of the device, but it can also be found using a simple Arduino sketch. So after wiring everything up I suggest running this sketch to find out the address of the display. Mine was 0x3C. If you happen to have problems with the communication, try adding a 10k resistor between 5V and SCL and another between 5V and SDA.

Scanning...
I2C device found at address 0x3C !
done

After this, we’re ready to test the display. I suggest using the libraries of Adafruit Industries. We’ll need two of them:

The procedure of installing an Arduino library is always the following:

  1. Download the zip file
  2. Extract the folder somewhere
  3. Confirm that the folder contains the necessary files
  4. Move the folder to the Arduino library folder which should be …\My Documents\Arduino\libraries on a regular windows installation
  5. Restart the Arduino software

To get exactly what I have in the featured image of this post, upload the following sketch to the Arduino:

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);

static const unsigned char PROGMEM electropit_favicon [] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xC0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0F, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0xF0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3F, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x78, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7C, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x3C, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xF0, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xF0, 0x7F, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0xFE, 0x00, 0x00, 0x00,
0x00, 0x00, 0x79, 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xF0, 0xFE, 0x00, 0x3E, 0x00,
0x00, 0x00, 0x7F, 0xE0, 0x1E, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x3F, 0xC0, 0x1E, 0x00, 0xFF, 0x80,
0x00, 0x00, 0x0F, 0x00, 0x1E, 0x01, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x00, 0x1F, 0xFF, 0xF3, 0xC0,
0x00, 0x00, 0x00, 0x00, 0x1F, 0xFF, 0xE3, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x1F, 0xFF, 0xE3, 0xC0,
0x00, 0x00, 0x00, 0x00, 0x1F, 0xFF, 0xE3, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x1F, 0xFF, 0xE7, 0xC0,
0x00, 0x00, 0x00, 0x00, 0x1E, 0x01, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x01, 0xFF, 0x80,
0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x7C, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x0F, 0x80, 0x00,
0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xFF, 0xFF, 0xC0, 0x00,
0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
0x00, 0x00, 0x03, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xC0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0xFF, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFF, 0xE0, 0x00, 0x00,
0x00, 0x00, 0x00, 0x07, 0xFF, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFF, 0xC0, 0x00, 0x00,
0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

void setup()   {                
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);

  display.clearDisplay();
  display.setTextColor(WHITE);
  display.setCursor(0,0);
  display.setTextSize(2);
  display.println("ELECTROpit.com");
  display.drawBitmap(50, 5, electropit_favicon, 64, 64, WHITE);
  display.display();
}


void loop() {
  
}

Now I won’t really go in details with this module but I’ll use in future posts. If you need some ideas I recommend the example sketch included in the Adafruit libraries. Unfortunately this particular display has been discontinued right after I got mine so It might be harder to get one now.

Summary

Product name: 0.96” 128×64 I2C Interface Blue Color OLED Display Module for Arduino / RPi / AVR / ARM / PIC

Pros
  • High contrast and brightness
  • Relatively high resolution for its size
  • Needs only 2 pins and power
  • Arrives with screen protector
Cons
  • none

1 CommentLeave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *