Mega 2560 – Digital pin issue

Hello,

I'm having some trouble understanding the behavior of my Funduino Mega 2560 R3.
For this project, I'm trying to drive 19 Solid State Relays with the board.
The relays are from COSMO and the model is KSD210AC8 ( http://www.cosmo-ic.com/object/products/KSD210AC8.pdf)
Each one of them is connected to a digital out pin and to the ground.
16 of them are working perfectly.

So for the tree I'm having trouble with they can be classified in 2 groups:

  • Two of them are reacting almost normally, they are blinking (see code bellow). But some times they skip a blink or two. Or suddenly stop working and stay on or off.
  • One of them does not blink, it stays on for a while, then stay off.

Here is what tried:

  • Tried to change the digital pin for the 3 not working properly.
  • Check the activity of the pin with an oscilloscope.
  • Replace the 3 relays with a new one.
  • Exchange one of the digital out pin with a relay that was working. Problem is still the bad out pin
  • Try to upload a new code on the board where I focus on the bad output pin with only one relay. And the output pin would work fine.

Here is my code:

int Ligne1 = 43;
int Ligne2 = 4;
int Ligne3 = 45;
int Ligne4 = 44;
int Ligne5 = 47;
int Ligne6 = 40;
int Ligne7 = 46;
int Ligne8 = 26;
int Ligne9 = 48;
int Ligne10 = 28;
int Ligne11 = 50;
int Ligne12 = 30;
int Ligne13 = 49;
int Ligne14 = 32;
int Ligne15 = 53;
int Ligne16 = 24;
int Ligne17 = 51;
int Ligne18 = 34;
int Ligne19 = 52;

int Delay1 = 100;

int Lignes[] = { 
  Ligne1, Ligne2, Ligne3, Ligne4, Ligne5, Ligne6, Ligne7, Ligne8, Ligne9, Ligne10, Ligne11, Ligne12, Ligne13, Ligne14, Ligne15, Ligne16, Ligne17, Ligne18, Ligne19
};

int LignesSize = sizeof(Lignes);

void setup()
{
  pinMode(13, OUTPUT);

  for (int i=0; i< LignesSize; i=i+1) {
    pinMode(Lignes[i], OUTPUT);
  }

}

void loop()
{
    
  for (int i=0; i < LignesSize; i=i+1) {
    digitalWrite(Lignes[i], LOW);
  }
  delay(Delay1);

  for (int i=0; i < LignesSize; i=i+1) {
    digitalWrite(Lignes[i], HIGH);
  }
  delay(Delay1);
  
}

Hope I'm on the right forum, thank's for your help.