Oled 128×64 SSD1306 display & Arduino – How to get started

Do you like this post? Writing posts, developing libraries and programming online font creators is actually hard work. I order most of my electronics from a Chinese website called Banggood. It is save and the items usually arrive in good quality. With every order you do there by following this link you are supporting the blog. Thank you!

Today I received one of those super cheap Oled displays which I bought on Banggood and it was hard to find one single source of help for this tiny display. Maybe this post will help you when you receive yours

The module

To be sure that we are talking about the same module look at the back and check if there is a label saying “www.heltec.cn” and if the module has four connectors labeld VCC, GND, SCL and SDA:

Download library

There are several libraries that might work with this module. I chose u8glib because it seems to offer many features. Download the Arduino library from here and put it into the libraries subfolder of your Arduino working directory. On a Mac this might be a subfolder of Documents. Then (re)start your Arduino IDE. If it worked you should have now a U8glib entry under Sketch > Import Library…

Connect the display

DisplayArduino
VCC5V/3.3V
GNDGND
SCLA5
SDAA4

Upload the Source Code

#include <U8glib.h>

U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);  

void draw() {
  u8g.setFont(u8g_font_unifont);
  u8g.drawStr( 0, 20, "Hello world");

}

void setup() {
}

void loop() {

  u8g.firstPage();  
  do {
    draw();
  } while( u8g.nextPage() );
    delay(1000);
}

Run it

Sources

Posted by squix78

One comment

  1. Hi Dani. Did you ever get the u8glib libary ported to the esp8266 chip? There soem youtube videos but it looks like nobody has uploaded the changed lib. In the nodemcu master with lua scripting it is included but this is not helpful for me because I want something else than the lua

Leave a Reply