PCF8575 - Chain - No Communication

Moving thread here as it seems more appropriate:
PCF8575 - Chain - No Communication · Issue #46 · RobTillaart/PCF8575

Likely user error....

Goal: Build program where I can control 4 x 16 channel relay boards. Starting with two

Connected to USB Laptop -> I can push program but no response from board

I just have two connections for power and two for data

it was mentioned

Do you have the address pins of the PCF8575 connected to force the address used?

If you connect four, everyone should have its own unique address. (but that is step 2)

Do you have an I2C scanner to see if the address is correct?

Not sure "connect four" .. to set address. I was just using dip switches per manual / table

I have googled around and lots of older videos on this and that is what I followed but maybe there is a new means to set board ID, scan board, connect then define in code as part of array.

Thanks

Please post a link to the relay boards that you are using

Does the I2C scanner sketch find each of the boards on a unique address ?

What sketch are you using to

"..Does the I2C scanner sketch find each of the boards on a unique address ? " -> No.

sketch using. Baseline of just first board which is "20"

//
//    FILE: PCF8575_isConnected.ino
//  AUTHOR: Rob Tillaart
// PURPOSE: demo device detection
//     URL: https://github.com/RobTillaart/PCF8575


#include "PCF8575.h"

//  adjust addresses if needed
PCF8575 PCF(0x20);


void setup()
{
  //  while(!Serial);  //  uncomment when needed
  Serial.begin(115200);
  Serial.println(__FILE__);
  Serial.print("PCF8575_LIB_VERSION:\t");
  Serial.println(PCF8575_LIB_VERSION);
  Serial.println();

  Wire.begin();

  if (!PCF.begin())
  {
    Serial.println("could not initialize...");
  }
  if (!PCF.isConnected())
  {
    Serial.println("=> not connected");
  }
  else
  {
    Serial.println("=> connected!!");
  }
}


void loop()
{
}


//  -- END OF FILE --


I set baud on serial monitor to 115200 (also tried update sketch and monitor at lower 9600 without change):

Output on runs

17:33:12.011 -> could not initialize...
17:33:12.011 -> => not connected
09:43:04.167 -> could not initialize...
09:43:04.167 -> => not connected
09:44:25.920 -> could not initialize...
09:44:25.920 -> => not connected

In that case do not expect any sketch to work with them. How exactly are you setting the address of the boards ?

See diagram. Set with dip swtiches per documentation I found "all on" =20

And per post in GitHub: I also connected Ground on Arduinio to Ground post on board

So single board, Address 20,

still getting ok when pusing sketch but serial monitor response:

17:33:12.011 -> => not connected
09:43:04.167 -> could not initialize...
09:43:04.167 -> => not connected
09:44:25.920 -> could not initialize...
09:44:25.920 -> => not connected

I saw some youtubes on code that did a cycle scan for I2C connected devices ever 10 seconds but did not see any code examples if someone has link to that to do continual scan vs upload sketch to test connected device.

This is video why I purchased this board:

I don't see a common ground connection between your R4 and either I2C relay board. You should make sure you have this and then re-run your I2C scanner code.

I moved to have all three connections direct to middle "black" pin connector.

Sorry hand in way.. trying to capture that 5vDC was being supplied input to green posts

Trying to think of another means to get baseline that serial monitor is working. "not connected" is response... that I assume would be same return serial communication as if board connected and gave ??? some response.

You mean SCL, SDA & GND right? That looks about right from a google search of similar looking boards. This is close-up from one image:

What power source are you using to power the relay board? Images I have seen suggest either a 3v3 or 5v power supply on that screw connector.

I assume that power for the relay coils comes from this connector too as I don't see any other connector.

With just +V, GND, SCL & SDA connected, what gets detected when you run the I2C scanner sketch?

Ok.

To get baseline I narrowed it down to as simple as I can get it. Even tried both boards to see maybe one was bad

Power 5v from Arduinio, GRound From Arduino, SDA and SCL from arduino. Four wires: KISS.

DIP switch SHOULD be "21" (1=on, 2=on, 3=off)

Baud set on board and serial Monitor to 9600 (also tried 115200)

Not connected

09:43:04.167 -> => not connected

09:44:25.920 -> could not initialize...

09:44:25.920 -> => not connected

Ln 11, Col 17

Arduino UNO R4 WiFi

on COM6

To make it even simpler, run the I2C scanner sketch to see if the board is detected. This is the first step. If this does not detect your board, then your code will not work.

See reply #4

I point of clarification: "i2c scanner" -> the sketchbook i posted is what I consider to be scanner.. but if you have a different one..

As for question about how "set the board address" -> DIP switches

I googled around on board and found table:

16 Channel I2C Relay Electromagnetic 3.3V 5.0V Smart Home Assistant ESP32 ESP826 Chip is pcf8575. Electronic Nuts Supplier of PWM AC Dimmer for Arduino, Raspberry PI, Microcontroller, MCU

No, that sketch only tests the connection at address 0x20 (unless you change it); it's not a scanner.
You can find the correct sketch in the IDE examples.

So i looked through the basic sketches

The closest one to my review was serial but it was echo input/output

I loaded library from vendor:

which outputs

18:15:42.471 -> HLT

So if you have a more generic but debug sketch to scan serial ports, I am glad to learn. This is my first use of Ardunio and IOT.. Not new to concepts of serial /baud etc.. but this is all new so not much of baseline, hense post is a bit open ended.

It's an example of the Wire library, perhaps it's no longer there.
Here's a link

It's an example for the Wire library included with the AVR boards package. There are no example sketches for the Wire library in the Renesas_UNO boards package used for the UNO R4.

This I2C scanner works with the Uno R4 boards

// --------------------------------------
// i2c_scanner
//
// Version 1
//    This program (or code that looks like it)
//    can be found in many places.
//    For example on the Arduino.cc forum.
//    The original author is not know.
// Version 2, Juni 2012, Using Arduino 1.0.1
//     Adapted to be as simple as possible by Arduino.cc user Krodal
// Version 3, Feb 26  2013
//    V3 by louarnold
// Version 4, March 3, 2013, Using Arduino 1.0.3
//    by Arduino.cc user Krodal.
//    Changes by louarnold removed.
//    Scanning addresses changed from 0...127 to 1...119,
//    according to the i2c scanner by Nick Gammon
//    http://www.gammon.com.au/forum/?id=10896
// Version 5, March 28, 2013
//    As version 4, but address scans now to 127.
//    A sensor seems to use address 120.
//
//
// This sketch tests the standard 7-bit addresses
// Devices with higher bit address might not be seen properly.
//

#include <Wire.h>


void setup()
{
  Wire.begin();
  Serial.begin(115200);
  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("Unknown 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
}

Whoot

18:15:42.471 -> HLT
06:32:48.586 -> Scanning...
06:32:48.586 -> I2C device found at address 0x20  !
06:32:48.586 -> done
06:32:48.586 -> 
06:32:53.619 -> Scanning...
06:32:53.619 -> I2C device found at address 0x20  !
06:32:53.619 -> done

Now what is curious , and I have thread open with boad vendor is why there example sketches do not return state connected?

There is a world of difference between an I2C device being present on an address and actually connecting to that address but at least you know that the device exists

so to root cause.. If I power via USB the arduino. And only from that connect the four cables to the 16 channel relay boards, then it communicates. But if I power the boards with DC power direct.. and the Arduinio the same source also.. it fails. ( it power on all , but the board 16 channel boards "click" once then go silent, almost like not enough power or bad signal)

Concern I have is that 4+ boards hanging off that 5v power connector + other misc devices will be too much load for the ardunio.

Questions

  1. Is there a means to check output / load off that 5v pin?
  2. Is there a means to check on board total load that its within safe range?