I²C bus and Adafruit OLED SSD-1306

Hello Everybody,

I want to control an Adafruit OLED Display with SSD-1306 Chip via the I²C bus.
Has anybody a solution for this problem or a firmata modification?

I want to use snap4arduino with an existing photometer device https://desk-lab.de in education.

Michael Huke

Hi Michael (@mhuke)

Not a simple topic. Three comments about this, and we can continue...

  • First. StandardFirmata has i2c support. And Snap4Arduino has a library with the basic i2c blocks to play. So, I can say you can do it directly with Snap4Arduino and the default StandardFirmata firmware. But here, two important comments:

    • You will begin on the low level of i2c communication. No simple commands like "clear", "print letters", "scroll"...
      • From this lower level, you need to study your device specifics, or (I think easier) study its Arduino library. For example, to write one character, you will need to send 6 command-bytes by the i2c connection.
      • But of course, you can make your library and offer a higher level of commands (clean, print...).
      • And also you can use this excuse to work different topics with your students: hexadecimal encoding, communication buffer, unicode character values ...
      • Attached bellow some demo... And if this working level is interesting for you, we can continue with more details, or helping to build that library...
    • And beyond the complexity of this (which can also be an opportunity to play and learn) you will have some limitations on LCD behavior. Basically two:
      • Some lag. Each little command has quite a few i2c sending messages. It will not be a problem for the basic actions (write, clean...) but yes for scrolling or other graphic effects.
      • Some (few) unexpected behavior, due to possible breakage of control messages at some point.
        But hey! But it could be a hard fun experience!
  • Second option. Build an custom Firmata to do this. I think there is no one done just to use with those i2c-LCD devices. But there are some others using LCD with a parallel conecction (6 pins). It could be easy to use these firmatas to implement it. The commands are the same and you only have to change the library and do little adaptations. You can go to http://snap4arduino.rocks/#devices with the info of these firmata mods.

  • Third, just a comment! I know any feature could be interesting... and its is not black or white. But I never needed this LCD feature. Why?

    • Yes I know more autonomous projects (maker things) use these LCD to show some text information, or pictures. It's the only way for some devices to communicate anything.
    • And also, I see many projects where the main goal is to use the different functionalities of the device that they have in hand.
    • But hey! If you are playing with Snap4Arduino, your computer is always there!! For me it is not a limitation. I don't need (and I don't want) autonomy because I want the computer there, keeping the environment (and the project) alive and dynamic.
      Then, you have always a bigger screen, with a lot of pixels and real color. So, I do not miss using LCD devices... I like our Snap! stage more!!
      And (I've said this is not black or white) the same for other features. We have the computer with a screen, speakers, keyboard, microphone, webcam, internet... I want devices to add extra features. And we have so many features, that I want projects focused on their own goals, not the tools available.

That's all. I upload some pictures to show clearly the idea of Comment1, working directly with i2c features.



Hi...I purchased the 128x64 OLED and tryed to use with my Raspberry-PI. Im utilizing the py-gaugette lib by Guyc, I know its for the x32 rendition.

The showcase appears to be working, however just consistently line - > the lib isn't for the x64 adaptation. I attempted to change a few things, however no achievement :frowning: Is there an other workig lib for the ss1306 with 128x64 ? or on the other hand could somebody assist me with the py-gaugette lib?

I think your google search has brought you to the wrong place

I'd suggest the main Pi forum for this question


Not directly related to your Python problem; however if you were using Micro blocks, we are just about getting done with the SD1306 and SD1309 libraries completely written in MB. The reason I mentioned it here is because MB runs on RPI.
If of interest, contact me offline via email so we do not clutter the SNAP forum.