3 valve water drop controller

Hi, hoping for some help as i'm pulling my hair out. I build a single valve controller a while ago and had great results (https://petapixel.com/2016/06/04/build-diy-double-water-drip-system-high-speed-photos/), so i thought why not create a 3 valve controller. Using the same basic setup i have everything connected but when i press the button only 1 valve fires. I'm a absolute dope when it comes to programming does this look ok??

/* 
* How to Make a Double Water Drip system
* By
* Ted Kinsman emkpph@rit.edu
* Assistant Professor of Photographic Sciences
* at Rochester Institute of Technology (RIT)
* May 24, 2016  
* This is the simplest version of code and circuit to 
* make a double water drip. 
* The values below are for a drip height of 44cm from bottom of 
* valve to surface of water
*/

const int flashPin = 3;  // Set flash to pin 3 controls the opto-isolator 
const int StartButton = 7; // Set push button to pin 7 this will be an input from a switch
const int DripValve1 = 8;  // Set 1st valve to pin 8 connects to a reed switch which
const int DripValve2 = 9;  // Set 2nd valve to pin 9
const int DripValve3 = 10;  // Set 3rd valve to pin 10
          // controls the solenoid valve 
int buttonState = HIGH;

int ValveOpen = 500;  // Set a delay variable for time (milliseconds) valve is open
int ValvePause1 = 20; // set delay between drips (milliseconds)
int ValvePause2 = 20; // set delay between drips (milliseconds)
int flashDelay = 290; // Set a delay for flash to be triggered: adjust 
            // this for part of collision you want to photograph

void setup() {

pinMode(flashPin, OUTPUT);   // Set pin 3 as an output
pinMode(StartButton, INPUT);  // Set pin 7 as an input
pinMode(DripValve1, OUTPUT);  // Set pin 8 as an output
pinMode(DripValve2, OUTPUT);  // Set pin 9 as an output
pinMode(DripValve3, OUTPUT);  // Set pin 10 as an output

}

void loop() {

  
buttonState = digitalRead(StartButton);
if (buttonState==LOW) {  //starts the drips if the button is pressed

 digitalWrite(DripValve1, HIGH); // makes the valve open
 delay(ValveOpen);        //keeps valve open for ValveOpen time (milliseconds) 
 digitalWrite(DripValve1, LOW);  // makes the valve close
 delay(ValvePause1);       //keeps valve closed for the time between drips
 digitalWrite(DripValve2, HIGH); // makes the valve open for second drip
 delay(ValveOpen);        //keeps valve open for ValveOpen time (milliseconds)
 digitalWrite(DripValve2, LOW);  // closes the valve
 delay(ValvePause2);       //keeps valve closed for the time between drips
 digitalWrite(DripValve3, HIGH); // makes the valve open for second drip
 delay(ValveOpen);        //keeps valve open for ValveOpen time (milliseconds)
 digitalWrite(DripValve3, LOW);  // closes the valve
 
 delay(flashDelay);       //wait the flash delay time to trigger flash
 
 digitalWrite(flashPin, HIGH);  //trigger the flash
 delay(5);            //keep flash trigger pin high long enough to trigger flash
 digitalWrite(flashPin, LOW);  //turn off flash trigger

 delay(3000);     // keeps the system in a pause mode to avoid false triggers
} else{
  digitalWrite(flashPin, LOW); //sets pins low 
  digitalWrite(DripValve1, LOW); //sets pins low
  digitalWrite(DripValve2, LOW); //sets pins low
  digitalWrite(DripValve3, LOW); //sets pins low
 }
  
}

Do the other valves open if you test them with a short program that opens each in turn without the need to press a button ? How are the valves powered ? How much current do they take ?

By the way, I would berate you for not posting the code properly but I can't be bothered

Read read this before posting a programming question

Each valve, cables, reed switches work when i try them independently but when i combined them it only fires the valve connected to switch 10. Valves are powered by 12v battery which is looped through a reed switch.

You are using reed relays to switch the valves? Do you have flyback diodes in parallel with the relay coils? Can you post a wiring diagram? Also, a diagram of the valve piping.
How To Post

I don't see anything obvious wrong with your code. What happens if you comment-out the few lines of code for the valve that works? Does that cause another valve to work?

I suspect an electrical problem.

Make a pencil drawing showing how you have everything connected and powered and post a photo of the drawing.

And post a link to the datasheet for the valves you are using.

...R

Image from Reply #6 Original Post so we don't have to download it. See this Simple Image Guide

...R

Sorry, but I can't make sense of that Fritzing diagram. Please make a simple pencil drawing like I requested earlier.

What are the square green things?

Have you 3 separate power supplies?
Have they all got a common GND with the Arduino?

...R

apologies for the diagram, the green things are my attempt at showing Reed switches.

I have striped and rebuild the setup this time including an extra GND which is above pin 13 on the Arduino board plus a resistor on each cable going back to the board(Pin 8,9,10). It's now working.

Yes i had 3 separate power supplies connected to make sure it wasn't a lack of power causing it.

Yes they all have a common GND with Arduino.

Thanks for all your responses it help kick me into gear to try and sort this.

What are the current ratings for your reed relays? Are they ALL the same? I have only seen reed relays used for logic circuits, not for power handling.

Paul

Hi Paul, I'm using 5V SIP-1A05 relays and there all the same.

colgansh:
Hi Paul, I'm using 5V SIP-1A05 relays and there all the same.

The data sheet shows BLANKS for current rating. They are for logic switching, not current switching.

Paul

I had a similar problem when I build relay board for my arduino sometime back. Turned out that there is a sneak path thru the relays that interfered with their operation.

To fix it I had to put diode on each pin that drove a relay.

you also are lucky that without a flyback diode your arduino did not get damaged. Relays generally do generate a voltage spike when switch off that can be high enough to damage a uC/Transistor. flyback diode are there to clamp down that spike should it happen.

colgansh:
apologies for the diagram,

An apology does not make the diagram any easier to understand. A new non-Fritzing diagram is required. Taking the trouble to draw it may even identify the problem for you.

The other thing to do is to study VERY closely the differences between the working code and the non-working code.

...R

I have removed the diagram as i did not mean to cause any confusion/frustration. As I've stated above i have it working now but thanks for all the help. I'm going now to study some code so if i have another problem i'll hopefully know what i'm talking about :slight_smile:

Thanks again