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

ESP32 Development Board WiFi+Bluetooth Ultra-Low Power Consumption Dual Cores ESP-32 ESP-32S Board
Integrated antenna and RF balun, power amplifier, low-noise amplifiers, filters, and power management module. The entire solution takes up the least amount of printed circuit board area. This board is used with 2.4 GHz dual-mode Wi-Fi and Bluetooth chips by TSMC 40nm low power technology, power and RF properties best, which is safe, reliable, and scalable to a variety of applications.
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

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