I have been trying to use this library with esp32 but no luck so far.. All I want to do is toggle some relays connected on the extender IC but while running the IC doesn’t seem to respond..
The I2C scanner shows the address at 0x20.. and my SDA, SCL pins are connected to 21 and 22 respectively.. Not sure, what I am doing wrong.. code below..
#include "Arduino.h" #include "PCF8575.h"
// Set i2c address PCF8575 pcf8575(0x20);
void setup() { Serial.begin(115200); // Set pinMode to OUTPUT for(int i=0;i<8;i++) { pcf8575.pinMode(i, OUTPUT); } pcf8575.begin(); }
Hi Mark,
I retest the library again, and It’s working ok.
Can you do an i2c scanner and paste the result here?
#include <Wire.h>
void setup()
{
Wire.begin();
Serial.begin(9600);
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("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");
delay(5000); // wait 5 seconds for next scan
}
you must have a this result
Scanning...
I2C device found at address 0x20 !
done
Scanning...
I2C device found at address 0x20 !
done
Scanning...
I2C device found at address 0x20 !
done
They both detected the I2C device at the default address of 0x20 but even the basic blink led of this library does not work.
I have tried switching the connection of the P0 on the PCF from anode to cathode but it does not work also.
If the anode is connected to P0 and the cathode is to ground, the LED lights up but it does not blink.
If the cathode is connected to P0 and the anode is to 3.3V, the LED does not light up.
I tried connecting a normal I2C LCD to the SCL/SDA pins and it was successful.
Not sure what is missing but maybe some compatibility problem with my ESP32.
The original poster of this post has the same issue. I guess I am encountering the same.
Hi mark,
I replicate the test with an esp32 dev kit v1 and a pcf8575 with 16 led, and It’s work without a problem, so if I can’t replicate your problem, I can only do some supposition to try to help.
Hey,
Let me try with a devkit, may I know if the wiring you are saying is the link above?
Cathode is connected to the P0-P17 of the PCF8575 and the anode is connected to the Arduino pins.
Which is quite different from the GitHub page image
I am using the module type and not the IC Type so there is no other external connection like a resistor because your YouTube video has a resistor connected to some pins.
Maintaining a repository (or site or forum) is a lot like tending to a garden - it requires constant care and attention to keep it thriving. If you're a skilled gardener (or coder!) and want to help keep our repository blooming, we'd love to have you on board! We're also looking for talented writers and forum moderators to help us grow our community. Interested in joining our team? Don't hesitate to reach out and let us know how you can contribute!
Are you a fan of electronics or programming? Share your knowledge with others, write a simple tutorial or how to make a great project Contact me: share_your_ideas@mischianti.org
The content displayed on this website is protected under a CC BY-NC-ND license. Visitors are prohibited from using, redistributing, or altering any content from this website for commercial purposes, including generating revenue through advertising. Any unauthorized use is a violation of the license terms and legal action may be taken against individuals or entities found to be in violation.
You must also provide the link to the source.
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional
Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional
Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.