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

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

Display Arduino
VCC 5V/3.3V
GND GND
SCL A5
SDA A4

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

blank
Posted by Daniel Eichhorn

Daniel Eichhorn is a software engineer and an enthusiastic maker. He loves working on projects related to the Internet of Things, electronics, and embedded software. He owns two 3D printers: a Creality Ender 3 V2 and an Elegoo Mars 3. In 2018, he co-founded ThingPulse along with Marcel Stör. Together, they develop IoT hardware and distribute it to various locations around the world.

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