Sequencing 6 relays and an SSR

hi guys,

searched for an hour or so and couldn’t find anything helpful threads so here goes, feel free to berate me if you think I should have been able to find a helpful thread. I have a setup that I’m using to sequence 6 high pressure solenoid valves, and a pressure washer. Here’s a link to the relay board I’m using they are controlling peter paul series 20 model H22 high pressure solenoid valves. And I’m using a Crydom HAC60D150 SSR to control a Northern Tools Northstar 2000psi 120V single phase powered pressure washer. I’m fairly certain its not the code, It works perfectly before I connect 120 volts to that side of the circuit, but i’ll include the code here.

//constants dont change
  const int valveOPENtime = 1500;  //valve hold open time in milliseconds
  const int offdebouncedelay = 400;
  const int ondebouncedelay = 5000;
  const int presswashdelay = 2000;
  
  //output pins
  const int pressurewasher = 8;  //pressure washer is connected to pin 8
  
  //input pins
  const int Sbutton = 9;  //start sequence button is connected to pin 9
  const int Cbutton = 10;  //cancel button is connected to pin 10
  const int PWbutton = 11;  //pressure washer button is connected to pin 11

  //variables will/can change:
  int i = 2; //counter for loop
  int Sbuttonstate = LOW;  //variable for reading button state
  int PWbuttonstate = LOW; 
  unsigned long beginloop = 0;
  unsigned long PWdelay = 0;
  unsigned long debounce = 0;

void setup() {  

  // put your setup code here, to run once:
  pinMode(2,OUTPUT); //valve 1 is on pin 2
  pinMode(3,OUTPUT); //valve 2 is on pin 3
  pinMode(4,OUTPUT); //valve 3 is on pin 4
  pinMode(5,OUTPUT); //valve 4 is on pin 5
  pinMode(6,OUTPUT); //valve 5 is on pin 6
  pinMode(7,OUTPUT); //valve 6 is on pin 7
  pinMode(pressurewasher,OUTPUT);  //pressure washer is on pin 8

  //set input pins as input
  pinMode(Sbutton,INPUT);
  pinMode(Cbutton,INPUT);
  pinMode(PWbutton,INPUT);

  //begin the loop with all relays off (relays are reversed logic except pressurewasher
  digitalWrite(2,HIGH);
  digitalWrite(3,HIGH);
  digitalWrite(4,HIGH);
  digitalWrite(5,HIGH);
  digitalWrite(6,HIGH);
  digitalWrite(7,HIGH);
  digitalWrite(pressurewasher,LOW);
  
}

void loop(){


//    turning on/off pressure washer with button    

    if(digitalRead(PWbutton) == HIGH && PWbuttonstate == HIGH && (millis() - debounce > ondebouncedelay)){
      digitalWrite(pressurewasher,LOW);
      PWbuttonstate = LOW;
      debounce = millis();
      PWdelay = millis();
    }
    else if (digitalRead(PWbutton) == HIGH && PWbuttonstate == LOW && (millis() - debounce > offdebouncedelay)){
      digitalWrite(pressurewasher,HIGH);
      PWbuttonstate = HIGH;
      debounce = millis();
      //PWdelay = millis();
    }
    

//   start button and cancel button operations    

    //read start button and change state of placeholder
    if (digitalRead(Sbutton) == HIGH){
        Sbuttonstate = HIGH;
         
        //while loop for HIGH start button state
        while(Sbuttonstate == HIGH){          

              //turn on pressure washer if not already on
              if(digitalRead(pressurewasher) == LOW){  
                  digitalWrite(pressurewasher,HIGH);
                  PWbuttonstate = HIGH;
                  PWdelay = millis();                           
              }

              //check for proper pressure washer delay then begin opening valves in sequence
              if(millis() - PWdelay > presswashdelay){
                  beginloop = millis();    
                  while(i<=7){    
                  digitalWrite(i,LOW);    
                
                      if(millis() - beginloop > valveOPENtime){
                          
                          digitalWrite(i,HIGH);
                          delay(1000);
                          i++;
                          beginloop = millis();
                      }          
                      if(digitalRead(Cbutton) == HIGH){
                          digitalWrite(i,HIGH);
                          i = 2;
                          Sbuttonstate = LOW;
                          break;
                      }              
                  }  //end of while loop
            
                Sbuttonstate = LOW;
            
              }
        i=2;
        
        }
    }      
          
    }  // end of void loop()

I’m not using the arduino Uno board, I have the ATmega328 chip mounted on a breadboard and am powering through a 5V breadboard mounted power supply you can see in the attached picture. the terminal blocks in the picture are connected directly to a 120V wall outlet, as you can see from the attached picture I tapped power from those terminal blocks for all of the relays including the SSR.
The issue I’m having with it is that the valves don’t sequence all the way through, half of the time it seems the code stops running and it is stuck with the third valve open, occasionally it will cycle all the way through to the 5th valve. also the solid state relay does not turn on the pressure washer. I have everything temporarily mounted on a piece of plywood to keep it from shorting out while i’m testing it.
I thought that maybe a delay between turning off one valve and turning on the next would alleviate the valves not cycling (that’s why the delay function is in the code) but that had really no effect at all. any thoughts guys and gals?

Don't tell us you have a smoke alarm in there and the 9 volt battery is powering it!

Paul

Paul_KD7HB:
Don't tell us you have a smoke alarm in there and the 9 volt battery is powering it!

Paul

I've read this reply a dozen times and i'm not seeing the humor or help in it, there is no smoke alarm anywhere in the circuit, and the 9 volt battery only powers the chip and the signal side of the relays. Maybe it would help if I said i'm new to arduino and electronics in general? pretty much a newb by any definition of the word.

philipcrost:
I've read this reply a dozen times and i'm not seeing the humor or help in it, there is no smoke alarm anywhere in the circuit, and the 9 volt battery only powers the chip and the signal side of the relays. Maybe it would help if I said i'm new to arduino and electronics in general? pretty much a newb by any definition of the word.

The humor is there are hundreds of forum posters with serious problems all caused by powering stuff with such 9 volt batteries. Even wondering why the robot stopped working after a few minutes.

Have you actually monitored the voltage on the 9 volt battery during testing of your project?

Paul

Whatever else is going on, I'd move the orange Arduino wire well away from the AC terminals of the SSR.

ssr wire.PNG

ssr wire.PNG

I haven't unraveled your code to see if all 6 relays are energised at the same time, but those Songle coils draw 70mA each so that's over 400mA if they are all energised at once

According to your pic (enlarged section shown), you still have the JD-Vcc jumper in place and so all the coil current is from the Arduino. Apart from that, doing it that way bypasses the opto-isolation, which with all that mains around is perhaps not a good idea. I'd rewire like this, with external 5V supply with enough current for however many coils are energised at once:

D0upWXs_d.jpg

Enlarged view of jumper:

jd-vcc jumper.GIF

Here's your pic for others to view.

Paul_KD7HB:
The humor is ...

I'm not seeing the humor[sic] either.

jd-vcc jumper.GIF

goodSamaritan, thanks man, I'll give that a shot. there is only a single coil energized at once plus the SSR to power the pressure washer, the machine its connected to uses a pressure washer and the six valves to clean any possible metal shavings out of a new hydraulic filter head. it only energizes one coil at a time in order to have one valve open at a time and utilize all the pressure available. basically it kicks on the pressure washer and waits a few seconds, then turns on the six valves one at a time for a few seconds each.

i wasn't able to find any data sheet on the relay board or much information at all. just messing around with the circuit at my desk i put the jumper there and everything worked fine, so I left it.

If you take the jumper off, you need two 5V supplies to the relay board: one from the Arduino to control the board (which is done by an invisible led inside an opto-coupler) and one to energise the coil/s. The downside of the extra supply is offset by the safety of the isolation.

Jumper on, one supply, but no isolation

But at 70mA each, you should have no trouble energising only one coil from the Arduino.

This link explains how those boards work, with a nice schematic of the innards about 2/3 down the page.

any ideas on why the solid state relay wouldn't be turning on the pressure washer?

philipcrost:
any ideas on why the solid state relay wouldn't be turning on the pressure washer?

Starting current may be too great.

Paul

Does the pilot LED on the SSR come on? Whats the motor HP? A single phase, capacitor start motor might draw 7 to 10 times the full load current starting, measure the AC voltage at the motor leads while trying to start, you may need a big relay (contactor) instead of the SSR.

FredScuttle:
Does the pilot LED on the SSR come on? Whats the motor HP? A single phase, capacitor start motor might draw 7 to 10 times the full load current starting, measure the AC voltage at the motor leads while trying to start, you may need a big relay (contactor) instead of the SSR.

its a leeson motor 115Vac single phase, 60Hz, 2HP, 3450rpm, FLA: 16.8 Amps. looked for an SSR specifically to size it for in rush current. so the SSR in the picture handles a 150Amp max load current according to the data sheet for it. just read a little more of the data sheet and looks like the max current on the input side is 15mA, thats below what the ATmega328 will put out isn't it? maybe a resistor on the ATmega output pin will help? I tested the relay out on a 60 Watt incandescent bulb controlled through an arduino and it worked fine, so I know it's not a bad relay.

philipcrost:
its a leeson motor 115Vac single phase, 60Hz, 2HP, 3450rpm, FLA: 16.8 Amps. looked for an SSR specifically to size it for in rush current. so the SSR in the picture handles a 150Amp max load current according to the data sheet for it. just read a little more of the data sheet and looks like the max current on the input side is 15mA, thats below what the ATmega328 will put out isn't it? maybe a resistor on the ATmega output pin will help? I tested the relay out on a 60 Watt incandescent bulb controlled through an arduino and it worked fine, so I know it's not a bad relay.

That is MAX input current. There is already a resistor inside the SSR to limit current to the LED. So, any current that lights the LED is sufficient.

Do you have a good heat sink for the SSR? They do get hot when carrying lots of current.

Paul

Paul_KD7HB:
That is MAX input current. There is already a resistor inside the SSR to limit current to the LED. So, any current that lights the LED is sufficient.

Do you have a good heat sink for the SSR? They do get hot when carrying lots of current.

Paul

Paul, no heatsink yet, I'm still trying to test functionality. the relay wont even try to turn on the motor. I do have the heatsink in a saved shopping cart from digikey so the next round of purchases it will be ordered though.

So If the LED is lighting up than it should be sending power to the motor right? there is a GFCI inline on the power cord for the pressure washer motor, could that have anything to do with it?

philipcrost:
Paul, no heatsink yet, I'm still trying to test functionality. the relay wont even try to turn on the motor. I do have the heatsink in a saved shopping cart from digikey so the next round of purchases it will be ordered though.

So If the LED is lighting up than it should be sending power to the motor right? there is a GFCI inline on the power cord for the pressure washer motor, could that have anything to do with it?

The power cord must be 4-wire and the plug must also be 4-wire. Because a GFCI monitors the difference in voltage between the common and ground wires.

Does the GFCI trip?

Paul

Paul_KD7HB:
The power cord must be 4-wire and the plug must also be 4-wire. Because a GFCI monitors the difference in voltage between the common and ground wires.

Does the GFCI trip?

Paul

no tripping on it. its definitely an inline GFCI with a 3 prong plug, NEMA 5-20 style to be specific. i think i remember reading somewhere that a large inductive load should require an instantaneous turn on SSR, is that true?

philipcrost:
no tripping on it. its definitely an inline GFCI with a 3 prong plug, NEMA 5-20 style to be specific. i think i remember reading somewhere that a large inductive load should require an instantaneous turn on SSR, is that true?

Ok, I had to Google, again, how they work and they are tripping on a 5ma difference in current between the hot wire and the return wire. So, 3-wire cord is ok.

Since you have tested the SSR with a light bulb, put the light bulb at the end of the extension cord and test again.

A possibility, but remote, are the pressure washer extension cord and the Arduino power supply both grounded to the same electrical panel?

Paul