Adafruit ssd1306 Uno problem

Using Uno and Adafruit ssd1306 with the following connections:

Adafruit VIN==>Uno 5v
Adafruit GND==> Uno Gnd
Adafruit SDA==> Uno A4
Adafruit SCL==> Uno A4

I'm using the following sketch:

/*********
Rui Santos
Complete project details at https://randomnerdtutorials.com
*********/

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);

void setup() {
Serial.begin(115200);

if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128x64
Serial.println(F("SSD1306 allocation failed"));
for(;;);
}
delay(2000);
display.clearDisplay();

display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0, 10);
// Display static text
display.println("Hello, world!");
display.display();
}

void loop() {

}

No output from the OLED screen

TIA

NealA

Hi Neal. Suggest you click "report to moderator" and ask for your topic to be moved to the displays section, you should get help there. But also read the forum guide and add code tags to your post. After all, does your code contain a winking face emoji? That's what happens if you forget the code tags.

Have you tried the i2c scanner sketch, to see if the Arduino can see the display on the i2c bus and at the address you expected?

Paul:

Thanks so much for the reply. I am a newbie- and new to the forum. Sorry about the code tags.

What is the i2c scanner sketch?

I'll ask the moderator to move my post to the display section.

NealA

Ok, post a reply when you get those code tags fixed.

Using Uno and Adafruit ssd1306 with the following connections:

Adafruit VIN==>Uno 5v
Adafruit GND==> Uno Gnd
Adafruit SDA==> Uno A4
Adafruit SCL==> Uno A4

I have no output from the ssd1306

I'm using the following code:

Thanks

NealA

#include <Wire.h>


void setup()
{
  Wire.begin();

  Serial.begin(9600);
  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("Unknow 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
}

What I meant was, modify your original post and put the code tags there.

So you found the i2c scanner sketch. What was the output on serial monitor? (Please do not post an image of serial monitor, copy the text from there and paste it into your next post between code tags.)

No i2c detected

NealA

Adafruit VIN==>Uno 5v
Adafruit GND==> Uno Gnd
Adafruit SDA==> Uno A4
Adafruit SCL==> Uno A4

No i2c detected

Hardly surprising when you can't spell VCC and you connect the wrong pin to SCL.

Most SSD1306 modules have GND, VCC, SCL, SDA clearly marked.
Uno boards have GND, 5V, SDA, SCL clearly marked.

Yes, there are unusual displays. e.g. with slightly different pin names.
That is why it is always wise to post a link to the actual display that you bought.
This avoids your readers having to guess. And usually means that you get an accurate answer within an hour or two.

David.

p.s. we all make typos. you can always correct your own posts.

OK. Let me start over.

I am using the following Adafruit SSD1306 OLED with an Arduino Uno:

I have the following:

Adafruit VIN==>Uno 5v
Adafruit GND==> Uno Gnd
Adafruit Data==> Uno A4
Adafruit Clk==> Uno A5

I used I2C scanner and get "No I2C devices found"

I am using the following I2C Scanner

#include <Wire.h>


void setup()
{
  Wire.begin();

  Serial.begin(9600);
  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("Unknow 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
}

Are you using the connectors on the top of the module or the 4 pin connectors on the side/back? Did you solder the pin headers? Did you connect the RST pin?

@neala,

Thanks for the link. You have bought an Adafruit display.

You can configure it for SPI or I2C

It says that it defaults to I2C with Slave address = 0x3D

So it should work out of the box with your wiring.

Adafruit has a page about wiring the display : Wiring 128x64 OLEDs | Monochrome OLED Breakouts | Adafruit Learning System

Most people buy 4-pin I2C displays e.g. from Ebay, AliExpress, ... pins marked GND VCC SCL SDA Slave=0x3C. (always I2C but you can often select 0x3C / 0x3D )
There are also 7-pin SPI displays. (you can change some of these modules to I2C)

David.

Using the pins on top. Pins soldered. Using breadboard. Tried with & without RST to Digital 4. Still reading "No 2C detected" on serial monitor when using the I2C scanner sketch. LED on Adafruit OLED is on.

Maybe the Adafruit OLED is bad?

Seriously, there are only 4 wires. You can't go far wrong. Especially with soldered pins and good quality jumper cables.
Just run the standard ssd1306_128x64_i2c.ino example sketch. And replace one wire at a time.

Since you have the power LED showing, GND and VCC wires must be good.
You only have to replace the SDA wire and the SCL wire.

Oh, this new Forum is horrible.

David.

This topic was automatically closed after 75 days. New replies are no longer allowed.