I2C Connection not registering

I am trying to connect my I2C OLEDs to my Arduino Uno Wifi R2, but the code is not finding an address. The connections are:
5V to VCC
GND to GND
SDA to SDA
SCL to SCL

I tried different breadboards, jumper cables, an Arduino Uno R3 (I changed the SDA and SCL to A4 and A5 respectively), and three separate OLED Displays (one of which was unused until my troubleshooting), yet nothing seems to work. I don't think the OLEDs were damaged because I used one a few days ago and as I said one was unopened until today. Any advice is appreciated.

Pull-ups?

Welcome to the forum.

That seems a tough problem. It should work. You can do more tests, sooner or later the problem should show itself.

Is there something that was the same in every situations ? For example a USB cable, a breadboard or jumper wires ? A breadboard can have bad contacts and jumper wires can be broken. Change everything and replace every wire and select an other location on the breadboard.

Do you have a multimeter ? Can you measure the voltages and the GND connections ?

Start with a Arduino Uno. Does it work ? Can you blink the led ? Do you have another I2C module ? Does that show in the I2C Scanner ? Then try a OLED.

What's that?

The things that make I2C work as expected

Thank you! I've used three different breadboards now, two USB cables, and four sets of jumper wires and it still doesn't work. Unfortunately, I don't have a multimeter, but I was able to blink the onboard LED on my Arduino Uno. Also, this is the only I2C module that I have.

From what to what should the pullup resistors be connected to? I tried connecting a 5.1k resistor to between each of the SCL and SDA pins and 5V and it still can't detect a device.

From A5 to 5V and from A4 to 5V. Do not use other pins for I2C on an Arduino Uno.

I fixed the placement of the resistors, and still nothing. I also replaced the 5.1k resistors and tried using a 10k resistor and it didn't change anything. Not sure if this is useful info, but when I unplug the 5V from VCC when the pullups aren't attached, the scanner just gets stuck on "scanning".

OK time to post a photograph of your setup. Try and make it clear so we can follow the wiring.

If something is connected to the I2C bus and disconnected from the power, then it pulls down the SDA and SCL voltage and the I2C Scanner sketch halts. That is normal.

I think you need to buy a multimeter. It might not solve your problem, but at least you would know the voltages.

The red wires are for power, the gray is for ground, yellow is A4 to SDA, and blue is A5 to SCL.

The red wire goes from 5V to the + strip and then from the + strip to the VCC of the OLED.

The gray wire goes straight from GND on the Arduino to GND for the Arduino.

The yellow wire goes from A4 to the board and then on that same row there is a resistor that connects to another row which has a yellow wire that goes back to the power. Along the row of first yellow wire and the resistor another cable goes across the trench to the OLED's SDA.

The blue wire goes from A5 to the board and then on that same row there is a resistor that connects to another row which has a blue wire that goes back to the power. Along the row of first blue wire and the resistor another cable goes across the trench to the OLED's SCL.

In case this angle is useful.

@gazorpazorp625, your topic has been moved to a more suitable location on the forum.

It is hard to make out your pictures because they are not sufficiently high resolution enough when you zoom in.

However it is a bit of a round the houses layout. Why not wire the pull up resistors to the display side of the board and use one wire to pull it up.

The best bet is to get a digital volt meter, the can be had from a thrift shop for less than $10.

Remove all the wires and start again.

Your breadboard has clearly marked row and column references
Your Uno board has clear labels for the SDA and SCL sockets.
Your wires have clear colours.

5V  red    to f52 j52 VCC
GND black  to f51 j51 GND
SCL blue   to f50 j50 SCL
SDA yellow to f49 j49 SDA

Ignore all the comments about pullups, A4, A5, ...
Get the display working as suggested above.

Yes, it is possible that your jumper wires are broken. But at least you can start with a straightforward wiring plan. Then replace one wire at a time.

David.

Hi,
Please try this tried and true scanner code;

// I2C Scanner
// Written by Nick Gammon
// Date: 20th April 2011

#include <Wire.h>

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

  // Leonardo: wait for serial port to connect
  while (!Serial) 
    {
    }

  Serial.println ();
  Serial.println ("I2C scanner. Scanning ...");
  byte count = 0;
  
  Wire.begin();
  for (byte i = 8; i < 120; i++)
  {
    Wire.beginTransmission (i);
    if (Wire.endTransmission () == 0)
      {
      Serial.print ("Found address: ");
      Serial.print (i, DEC);
      Serial.print (" (0x");
      Serial.print (i, HEX);
      Serial.println (")");
      count++;
      delay (1);  // maybe unneeded?
      } // end of good response
  } // end of for loop
  Serial.println ("Done.");
  Serial.print ("Found ");
  Serial.print (count, DEC);
  Serial.println (" device(s).");
}  // end of setup

void loop() {}

Tom... :smiley: :+1: :coffee: :australia:

There is no point in running the scanner code until you have wired the breadboard correctly.

Actually, it might be worth running the "hd44780.h" diagnostic sketch.
I know that it is written for 16x2 LCDs but it diagnoses your wiring in the process.

David.

No ignore this comment.

David, have you ever looked at an I2C signal in an Arduino without pull ups?
That was rhetorical because of course you haven’t otherwise you wouldn’t say that.

My apologies. I generally ask for a link to the actual display that the user has bought.

This avoids guesswork. i.e. the link shows the pcb view. I can see if pullups are mounted or not. EDIT. Yes, found the link in #1. pullups are mounted.

Instead, I just assumed that the SSD1306 display did have mounted pullups.
The most common modules on Ebay have GND, VCC, SCL, SDA (and have pullups)
A small number have VCC, GND, SCL, SDA (like the OP)

I found this module on https://www.ebay.co.uk/itm/124594352007
which looks very similar to the OP's picture.
and this link shows mounted pullups.

Yes, I2C does not work without pullups.
The Wire.h library enables internal pullups. The scanner sketch will detect I2C devices without external pullups. The I2C "works" but is outside the I2C spec.

Which is why I suggested the hd44780 diagnostic. It tells you whether there are external pullups and checks the wiring too.

I would expect the OP's display to work just fine with four wires as suggested in #16.
If you can decipher the rats nests in #12 and #13, I will give you a medal.
Which is why I suggest simpler wiring.

David. (mellow david)

p.s. that Ebay link does not have a 3.3V regulator chip. You should use VCC=3.3V despite what the Ebay text says.

EDIT. Oops, I missed the link in the Original Post #1.
The pictures of the pcb show that the OP's module is suitable for 3.3V-5V operation and has pullups on the pcb.