Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: Is it possible? OLED I2C SH1106 using Arduino GFX Library

  1. #1
    Junior Member
    Join Date
    Jun 2020

    Is it possible? OLED I2C SH1106 using Arduino GFX Library

    Hey folks,

    Has anyone seen any evidence of a library that can display information on a 128x64 I2C display using SH1106 along with Adafruit GFX?

    I've been working on a project and have been prototyping with a 128x32 I2C display that uses SSD1306 along with Adafruit GFX and it's all gone swimmingly! Now i'm working with a larger display that uses SH1106 instead of SSD1306, and I'm not so much swimming as I am drowning. I know U8glib and U8g2lib can handle SH1106, but compared to Adafruit GFX's slick "display.println("hello world")" to get text on the screen, the U8g libraries are awfully clunky and I'd love to avoid using them. I've tracked down LOTS of libraries that claim they can work with GFX and support SH1106 but none have risen to the occasion, including "ports" of the SSD1306 that supposedly work for SH1106

    The closest I've gotten is here:

    Has anyone out there managed to get this working? Or can anyone at least point me to a library that puts thought into writing out it's instructions and the process of how to actually use the library? There's a lot of libraries out there that are overwhelmingly undocumented.

    Any help or insight would be much appreciated!

    Thanks folks

  2. #2
    Junior Member
    Join Date
    Nov 2018
    Only just yesterday was I having similar issues, I have an eBay/China "SSD1306 128x64 OLED display.
    I initially used the Adafruit_SSD1306 library, but had issues with each display write would move the display 1 pixel right, even though a (0,0) co-ordinance was used.
    I then tried other libraries, an SH1103 which was supposed to be the chip used in the so called SSD1306, but that would only render basic text in small size.
    I tried other SH110X libraries, but could not get them to work, so went back to the Adafruit_SSD13-6 library.
    I then used the following to fix the display shift right problem, after each display.display(); use.

    display.startscrollleft(0x00, 0x0F);

  3. #3
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    I installed the Adafruit library, and I opened up their example(OLED_featherwing) and built for Teensy 4.1 and it built.

    Note: I am usigin Arduino 1.8.13 and did a clean install of the latest beta Teensyduino for it, which does NOT install Adafruit_GFX or some of the drivers that require it. So you should then just use the current version of Adafruit_GFX.

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Quote Originally Posted by MIDIMinion View Post
    Now i'm working with a larger display that uses SH1106 instead of SSD1306
    Any chance you could give us a link to this display? Is it an Adafruit product, or something else?

    Also to echo Kurt's advice, definitely use 1.53-beta2. We've recently changed stuff for better compatibility and fewer conflicts with newer Adafruit libs. Best to start with a fresh copy of Arduino before installing Teensyduino, so you don't have leftover copies of old versions of Adafruit_GFX.

  5. #5
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Ayer Massachussetts
    And the other generic advice with I2C devices.

    The I2C bus needs pull-up resistors on the SCL (19) and SDA (18) pins. You only need one set of resistors on the I2C bus. Many newer Adafruit and Sparkfun I2C devices include the appropriate pull-up resistors, but other I2C devices may not include the resistors.

    The simplest way to test if you need resistors is to connect the device and run the Examples -> Wire -> Scanner sketch. If the serial monitor indicates that it found the device, then you don't need to add the resistors. If the serial monitor appears to hang, then you need to add the resistors.

    For 3.3v systems, a typical value of 2.2K ohms is needed. A pull-up resistor is run in parallel between the data pins and 3.3v. You will need two resistors, one for pin 19 and one for pin 18.

    If you have Teensy 3.1, 3.2 or Teensy 3.5, if you use a 4.7K ohm resistor instead of 2.2K, you should be able to run the I2C devices at 5v. Some I2C devices need 5 volts. Note, any other Teensy (3.0, 3.6, 4.0, 4.1, or LC) CANNOT use a 5v I2C bus directly. If you hook up 5v, you will likely fry your Teensy. There are simple level shifters available that allow you to use a 3.3v device like a Teensy and control a 5v I2C bus.

    Back in the day when I transitioned from 5v Arduino to 3.3v Teensy and still used I2C displays, some of my displays would not actually display characters unless the I2C bus was run at 5v. The device would accept I2C commands, but the actual display needed 5v.

    Another thing for devices meant to be used with the slower Arduino systems is the device may take longer to initialize itself, so sometimes putting a 2-3 second delay in the startup function will allow the device to be used.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts