PCF8575 Arduino/ESP32

hello experts,
shortage of pins
going to use PCF8575
using PCF8575_library

trying from last 2 days for just simple code
getting fustraited
can not understand, whats happened

my code

#include "Arduino.h"
#include "PCF8575.h"

PCF8575 pcf8575(0x20);

void setup() {
  Serial.begin(9600);
  Serial.println("PCF8575");

  pcf8575.begin();
  pcf8575.pinMode(P6, OUTPUT);  
}

void loop() {
  Serial.println("HIGH");
  pcf8575.digitalWrite(P6, HIGH);
  delay(1000);
  Serial.println("LOW");
  pcf8575.digitalWrite(P6, LOW);
  delay(1000);
}

please help
TIA

Help us help.

Post the simple code that doesn't work.

Draw and post, or find and copy here, the schematic showing how you have hooked up the PCF8575.

Are you using a library? Did that come with examples?

You may also get some mileage out of this

beta version, simulated PCF8575

which uses the wokwi simulator.

a7

not understand what u says
its for 8574, which i used back
i am trying for 8575, not getting success
i posted what i wrote
library given in link

@sachenwadekar
The PCF8575 can only sink large currents.

So you need to connect your LED Cathode to the PCF8575 pin, connect the LED Anode to a 330 ohm resistor and connect the other end of the resistor o 5V
Then it will work

Run the I2C scanner to determine if everything is operating correctly. If you do not get a 0X20 as a valid port it will never work. Change that to the port number returned by the scanner. I have some boards that look like the one you have, they do NOT have pull up resistors. They need to be there, something n the 4.7K range should work fine.

tried, not getting OK.
where is the GND ?

GND is the brown wire that you show in the picture in post #1
Vin is connected to 5V

you are correct.
Serial monitor : No I2C devices found
tried many times, on ESP32 and Arduino Nano also

checked I2C address as below
RTC module
I2C device found at address 0x50 !
I2C device found at address 0x68 !

PCF8574
I2C device found at address 0x20 !

PCF8575
No I2C devices found

may be faulty item or anything else ?

that brown wire is for module, i think so
what is GND for LED ? not needed ?

i am sorry, but will you please make complete sketch
TIA

1 Like

its done....

the board which i brought, was un-soldered
i soldered it
reviewed again
some pins was partially soldered
repaired it

and
IT's DONE
Thanks to ALL....

thanx jim-p....

will u please tell me the same connection for btns ?

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