Fork me on GitHub

Project Notes

#527 SSD1306 With u8g v2

Testing an SSD1306 128x32 OLED with the new v2 u8g library over I²C.



I grabbed a white 128x32 0.91” OLED Module to test for a new project, and discovered there’s a new version of the U8g library (v2) that’s also worth checking out.

It seems the author has put a lot of work into refactoring and improving what was already one of the best lightweight libraries for driving monochrome displays.

One of the main differences is that Arduino support is provided in two classes that can be chosen to best suit the application:

  • U8g2 - includes all graphics procedures, many fonts, but requires buffer memory
  • U8x8 - text only, fonts that fit an 8x8 grid, writes direct to device (no buffer memory)

I cobbled together two sketches to test each of the interfaces: DemoU8g2 and DemoU8x8 respectively.

OLED Module Specs

  • OLED display, self-illuminating (no backlight), also lower consumption.
  • Driver IC: SSD1306
  • Size: 0.91 inch
  • OLED Resolution: 128 x 32
  • I²C interface
Pin Description
GND Power Ground
VCC Power + (DC 3.3~5v)
SCL Clock Line
SDA Data Line

oled_mechanical1 oled_mechanical2


The module works well on 3.3V or 5V. I have added pull-up resistors on the I²C, but with short jumper wires these don’t seem essential. Combinations I’ve tested that work:

  • 5V Arduino, 3.3V power to OLED, with pull-up resistors
  • 5V Arduino, 5V power to OLED, with pull-up resistors
  • 5V Arduino, 5V power to OLED, no pull-up resistors




Testing a couple of fonts with the U8g2 library API. Flash size: 9482 bytes.


Testing a couple of fonts with the U8x8 library API. Flash size: 6764 bytes.


Credits and References

About LEAP#527 OLEDArduino
Project Source on GitHub Project Gallery Return to the LEAP Catalog

This page is a web-friendly rendering of my project notes shared in the LEAP GitHub repository.

LEAP is my personal collection of electronics projects, usually involving an Arduino or other microprocessor in one way or another. Some are full-blown projects, while many are trivial breadboard experiments, intended to learn and explore something interesting (IMHO!).

The projects are usually inspired by things found wild on the net, or ideas from the sources such as:

Feel free to borrow liberally, and if you spot any issues do let me know. See the individual projects for credits where due. There are even now a few projects contributed by others - send your own over in a pull request if you would also like to add to this collection.