SH1106 OLED modules

Posted on
  • I've noticed that a lot of the 1.3 inch OLED modules come with an SH1106 controller, rather than an SSD1306. I've found some Python code which can drive both here:
    The initialisation code differs between the two devices, and the SH1106 seems to only have one access mode, but I think with this and the datasheets there is enough information to be able to write an SH1106 module equivalent to the existing SSD1306 one. I think I'll have a go, once I've acquired a module.

  • Ok, great! To get started, I'd work off the existing SSD1306 then - add var exports = {} to the top of the edit window in the Web IDE, copy in the module code from here after it, and then instead of using var g = require("SSD1306").connect(I2C1, go);, do var g = exports.connect(I2C1, go);.

    Hopefully you can then fiddle with the initialisation code until it works :)

  • I've modified the SSD1306 code and got it working with an SPI interface. Most of the initialisation code is the datasheet defaults. I haven't tried I2C, and can only test 64 pixel display height, but all that code is still in. I've added an option to rotate the display so that the pin header can be at the bottom, however there is almost certainly a better way of doing it.
    I've yet to write, and then wrestle with Github, which I've not used seriously before.
    Edit: I've got round to actually reading the Graphics class documentation, and my rotate code is redundant, so it's coming out.

  • That's awesome - thanks for the GitHub PR! I'll get it live on the site this week.

    Yes, the rotation was something that ended up getting used so much that it made a lot of sense to built it right in!

  • I've just successfully downloaded it, so now I want to improve the documentation. I've a photo of a module connected to a Pico, and I want to get the reference comments included. Also I found an application note about organic LEDs which I think should be in its own thread.

  • Thanks! I tweaked it slightly to add some keywords (and I think I changed the folder it was in so it's with the other displays), so it's now here

    But adding images is pretty easy. Just add a file called SH1106.jpg and then add the line ![Image Title](SH1106.jpg) to the .md file where you want it.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

SH1106 OLED modules

Posted by Avatar for Psycho_Moggie @Psycho_Moggie