SSD1306 not working on Arduino with Rpi Pico

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
kscharf
 
Posts: 277
Joined: Wed Sep 10, 2008 10:29 am

SSD1306 not working on Arduino with Rpi Pico

Post by kscharf »

I've tried using the Adafruit SSD1306 Arduino library with the Rpi Pico. It doesn't seem to run the demo example sketch that comes with the library. (It DOES compile, just nothing on the display.) I used the default I2C pins (GP4, GP5). I then loaded the I2C scanner sketch, and that DID find the SSD1306 at address 3C, so I put that into the demo sketch. Still no joy.
Just for grins, I then tried using an AVR128DD28 chip I have on a breadboard using the DXCore Arduino board package I downloaded from GitHub. THAT works, so I know the display board is good.
Has anyone else had any issues with SSD1306 based 128x64 or 128x32 monochrome OLED displays on the Rpi Pico with the Arduino package? One more thing, the display was running from the 3.3v output of the Rpi Pico, and with the AVR128DD, it was running on 5v. However, the displays are rated to run from 3.3-5v (they have regulators and level converters to allow the OLED to work with both power supply levels).

Maybe I should try Python?

User avatar
rooppoorali
 
Posts: 98
Joined: Sat Jul 16, 2022 12:04 pm

Re: SSD1306 not working on Arduino with Rpi Pico

Post by rooppoorali »


User avatar
kscharf
 
Posts: 277
Joined: Wed Sep 10, 2008 10:29 am

Re: SSD1306 not working on Arduino with Rpi Pico

Post by kscharf »

The link you posted says to redefine the SDA and SCL pin numbers in the sketch. Using the default pin numbers the i2c scanner example DOES compile and it DOES find the board. So there is nothing wrong with the pin numbers I'm using or my wiring. If I then load the SSD1306 example sketch it DOES compile, but it doesn't work (nothing on display). I DID change the address from 0x3D to 0x3C in the demo sketch because that is the address that the scanner reports.
I have also tried running the sketch on an Adafruit ItsyBitsy SAMD51 and that also works, so the library and demo example do work on an ARM Cortex processor, and on 3.3 volts. Just not on the Pico.

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: SSD1306 not working on Arduino with Rpi Pico

Post by adafruit_support_carter »

What I2C scanner sketch were you using? Seems like this might just be something with making sure the correct pins are being used.

User avatar
kscharf
 
Posts: 277
Joined: Wed Sep 10, 2008 10:29 am

Re: SSD1306 not working on Arduino with Rpi Pico

Post by kscharf »

Here's the sketch:

Code: Select all

// --------------------------------------
// i2c_scanner
//
// Version 1
//    This program (or code that looks like it)
//    can be found in many places.
//    For example on the Arduino.cc forum.
//    The original author is not know.
// Version 2, Juni 2012, Using Arduino 1.0.1
//     Adapted to be as simple as possible by Arduino.cc user Krodal
// Version 3, Feb 26  2013
//    V3 by louarnold
// Version 4, March 3, 2013, Using Arduino 1.0.3
//    by Arduino.cc user Krodal.
//    Changes by louarnold removed.
//    Scanning addresses changed from 0...127 to 1...119,
//    according to the i2c scanner by Nick Gammon
//    http://www.gammon.com.au/forum/?id=10896
// Version 5, March 28, 2013
//    As version 4, but address scans now to 127.
//    A sensor seems to use address 120.
// Version 6, November 27, 2015.
//    Added waiting for the Leonardo serial communication.
// 
//
// This sketch tests the standard 7-bit addresses
// Devices with higher bit address might not be seen properly.
//

#include <Wire.h>


void setup()
{
  Wire.begin();

  Serial.begin(9600);
  while (!Serial);             // Leonardo: wait for serial monitor
  Serial.println("\nI2C Scanner");
}


void loop()
{
  byte error, address;
  int nDevices;

  Serial.println("Scanning...");

  nDevices = 0;
  for(address = 1; address < 127; address++ ) 
  {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    Wire.beginTransmission(address);
    error = Wire.endTransmission();

    if (error == 0)
    {
      Serial.print("I2C device found at address 0x");
      if (address<16) 
        Serial.print("0");
      Serial.print(address,HEX);
      Serial.println("  !");

      nDevices++;
    }
    else if (error==4) 
    {
      Serial.print("Unknown error at address 0x");
      if (address<16) 
        Serial.print("0");
      Serial.println(address,HEX);
    }    
  }
  if (nDevices == 0)
    Serial.println("No I2C devices found\n");
  else
    Serial.println("done\n");

  delay(5000);           // wait 5 seconds for next scan
}
Last edited by adafruit_support_carter on Tue Jul 26, 2022 2:20 pm, edited 1 time in total.
Reason: added [code] tags

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: SSD1306 not working on Arduino with Rpi Pico

Post by adafruit_support_carter »

Thanks. Yah, it's just using the Wire directly. Same as the SSD1306 library.

Which specific OLED are you using? Can you link to product page.

User avatar
kscharf
 
Posts: 277
Joined: Wed Sep 10, 2008 10:29 am

Re: SSD1306 not working on Arduino with Rpi Pico

Post by kscharf »

I'm not sure where I got this one. IIRC it was this one
https://www.mpja.com/Mini-128X64-Blue-O ... /35506+OP/
I had an older Adafruit display in the junk box, but I can't locate it at the moment. They all seem to use the same module, but do have different options on the PC boards as far as power supply and level conversion go. The cheaper ones just use resistors for the level conversion, but they all seem to have a LD regulator to supply the 3.3 volts required by the OLED internally. Adafruit seems to strap the I2C address for the 32 and 64 row displays to different addresses, but the more generic modules can use either of the available address that the controller can be set to. That's why I usually run the I2C scanner script first to catch this.

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: SSD1306 not working on Arduino with Rpi Pico

Post by adafruit_support_carter »

It could be something specific to the module. The libraries have only been tested against the displays in the Adafruit shop. We don't support usage with other displays.

It could still be something with the Pico, since it can be confusing where the actual I2C bus shows up in terms of pins. But the scanner sketch and the display library seem to be using Wire in the same way.

Looks like there's a potential documentation issue but possibly someone got it working with the Adafruit library?
disp.jpg
disp.jpg (20.67 KiB) Viewed 464 times

User avatar
kscharf
 
Posts: 277
Joined: Wed Sep 10, 2008 10:29 am

Re: SSD1306 not working on Arduino with Rpi Pico

Post by kscharf »

Yeah, I saw that. However, when the display was used on the Adafruit Itsybitsy SAMD51, it did work as a 64 line display.
I think the confusion was that the display shows up in the scanner at the address of the 32 line display.
I'll have to order one of the Adafruit I2C oled modules and try that out with the PICO if I can't find the one I bought some time ago.
There are also a few other libraries out there for the SSD1306 I could try.
However, at the moment, the only combo that doesn't work here is with the module I have on hand and the PICO, it works with both an AVR128DD and a SAMD21.
So the problem seems to be with the PICO and Arduino. I should try the PICO with Python too.

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”