Interfacing a I2C 0.96″ OLED Display with ATtiny85

Time to use a tiny OLED screen with a ATtiny85 to display something! This can be useful to display some text, or display sensor values. In this tutorial, I’ll be showing you how to interface a I2C 0.96″ OLED Display with the ATtiny85. To be frank, I can’t find much information about interfacing the ATtiny 85 with this I2C display, so hopefully this tutorial can help you in doing this.

Why use a small OLED Display?

OLED Displays do not require much power to turn it own, since no backlight is required to read the display. Furthermore, ATtiny projects do not need to have such a large screen to display all the value, and the screen of this size may be enough. Finally, with a small screen, you can make your ATtiny projects even more compact!


What Library am I using?

For this tutorial, I’m using the Tinysaur ssd1306xled library for displaying the text on the OLED Display, as that is the only library I think is small enough to display text on the ATtiny85, although there are limitations such as there is ony 2 sizes of fonts,etc. The tinsaur library can be downloaded here.

I wanted to use the Adafruit ssd1306 library at first, for it has many graphical options such as drawing shapes and lines, but I realised that the library was too big for the ATtiny85. Therefore, I have to find a smaller library. And that is when I found the TinySaur ssd1306xled library.


Connecting the ATtiny


The Tinysaur library has specified the pins of where the SDA & SCL of the OLED Display should be connected to the ATtiny85. The SCL pin should be connected to ATtiny85 pin 0, and the SDA pin should be connected to ATtiny85 pin 1.



I used the Tinysaur Library for this project. I changed the F_CPU constant from 1000000  to 8000000. The F_CPU constant is actually to be changed according to what speed your ATtiny is clocked. At 1000000, the flickering or the screen refresh is too obvious, so I think clocking the CPU clock at 8000000Hz would be much better. To do this, you have to burn the 8Mhz bootloader. (The flickering would not be so obvious)


You may also like...