My I2C scan returns 3 addresses, neither of which are the PCF.
"
I2C device found at address 0x15
I2C device found at address 0x6B
I2C device found at address 0x7E
"
This is my code relating to I2C:
//in global scope
const int I2C_SDA = 21;
const int I2C_SCL = 33;
//in void setup()
if(Wire.begin(I2C_SDA, I2C_SCL, 100000)){Serial.println("I2C configured");}
i2c_scan();
//the scan function [from [Random Nerd Tutorials](https://randomnerdtutorials.com/esp32-i2c-scanner-arduino/)]
void i2c_scan(){
byte error, address;
int nDevices;
Serial.println("Scanning...");
nDevices = 0;
for(address = 1; address < 127; 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.println(address,HEX);
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");
}
}
Maybe my wiring job is wrong, here is what it looks like
Wiring is simple, all that matters is;
PCF8575 is wired into the ESP32 VCC and GND rail, no resistance
GPIO 33 and 21 are connected directly to PCF8575
other notes: [not relevant to the scanning as far as I know]
LEDs are wired into PCF8575 and ESP32 GND with 220 resistors
when the ESP32 is powered, the LEDs glow dimly
Try swapping the SCL and SDA lines, if that does not work post an annotated schematic showing exactly how you have wired your project and also include what processor (Arduino) you have used. Your picture is missing to much information to properly diagnose your problem.
Thanks!
Processor is right at the top of the post, ESP32S3. Developing in Arduino IDE of course.
Wiring is simple, all that matters is;
PCF8575 is wired into the ESP32 VCC and GND rail, no resistance
GPIO 33 and 21 are connected directly to PCF8575
The LEDs on the circuit do not matter for the time being
Ok, then you need to make second bus. But your scan results devices from default bus, your pin configuration is likely overwritten by some library. Maybe you should post the whole code.
But like @xfpd wrote, first solder your pinheaders, otherwise it's hopeless to use PCF!
I got the pins soldered, I ran the I2C code just by itself, and I tried using a TwoWire object rather than the typical Wire. [is that what you mean by second bus, or is that something else?]
The PCF is still not detected.
Yep, but different in sense that here it would be pretty difficult to add device to bus that already has fundamental devices. Good soldering skills required..
They are connected wrong.
The LEDs must have a common VCC, not a common ground.
Because the PCF8575 has weak source current capabilities (better at sinking current).