Hello, I want to use an i2c oled screen through the GPIO32 and GPIO33 ports of the esp32 and leave the GPIO21 and GPIO22 ports free for other i2c connections, but I can't get the screen to show an image, this is my code:
I'm not using any hardware, only the esp32, I want the esp32 to have two independent i2c connections, one for the screen and the other for an i2c scanner, can you tell me why not use a single i2c bus? The answer is that if I connect the screen to the same scanner bus creates conflicts for me that's why I want 2 i2c buses
Well, up to now I have not been able to get the screen to show an image working on the 2 buses, working on a single bus, it does not matter in which ports it manages to give an image
What do you mean by that? Please post a link to the spec of this scanner. Please explain why this scanner needs to be on a different bus to the screen.
No, we cannot answer that. Can you tell us why you believe you cannot use a single bus?
What conflicts? The most common conflict with i²c bus is using multiple i²c devices that have the same address on the bus. Often, this can be overcome by changing the addresses so that they are different. But not all devices allow this to be done.
Please post your complete test code and a schematic showing how the circuit is connected in this situation.
With the screen, you are using the standard "Wire" object. But later you create 2 i2c objects, one of which may interfere with the standard Wire object.
Can you not use the standard "Wire1" object for your second i2c port, instead of creating the 2 new i2c ports?
I2C Bus is a two-wire communication network that allows multiple devices to be connected in parallel; however, the condition is that 7-bit slaveAddress of a device must be different from that of other devices. Please,
1. Connect your OLED Display Unit alone with ESP32 Board and run the "Scanner Program/Sketch" of Step-5; note down the reported slaveAddress and post it.
2. Disconnect the OLED from I2C Bus.
3. Connect your Scanner Device alone with ESP32 Board and run the "Scanner Program/sketch' of Step-5; note down the reported slaveAddress and post it.
4. Check that the addresses of the OKED and Scanner devices are different and then connect both devices with the I2C Bus of ESP32 Board. Run the "Scanner Program/Sketch" of Step-5 and check that the slaveAddress of the devices are reported correctly.
5. Scanner Program/Sketch
#include<Wire.h>
byte busStatus;
void setup()
{
Serial.begin(9600);
Wire.begin(21, 22); //SDA, SCK
for (int i2cAddress = 0x00; i2cAddress < 0x80; i2cAddress++)
{
Wire.beginTransmission(i2cAddress);
busStatus = Wire.endTransmission();
if (busStatus == 0x00)
{
Serial.print("I2C Device found at address: 0x");
Serial.println(i2cAddress, HEX);
}
else
{
Serial.print("I2C Device not found at address: 0x");
Serial.println(i2cAddress, HEX);
}
}
}
void loop()
{
}
Output with my BMP280
I2C Device not found at address: 0x75
I2C Device found at address: 0x76
I2C Device not found at address: 0x77
Thanks for your support guys, I already managed to make my project work, I exchanged the connection order, the oled screen to the main i2c of the esp32 ports 21 and 22 and the i2c scanner to ports 32 and 33 and it started to work, I don't understand why the screen oled does not connect with wire1 layers its default library takes the main wire connection of esp32 but exchanging it worked