Skip to content
Simple SSD1306 library for AVR microcontrollers.
Branch: master
Clone or download
Latest commit a658894 Feb 10, 2016


SSD1306-AVR is a C++ library for using SSD1306, 128x64, monochrome OLED displays. Currently only the I2C version of the display is supported.

The I2C address of the display is set up in SSD1306.h :

#define SSD1306_DEFAULT_ADDRESS 0x78

The library is written in pure C++. You'll only need avr-libc, Arduino framework is not needed.

This library is released under a VERY permissive license. Do anything with it, but if something goes wrong, it is YOUR problem (= NO WARRANTY AT ALL).

Example code (no framebuffer used)

#include <stdint.h>
#include "SSD1306.h"

int main(void) {
    // This is our buffer
    // Each byte = 8 pixels on the screen
    uint8_t buffer[1024];

    // Only two lines of code to initiate the driver
    // and to send our framebuffer
    SSD1306 myDisplay;

    // Hardware function to reverse the pixels
    // (swap black and white pixel)
    // Revert back to normal display

    return 0;

Another example code (using the framebuffer)

#include <stdint.h>
#include "Framebuffer.h"

int main(void) {
    Framebuffer fb;


    return 0;

As you can see the framebuffer API is quite easy to understand.

Images !

You can display images using the Framebuffer, though you will need to convert those images using Esther.

#include <stdint.h>
#include <avr/pgmspace.h>
#include "Framebuffer.h"

const uint8_t image[] PROGMEM = {

int main(void) {

    Framebuffer fb;


    return 0;

SSD1306 simulator

It is very experimental, maybe not usefull.

The simulator in action

There are some example programs using the simulator, in /examples/. Compile the simulator (requires SDL2) and the example program, then run your example program like this :

./examples/example1/example1 | ./simulator/simulator

Looking for your support

If you would like to see 128x32 displays (or any other I2C SSD1306-based displays) supported by my library, please do a donation, so that I could buy one of those displays to improve my library.

I currently accept PayPal and Bitcoin donations.

You can’t perform that action at this time.