I2C Nano chain partial failure

I’m controlling a set of LED panels (strips) with a 12V battery supply. 6 identical Nano clones, each burned with the same bootloader, all work fine on their own. One Nano is the master, the 5 others are daisy-chained A4 to A4 and A5 to A5. Each slave only has to turn one of the LED panels on and off. Testing using only a single standard LED with each Nano. Each Nano has its own 5V buck converter attached to the 12V and ground rails. No loops or power chains other than the 12V bus.

Each contact of an I2C pair (A4 and A5) has its own 4.7K pullup to its 5V supply. The operating sequence begins by lighting all LEDs in a “for” loop. Each slave has its own I2C address, from 0x11 to 0x15.

No matter which slave is called in sequence, only two light – the first and second in order of their control sequence by the master. So each Nano works as it should but only if it’s the first or second in control sequence (not physical sequence). This feels like a power problem, but the quiescent current is only 86mA and each LED only adds 18mA.

Everything I find by searching !2C chains suggests it should work as planned.

The failure appears to be within the I2C chain but I cannot figure out why or how to fix it. Ideas?

Simple code.



#include <Wire.h>

byte targAddr = {0x11, 0x15, 0x13, 0x12, 0x14}; // TEST 3 slaves
int targPar = {900, 300, 500, 700, 450}; // par times per target in sequence
byte LED = 3; // LED pin for Nano etc

void setup()
Wire.begin(); // join i2c bus (address optional for master)
pinMode(LED, OUTPUT);
allTargOn(); // MOVE code WHEN tiggered by GO button (loop)
digitalWrite(LED, 1); // fake STANDBY alert
digitalWrite(LED, 0);

void loop(){}

void allTargOn () {
// turn all targets on (beat the dark or all stay on)
for (byte i = 0; i < 2; i++) {
Wire.beginTransmission(targAddr*); // transmit to device*

  • Wire.write(1); // sends one byte*
  • Wire.endTransmission(); // stop transmitting*
  • delay(100);*
  • }*
    void seqOff() {
  • // turn each target off in programmed sequence (beat the dark)*
  • for (byte i = 0; i < 2; i++) {*
    _ Wire.beginTransmission(targAddr*); // transmit to device*_
    _ delay(targPar*);
    Wire.write(0); // sends one byte*
    * Wire.endTransmission(); // stop transmitting*
    * }
    SLAVE (each address different)
    #include <Wire.h>
    byte pinLed = 3;
    void setup()
    Wire.begin(0x15); // join i2c bus with address*
    * Wire.onReceive(receiveEvent); // register event*
    * Serial.begin(9600); // start serial for output*
    * pinMode(pinLed, OUTPUT);
    void loop()
    void receiveEvent()
    while (Wire.available()) { // loop through all but the last*
    * int x = Wire.read(); // receive byte as an integer*
    // Serial.println(x); // print the integer – troubleshoot
    * digitalWrite(pinLed, x);

The slaves have individual, different addresses?
And, please use code tags for the attached code.

Can you click “Modify” and put the sketch between code tags ? For “Modify” move your mouse cursor over “More” in the right-lower corner.
The code tags is the “< / >” button, the first button in the left-upper corner of the text field.

Can you see all individual slaves when you run an I2C scanner on the master? If not, check wiring/code on the slaves.

Also not good to have that many pull-up resistors. 6x 4k7 in parallel means an effective resistance of just 780 Ω. I2C specifies 1-10k pull-up. A single pair of 4k7 resistors should be enough for your setup. Note that with the current sink ability of Arduino pins (20 mA) this will not be a problem when there are only Arduinos on your I2C bus, but it may be a problem for certain sensors.

It could be a power problem, but hard to say for lack of a schematic. From the description your power supply appears not the problem.

Got it. Thank you all. It was a really stupid oversight, loops cut short. OK now. Will remove the additional pullups. My gratitude.

Thanks for the tip on code tagging. Sorry, this is my first post.

Code tagging is not a tip, rather it is a demand from Forum.

So now, go and read the forum instructions so that you can go back and modify your original post (not re-post it) - using the “More → Modify” option below the right hand corner of your post - to mark up your code as such using the “</>” icon in the posting window. Just highlight each section of code (or output if you need to post that) from the IDE and click the icon.

In fact, the IDE itself has a “copy for forum” link to put these markings on a highlighted block for you so you then just paste it here in a posting window. But even before doing that, don’t forget to use the “Auto-Format” (Ctrl-T) option first to make it easy to read. If you do not post it as “code” it can as you now see, be quite garbled and is always more difficult to read due to the font.

It is inappropriate to attach it as a “.ino” file unless it is clearly too long to include in the post proper. People can usually see the mistakes directly and do not want to have to actually load it in their own IDE. And even that would also assume they are using a PC and have the IDE running on that PC.

Also tidy up your blank space. Do use blank lines, but only single blanks between complete functional blocks.