Go Down

Topic: Solenoid cuircut in parallel (Read 725 times) previous topic - next topic

CodoC

Hey Im using the solenoid circuit attached except im using a TIP 122 instead.  I was wondering if it would be possible to use 6 of these in parallel?  I have setup 2 in parallel with 24 volts @ 2.5 amps and only one works.  I am using 24v solenoids using 1 amp.

Is it a problem with the circuit or maybe with my code?  code below.  How does this code work btw. Say, If the serial reads 60 then triggers solenoid strike subroutine will it start back at the top of void loop after or will it continue through the rest of void loop?

/*

//////////////////////////////SOLENOID ORCHESTRA\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

6 24Watt Solenoids controlSolenoid by external MIDI
205 Michael Manning

The circuit:
* Solenoid 1 to digital pin 8
* Solenoid 2 to digital pin 9
* Solenoid 3 to digital pin 10
* Solenoid 4 to digital pin 5
* Solenoid 5 to digital pin 12
* Solenoid 6 to digital pin 13
* 10K resistors to digital pins

*/

//---------------------------------VARS------------------------------------------

int serialvalue; // value for serial input

int SPins[] = {8, 9, 10, 5, 12 ,13}; //pin array

//---------------------------------SETUP------------------------------------------

void setup(){
 
  for (int thisS = 0; thisS < 6; thisS++) {  // initialize pins
    pinMode(SPins[thisS], OUTPUT);
   
  }
    Serial.begin(9600); // open the arduino serial port
}

//---------------------------------LOOP------------------------------------------

void loop(){

     
  if(Serial.available()) // check to see if there's serial data in the buffer
{
  serialvalue = Serial.read(); // read a byte of serial data
  Serial.print(serialvalue);

}
  and if (serialvalue == 60){
     Serial.print(serialvalue); // echo the received serial valu
     solenoidStrike (2);
   }
   
   if (serialvalue == 61){
     Serial.print(serialvalue); // echo the received serial valu
     solenoidStrike (3);
   }
   
     if (serialvalue == 62){
     Serial.print(serialvalue); // echo the received serial valu
     solenoidStrike (4);
   }
   
     if (serialvalue == 63){
     Serial.print(serialvalue); // echo the received serial valu
     solenoidStrike (5);
   }
     
     if (serialvalue == 64){
     Serial.print(serialvalue); // echo the received serial valu
     solenoidStrike (6);
   }
   
       if (serialvalue == 65){
     Serial.print(serialvalue); // echo the received serial valu
     solenoidStrike (7);
   }
   
       if (serialvalue == 66){
     Serial.print(serialvalue); // echo the received serial valu
     solenoidStrike (8);
   }
}

  void solenoidStrike (int pinNumber) {
    digitalWrite(pinNumber, HIGH);   // set the Solenoid on
    delay(80);
    digitalWrite(pinNumber, LOW);   // set the Solenoid on
    serialvalue = 0;
  }


jackrae


elandd2011

let see you hardware for help you

Grumpy_Mike

When posting code, use the # icon in the reply box and past it between the brackets.

This line never got past the compiler:-
and if (serialvalue == 60){

Quote
will it start back at the top of void loop after or will it continue through the rest of void loop?

It will continue doing the rest of the loop.

You don't have to say void loop because void simply means it doesn't return a value.

For a better way of writing this see:-
http://www.thebox.myzen.co.uk/Hardware/Glockenspiel.html

Go Up