J have some experience with Arduino, I2C (mainly with RTC).
Now I just bought 3 PCF8574N, checked - each time the same problem: there is no communication via I2C.
To check the Arduino UNO I2C, I connected also the RTC clock next in the chain, and run I2C scan - result: 0x57 and 0x68 found, so I2C works properly, but it does not find any other device (Wire.endTransmission() returns 2). RTC is connected to the same GND, power, with 100nF between Vcc and GND, and I2C connected next to PCF8574N.
PCF8547 connection (1 is left of "U" mark in top, 8 down left, 16 right up):
1, 2, 3 (A0, A1, A2) - GND,
8 (GND) - GND,
13 (INT) - 10k to Vcc
14 (SCL) - Arduino SCL and 10k to Vcc
15 (SDA) - Arduino SDA and 10k to Vcc
16 (Vcc) - Arduino UNO 5V
4-7, 9-12 (P0 - P7) not connected.
I also tried without resistors (INT not connected), and with 1k pull-up - the same problem.
What am I doing wrong?
Did you numbering go astray or did you really apply 5V to pin 15?
Sorry, obvioulsy Vcc to 16. Original post edited. Thanks.
A schematic is better than a test description, for example:
From: LED WITH PCF8574 – ARDUINO PROJECTS
If the RTC is also connected then you do not need the additional pullup resistors.
The decoupling capacitor is missing from this picture.
PCF8574N is a slave device, so you just need to make sure you are sending the correct address write read sequence.
I am presuming you just have those hardwired individually.
You can pick up a cheap logic analyser off ebay amazon or most any place which will help. Just search for 8CH 24MHz Logic Analyser.
All address inputs are connected to GND, so address should be 0x40, 0x41. But I can not find any devices (except RTC), on any address.
Schematic:
Hi, @danielpl
Welcome to the forum.
Where from?
Can you please post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.
Not a Fritzy image.
Thanks.. Tom..
You will need to provide a copy of the code you are using. Maybe it could just be a slight mistake you have made.
Schematic above.
#include "Wire.h"
void setup()
{
Serial.begin(250000);
}
void loop()
{
Wire.begin();
delay(100);
uint8_t uFound = 0;
Serial.print("\t\t0x00\t0x01\t0x02\t0x03\t0x04\t0x05\t0x06\t0x07\t0x08\t0x09\t0x0A\t0x0B\t0x0C\t0x0D\t0x0E\t0x0F\n");
for(uint8_t _address = 0; _address < 128; _address++)
{
if( (_address & 0x0F) == 0x00)
{
Serial.println();
Serial.print("0x");
if(_address == 0)
Serial.print("0");
Serial.print(_address & 0xF0 ,HEX);
Serial.print("\t\t");
}
uint8_t uRes;
Wire.beginTransmission(_address);
uRes = Wire.endTransmission();
/* 0: success.
1: data too long to fit in transmit buffer.
2: received NACK on transmit of address.
3: received NACK on transmit of data.
4: other error.
5: timeout
*/
if(uRes == 0)
{
Serial.print("*OK*\t");
uFound++;
}
else
{
Serial.print(uRes); Serial.print("\t");
}
}
Wire.end();
Serial.println();
Serial.print("FOUND => ");
Serial.println(uFound);
delay(1000);
}
OUTPUT:
Real connections (UNO on the right, it didn't fit in the photo,
I think code is OK - RTC is found properly.
If someone uses my 'scanner' it will be a pleasure for me
And I added sth about me in profile.
The decoupling capacitor should be much closer to the PCF8574.
Also the pullup resistors are not needed since the DS3231 has these already.
Sorry but I cannot see where you are addressing the PCF8574
@6v6gt - OK, now capacitor is as close as possible, no pull-up resistors - unfortunately, still the same.
@latedev - in fact I'm not addressing PCF8574. I tried it before, but it didn't work, so I was not sure if I'm using proper address, so I decide to scan all addresses.
Now I'm checking what I2C addresses are responding (from range 0x00 - 0x7F). And only are 0x57 and 0x68 - it is RTC EEPROM and RTC DS323. No other I2C found.
PCF8574 is a passive device so you need to write 0x40 then read from ox41, otherwise you will not see anything.
When you read from the RTC, you are doing the same thing on a different address.
Is the capacitor connected to ground? I don't see a wire connecting the 2 ground bus lines together.
Hi,
What if you remove the RTC and install the pullups and scan?
Have you tried Nick Gammon's I2C scanner?
Tom..
Incorrect. Arduino system uses 7-bit i2c address. The 8th bit, the read/write control bit, is taken care of by the i2c library.
Thanks, Amended just wrote them the wrong way around.
Where did you get the PCF8574 ?
Here are 5 chips I got from Aliexpress. The markings look good but look at the variety of packages.
The undersides are even worse.
You completely missed my point.
@PaulRB yes, it is. Both gnd lines are connected.
@6v6gt from allegro.pl (Polish auction site), I think sb is buy it in bulk (maybe from aliexpress) and sell locally, so probably it is the same as from ali. Seller has 99,8% positive, but still it is possible that all 3 PCF are broken.
I checked bottom - there is nothig