My OLED display I2c is not turning on

Hello community, I have been dealing with an issue with my OLED display. I bought yesterday but I havent found the way of waking it up. The libraries I have used are from Adafruit and getting examples from it too. Im very concern cuz I nee it for a school project approaching. Dont hesitate to leave a response on the chat.

Hi @jeff_stv I take it you blew right past this:

Please read it. End to end.
When you've done that, post your code, in code tags. It does look like you possibly have the display wired correctly, so the problem could well be the code you didn't post.
Thank you.

Run a I2C Scanner sketch to find its I2C address.
If a I2C Scanner sketch can not find it, then the display is broken.

Do you have a official Arduino Uno board :+1:

The display is however too cheap. The soldering is bad:

1 Like
  • Try the example sketch in the library.

In the Arduino IDE, use Ctrl T or CMD T to format your code then copy the complete sketch.
Use the < CODE / > icon from the ‘posting menu’ to attach the copied sketch.

Well, I soldered it myself

Where can i find that sketch?

#include <Wire.h>

void setup() {
  Wire.begin();

  Serial.begin(9600);
  while (!Serial)
    ;
  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);
}
  • What was printed on the Serial Monitor ?

  • A wire might be bad, try other wires to see if there is a difference.

EDIT

Try this sketch:

//********************************************^************************************************
//  OLED_Counter.ino
//
//  LarryD
//  Version   YY/MM/DD     Comments
//  =======   ========     ===============================================
//  1.00      22/04/21     Running code
//
//

//https://lastminuteengineers.com/oled-display-arduino-tutorial/

#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


//SSD1306 display
//size 1 is 5X7   pixels therefore, 6X8   to acount for spacing,  21 characters per line
//size 2 is 10X14 pixels therefore, 11X15 to account for spacing, 10 characters per line
//size 4 is 20X28 pixels therefore, 21X29 to account for spacing,  5 characters per line

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

unsigned long counter     = 0;


//                                      s e t u p ( )
//********************************************^************************************************
//
void setup()
{
  Serial.begin(115200);

  if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C))
  {
    Serial.println(F("SSD1306 allocation failed"));
    for (;;);
  }

  display.clearDisplay();
  
  //display.setTextColor(textColor, backgroundColor);
  display.setTextColor(WHITE, BLACK);

} //END of   setup()


//                                       l o o p ( )
//********************************************^************************************************
//
void loop()
{
  //clear SSD1306 display
  display.clearDisplay();

  //************************************
  display.setTextSize(1);
  display.setCursor(0, 0);

  //Size 1 line is  000000000111111111122
  //21 characters   123456789012345678901
  //Example         ..OLED Counter Demo..
  display.print("  OLED Counter Demo  ");

  //************************************
  //display.setCursor(0,9);
  //Size 1 line is  000000000111111111122
  //21 characters   123456789012345678901
  //display.print ("ABCDEFGHIJKLMNOPQRSTU");

  //************************************
  display.setTextSize(2);
  //2 = current text size, 16 is the pixel row we want to postion to
  display.setCursor(centering(counter, 2), 16);

  //Size 2 line     0000000001
  //10 characters   1234567890
  //Example           100000
  display.print(counter++);

  //************************************
  //degree symbol
  //using CP437 ASCII
  //display.cp437(true);
  //display.write(248);

  //************************************
  //  display.setTextSize(2);
  //  display.setCursor(0,16);
  //  display.setCursor(0,32);
  //  //temperature
  //  //Size 2 line is  0000000001
  //  //10 characters   1234567890
  //  //Example         ABCDEFGHIJ
  //  display.print("ABCDEFGHIJ");

  //************************************
  display.display();

  delay(100);

} //END of   loop()


//                                 c o u n t D i g i t s ( )
//********************************************^************************************************
//return the number of digits in a number
byte countDigits(int num)
{
  byte count = 0;
  
  while (num)
  {
    num = num / 10;
    count++;
  }

  return count;

} //END of   countDigits()


//                                    g e t D i g i t ( )
//********************************************^************************************************
//return the selected digit
byte getDigit(unsigned int number, int digit)
{
  for (int i = 0; i < digit - 1; i++)
  {
    number = number / 10;
  }

  return number % 10;

} //END of   getDigit()


//                                   c e n t e r i n g ( )
//********************************************^************************************************
//return the position to print the MSD
byte centering(unsigned long number, byte textSize)
{
  byte count = 0;
  byte charaterCellWidth = 0;

  //a basic character is 5X7, we must scale for this text size
  charaterCellWidth = (5 * textSize) + 1;

  //number of digits in our number
  while (number)
  {
    number = number / 10;
    count++;
  }

  //center location where the MSD character will be displayed
  return (SCREEN_WIDTH / 2 - (charaterCellWidth * count / 2));

} //END of   centering()

It might be cold solder joint, resolder all the pins.
BTW black wire is always used for GND, this way might be confusing.

  • There is a standard where Black is positive battery and White is negative.
    :shushing_face:

  • However, I am with you, I like Black as GND.
    :sunglasses:

NASA standard ?

Wish I could rewind time and never saw this!

RV industry in the US uses black for + and white for -.
NASA is red black

Never seen that, what is RV?

Recreational Vehicles.

I see, double standards are always welcome :smiley:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.