November 16, 2020

OLED displays (SSD1306 and SSD1315)

No, SSD does not indicate "solid state disk", these are tiny (roughly 1 inch square) monochrome Oled displays.

These are cheap and plentiful and everyone is using them. The run just fine off of 3.3 volt power, which makes them much handier than the bigger 16x2 LCD displays that need 5 volts to light up. And you can address individual pixels.

I first bought five on AliExpress for $15 all told ($3 each). They were advertised as SSD1306, but arrived in boxes marked SSD1315. Whatever the case, they work.

I also bought six SSD1306 units on Amazon, paying $24 ($4 each). These have several rows of pixels on the top of the display in yellow and the rest blue. If I had the choice, I would go for all yellow, but I don't see these for sale. These also work fine. I was surprised to find that these are both cheap and quite available. Search AliExpress for OLED module and all kinds of things turn up. Links on AliExpress tend to be unstable, so you may have to repeat searches to find these.

i2c address headache

These come labeled as 0x78 or 0x7a and some of the drivers call this the i2c address. This is wrong. The i2c address is this value divided by 2 (shifted one bit right). I was pulling my hair out trying to use the 0x78 address with some standard i2c software until I realized the error. Indeed the value 0x78 is placed on the i2c bus, but this is the address shifted left one bit and the zero bit on the right indicates a write transaction.

Drivers and links

Adafruit offers a nice unit (but for $17.50) and everyone uses their driver or a derivative thereof. I derived my code from the "simple circuit" library because they claimed it was C code. It was not, it was C++ and for some kind of PIC compiler (with int1 data types). It had the Adafruit splash logo embedded in it, so it was clearly derived from some prehistoric form of the Adafruit driver.

This gives 7x5 characters (so you can have 8 lines of text on the display), but you can magnify the characters by 2,3,4, or whatever.

The "Notes" link talks about a "u8g2" library that is able to do cool things.

ESP32 with onboard OLED display

It is worth poking around AliExpress to see what is available. At one time there were ESP8266 boards being sold with onboard OLED displays. And perhaps there still are. Note the ESP32 board I found back in 2017 also included some kind of LiPo circuit as well, as a nice bonus.
Have any comments? Questions? Drop me a line!

Tom's Electronics pages / [email protected]