Embedded projects.

OLED text only display driver (SSD1306 and SH1106).

I was working on a small device of my own design some time ago which needed a display of some sort. I decided to go for an OLED display. As part of my research I found the u8glib and the Adafruit_SSD1306 drivers. They are great if bigger micro-controllers are used, i.e. more RAM, or if one needs/wants to display some type of graphics. This is due to the fact that they use a buffer in ram which is modified and then transferred to the display as a block.

In my situation I needed to display only text and, which made me write a display driver of my own that fulfills my needs. On top of that I needed a way to show text in Bulgarian, i.e. Cyrillic symbols. To achieve that I had to prepare a font that includes those characters. All that needs to be done in order to display Cyrillic characters is the .cpp files where Cyrillic is used to be stored in “Windows CP1251” encoding.

The approach was to write a driver which treats the display as a text display with number of rows and columns dependent on the character size. The way to work with is is by setting a desired position in rows and columns and printing a text. Only the affected pixels of the display are transferred on the print command. There is no buffer in the micro-controller’s RAM. The driver is intended to work with i2c devices and uses the AVR driver from my Peripheral drivers library. The driver might be used with other micro-controller families by providing a i2c driver with the same interface as the one used here.

The code is available at my Github repository and everybody might use it in correspondence with the MIT open sours license. One can find more detailed information on how to use it including examples in the repository.

There one can find more detailed information on how to use it including examples.

Here are couple of shots of a 0.96″(SSD1306) and a 1.3″(SH1106), displays showing the English and Cyrillic character sets, of the example I have added to the git repository:

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s