Showing results for 
Search instead for 
Did you mean: 

How to deal with I2C OLED display with SSD1306?

Emilio Andreozzi
Associate II
Posted on May 11, 2017 at 10:36

Hi, I'm trying to use an I2C OLED 128x32 display with SSD1306 controller with my Nucleo-L432KC board. Actually I'm using MBED for fast prototyping and I found so many different libraries for SSD1306, so I don't know which is the right one for my display.

Does anyone know how to deal with this display?


I tried to use the SSD1306 library by Jonathan Gaul and I found that the constructor function needs information about ''C/S pin'', ''Reset pin'' and others as arguments, but my OLED display has only 4 pins: two power pins and two I2C pins (SDA,SCK), so I really don't know how to deal with it.

I will appreciate any kind of help, thank you in advance! 

#stm32l432 #nucleo-l432kc #ssd1306 #mbed #i2c #nucleo #oled
Erik de Wit
Associate II
Posted on May 11, 2017 at 10:55

Hi Emilio,

I have not used this display, and I do not know what library can be used best, but I took a look at the driver sheet, and this driver can be used with different interfaces, meaning, the manufacturer of the display selects one or more interfaces you can deal with. In your case, it is only I2C, so I suspect you have a library for one of the other interfaces. Maybe when you take a look at the other libraries, there is one that is specifically for the I2C interface. 





Posted on May 11, 2017 at 14:53

Hi Erik,

thanks for your answer.

That's exactly as you wrote: the SSD1306 supports at least both I2C and SPI, but I couldn't find how to use the I2C interface. There are no examples of use of this display, even though it is quite common in the electronic hobbyists community.

I need to use a small display with the minimum amount of communication wires, because I'm using the Nucleo-L432KC, which is a small 32-pin model of nucleo boards (it is intended for Arduino Nano compatibility), and I found only this model. I don't know if there are other types of small displays which are simpler to communicate to.

I really need help for the library, because I need to use this display for my MSc Thesis project.
Posted on May 11, 2017 at 19:58

Hi Emilio,

I get your problem, unfortunately I don't have time to help you write the library, but I've done some searching which may be helpfull (or not).

Here you can find a page with a simular project, looks the same display, also I2C and written for STM32. It's in russian but you can translate using Google translate:

Good luck!

Posted on May 12, 2017 at 10:31

Hi Erik,

thank you so much for this link, I'm going to follow its instructions, but I'm pretty sure I'll have to adapt the library to the STM32L432 HAL. If I succeed in this 'mission' I'll post it here!

Have a good day!
ST Employee
Posted on May 16, 2017 at 18:24


some time ago I integrated SSD1306 driver  from Adafruit in Cube environment and made it run on a Discovery-F429 using a 128x64 pixel display via I2C.

It should fairly easy to integrate it in MBED or other environments.

You can find the code here: