8 relays and 8 acs712 sensors and 8 solenoids, delay off time is not working

I guess I spoke too soon.

:frowning:

The code worked with 1 solenoid, but not 8 solenoids.
So there's potential that the previous code could have worked with 1 solenoid as well.

Could it possibly be a power related issue?
The power supply is 24V,21A (max), 500 watts.

I am powering the arduino and relay with 24 to 12v dc converters, and 24 to 5 volt dc converters respectively.

The solenoids are 24V DC, and power ranges from 10-12 watts on each one.
That would mean they have a max. amperage of .5 amps.

Attached is the latest code (I've changed it so I get more data shown on the LCD screen).

#include <serLCD.h>
#include <LiquidCrystal.h>

// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to

const int rs = 8, en = 9, d4 = 4, d5 = 5, d6 = 6, d7 = 7;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

/****************************************************************************/
unsigned long TOn = 1800000; // Adjust delay time in milliseconds to turn relay on/off (60,000 ms = 1 minute)
unsigned long TOff = 900000;

/* Measuring DC Current Using ACS712 */

double mVperAmp = 185; // use 185 for 5A Module, 100 for 20A Module, and 66 for 30A Module
float ACSoffset = 2423.6;

double RawValue1 = 0;
double RawValue2 = 0;
double RawValue3 = 0;
double RawValue4 = 0;
double RawValue5 = 0;
double RawValue6 = 0;
double RawValue7 = 0;
double RawValue8 = 0;

double V1 = 0;
double V2 = 0;
double V3 = 0;
double V4 = 0;
double V5 = 0;
double V6 = 0;
double V7 = 0;
double V8 = 0;

double Amps1 = 0;
double Amps2 = 0;
double Amps3 = 0;
double Amps4 = 0;
double Amps5 = 0;
double Amps6 = 0;
double Amps7 = 0;
double Amps8 = 0;

const int S1 = A0; // Analog input pin that sensor is attached to
const int S2 = A1;
const int S3 = A2;
const int S4 = A3;
const int S5 = A4;
const int S6 = A5;
const int S7 = A6;
const int S8 = A7;

void setup () {
  lcd.begin(16, 2);   // set up the LCD's number of columns and rows:
  lcd.setCursor(0, 0); // set printing position on lcd screen, currently that is column 0, row 0)
  Serial.begin(9600);

  lcd.print("TOn:");
  lcd.print(TOn/60000);
  lcd.print("m");
  lcd.print(",");
  lcd.print("TOff:");
  lcd.print(TOff/60000);
  lcd.print("m");

  DDRA = B11111111; // set PORTA (digital 22-29) to outputs

  int maxnumber = 2; // set cycle count

  for (int count = 0; count < maxnumber;) //Counter will stop counting after certain amount of cycles
  {
    lcd.setCursor(0, 1); //clears lcd before incrementing to next number
    count++;
    lcd.print("Cycle Count:");
    lcd.print(count);

    PORTA = B00000000;
    delay(TOn); //delay between turning on each relay
    PORTA = B11111111;
    delay(TOff); //delay between turning off each relay

    RawValue1 = analogRead(S1);
    RawValue2 = analogRead(S2);
    RawValue3 = analogRead(S3);
    RawValue4 = analogRead(S4);
    RawValue5 = analogRead(S5);
    RawValue6 = analogRead(S6);
    RawValue7 = analogRead(S7);
    RawValue8 = analogRead(S8);

    V1 = (RawValue1 / 1023.0) * 5000; // Gets you mV
    V2 = (RawValue2 / 1023.0) * 5000;
    V3 = (RawValue3 / 1023.0) * 5000;
    V4 = (RawValue4 / 1023.0) * 5000;
    V5 = (RawValue5 / 1023.0) * 5000;
    V6 = (RawValue6 / 1023.0) * 5000;
    V7 = (RawValue7 / 1023.0) * 5000;
    V8 = (RawValue8 / 1023.0) * 5000;

    Amps1 = ((V1 - ACSoffset) / mVperAmp);
    Amps2 = ((V2 - ACSoffset) / mVperAmp);
    Amps3 = ((V3 - ACSoffset) / mVperAmp);
    Amps4 = ((V4 - ACSoffset) / mVperAmp);
    Amps5 = ((V5 - ACSoffset) / mVperAmp);
    Amps6 = ((V6 - ACSoffset) / mVperAmp);
    Amps7 = ((V7 - ACSoffset) / mVperAmp);
    Amps8 = ((V8 - ACSoffset) / mVperAmp);

    Serial.print("Amps1 = "); // shows the voltage measured
    Serial.println(Amps1, 3); // the '3' after voltage allows you to display 3 digits after decimal point

    Serial.print("Amps2 = ");
    Serial.println(Amps2, 3);

    Serial.print("Amps3 = ");
    Serial.println(Amps3, 3);

    Serial.print("Amps4 = ");
    Serial.println(Amps4, 3);

    Serial.print("Amps5 = ");
    Serial.println(Amps5, 3);

    Serial.print("Amps6 = ");
    Serial.println(Amps6, 3);

    Serial.print("Amps7 = ");
    Serial.println(Amps7, 3);

    Serial.print("Amps8 = ");
    Serial.println(Amps8, 3);

    Serial.println("");
  }
  DDRA = B00000000;
}

void loop(void) {
}