0

Using Adafruit SH110x OLED with Teensy 3.2 board
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Using Adafruit SH110x OLED with Teensy 3.2 board

by kb4mg on Sun May 23, 2021 2:41 pm

Anyone out there have success with mating the OLED (SH110x 128x64) with a Teensy 3.2? I have messed with the code and can't seem to get this to work as planned. I reverted to the sample sketch on the Adafruit site, but that has the same behavior as my code. I find I have to do three to five reloads of the sketch and then it magically starts working. My guess is that it has something to do with the I2C interface and what happens at power up time. If I remove power I have to again hit the reset button the Teensy 3 to 5 times before the display works. It does not even show the Adafruit splash screen when this happens.
Because this is a Teensy 3.2 (NXP processor based) , I am assuming this is related to some behavior of the Teensy and not the OLED. Maybe the I2C timing? Not sure.

I did try adding a higher speed for the I2C in the constructor, thinking maybe it was running too slow and did not have enough time before the processor starts executing other code. No joy with that either.

I then tried using the module with an Adafruit Metro Mini. I got the same results, to my surprise, so know the issue is not with the Teensy. This is some behavior related to this OLED display and associated driver hardware.

Stumped in Georgia,

Marty B.

kb4mg
 
Posts: 5
Joined: Mon Apr 08, 2019 5:18 pm

Re: Using Adafruit SH110x OLED with Teensy 3.2 board

by adafruit_support_mike on Sun May 23, 2021 8:18 pm

Check over in the PJRC forums:

https://forum.pjrc.com/

That's the hole of the Teensy, and folks there have done a lot of work getting our hardware to run with Teesnys.

adafruit_support_mike
 
Posts: 63059
Joined: Thu Feb 11, 2010 2:51 pm

Re: Using Adafruit SH110x OLED with Teensy 3.2 board

by kb4mg on Wed May 26, 2021 1:02 pm

Just to eliminate the Teensy from the equation I connected the OLED to a Adafruit Metro Mini. I am seeing the same behavior. What is about this display and I2C that makes it work in a peculiar way? I find I have to reset the Mini about 4-5 times, them the display functions. maybe a bad display? I ac return it to Adafruit.
Thanks for any suggestions

kb4mg
 
Posts: 5
Joined: Mon Apr 08, 2019 5:18 pm

Re: Using Adafruit SH110x OLED with Teensy 3.2 board

by adafruit_support_mike on Wed May 26, 2021 3:38 pm

The OLEDs do have to run a startup routine, but that should only be an issue if you start sending data the instant the system gets power.

Other than that, the only suspect I can think of would be a connection problem. Post a photo showing your hardware and connections and we'll see if those hold any clues. 800x600 images usually work best.

adafruit_support_mike
 
Posts: 63059
Joined: Thu Feb 11, 2010 2:51 pm

Re: Using Adafruit SH110x OLED with Teensy 3.2 board

by kb4mg on Sat May 29, 2021 8:43 pm

The connections are really straight forward, and the display does actually work after I reset about 3-5 times. Resets after that point all initialize the display properly. It is really weird. Like I said, I see the same behavior when I run it in a Metro Mini board. I thought it had something to do with pull up resistors for the I2C, but that too did not seem to help. I added pull ups from the SCK and SDA to +3v volts , as the display runs from 3 volts.

I am trying a few other experiments before giving up and just using a different display. I really like this one if I can get it to work.

kb4mg
 
Posts: 5
Joined: Mon Apr 08, 2019 5:18 pm

Re: Using Adafruit SH110x OLED with Teensy 3.2 board

by kb4mg on Sun May 30, 2021 4:12 pm

Here is a picture of the connections to the MetroMini board. I also find I have to reset it 3-4 times, then the OLED seems to function.
Basically the OLED is connected with GND to GND, +3v to the +3 on the Mini, SCK to A5, and SDA to A4.
Nothing could be more basic.
As you see in the picture, I do actually get a display if I hit reset 3-4 times. If I disconnect the USB, I have to go through the same procedure. I really acts like it is an I2C issue with drive to the OLED too low or marginal.

Here is the code to test the display, based on the Adafruit example. I did include the GFX stuff as this was a simple test.
Any issues with this code?

Code: Select all | TOGGLE FULL SIZE
// Test program for OLED - ADAFRUIT I2C interface 0x3c address
#include <Wire.h>  // I2C library
#include <SPI.h>

#include <Adafruit_SH110X.h>   //OLED Display with I2C Interface
#define OLED 0x3c


// Constructor for OLED instance called "display"
Adafruit_SH110X display = Adafruit_SH110X(64, 128, &Wire);

void setup() {

  pinMode(A4,OUTPUT);
  pinMode(A5,OUTPUT);
  // Serial monitor:
 
  // Init the OLED display
  display.begin(OLED, true); // Address 0x3C default address
  display.display(); // will show the Adafruit logo
  delay(4000);
  // Display setup
  display.clearDisplay();
  display.display();
  display.setTextSize(1); //Samm text size
  display.setRotation(1); // Landscape mode
  display.setTextColor(SH110X_WHITE); // Monochrome, but set white
  display.setCursor(0,0);
  // Add text to test
  display.println("TEST ABCDEFGHIJKLMNOPQRSTUVWXYZ");
  display.display();
  delay(1000);
  Serial.begin(9600);
  Serial.println("OLED setup completed and ready");
}

void loop() {
  // put your main code here, to run repeatedly:

    delay(10);
    yield();
    display.display();
}
Attachments
OLED to MetroMini.jpg
Breadboard picture
OLED to MetroMini.jpg (824.99 KiB) Viewed 308 times
Last edited by adafruit_support_mike on Sun May 30, 2021 6:23 pm, edited 1 time in total.
Reason: added CODE tags

kb4mg
 
Posts: 5
Joined: Mon Apr 08, 2019 5:18 pm

Re: Using Adafruit SH110x OLED with Teensy 3.2 board

by adafruit_support_mike on Mon Jun 07, 2021 5:21 am

Hmm.. it looks like you're using the STEMMA header for the connection. Technically that's an unsupported mode.. we design FeatherWings to work plugged into a Feather's headers, not as standalone breakout boards.

In this case, you may be having trouble because the RESET pin isn't connected. Try running a jumper between that pin on the FeatherWing and some pin on the Metro Mini, and edit the code to include the correct pin. IIRC, the library does a reset at startup to bring the OLED into a known state.

adafruit_support_mike
 
Posts: 63059
Joined: Thu Feb 11, 2010 2:51 pm

Re: Using Adafruit SH110x OLED with Teensy 3.2 board

by kb4mg on Fri Jul 02, 2021 4:32 pm

I am just getting back to this project. You are correct, no reset is applied with the STEMMA cable. I messed with it a bit more and found it did work if I connect the reset of the OLED to the reset on the Mini. Now I'll go back to the Teensy 3.2 and see if i can replicate this there. Thanks for the hint. I didnt think about what may get connected when it is a hat for Feather.
Martin

kb4mg
 
Posts: 5
Joined: Mon Apr 08, 2019 5:18 pm

Re: Using Adafruit SH110x OLED with Teensy 3.2 board

by adafruit_support_mike on Fri Jul 02, 2021 5:05 pm

Glad to hear you got things working. Happy hacking!

adafruit_support_mike
 
Posts: 63059
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.