Go Down

Topic: Solenoid Controll (Read 894 times) previous topic - next topic

goleynik

I am very new to Arduino and i am trying to controll a solenoid to fire at exact times. The problem that i have is that when i load the code nothing happens. When i reset the arduino the solenoid will sometimes fire once randomly but not every time. I need help/advice on how to fix this problem. I have included some pictures of my project incase you see something that is wrong. I also included the code that i am using. Any advice would be greatly appreciated.

I built my setup following these instructions http://www.instructables.com/id/Controlling-solenoids-with-arduino/

but i am using the Uno board



Code: [Select]
[/void setup(){
   pinMode(13, OUTPUT);
      digitalWrite(13, HIGH); // turn on
   delay(1500);            // the delay before it turns off
   digitalWrite(13, LOW);  // turn off
   digitalWrite(13, HIGH);
   delay(2000);
   digitalWrite(13, LOW);
   digitalWrite(13, HIGH);
   delay(2500);
   digitalWrite(13, LOW);
   digitalWrite(13, HIGH);
   delay(3000);
   digitalWrite(13, LOW);
   digitalWrite(13, HIGH);
   delay(3500);
   digitalWrite(13, LOW);
}
void loop(){

   
}]

cyclegadget

I changed your code a little. Tell me if it makes the solenoid work. Also, watch the Led that is attached to pin 13. It should blink according to the delay times.

Code: [Select]
[/void setup(){
   pinMode(13, OUTPUT);
      digitalWrite(13, HIGH); // turn on
   delay(1500);            // the delay before it turns off
   digitalWrite(13, LOW);  // turn off
   delay(1500);
   digitalWrite(13, HIGH);
   delay(2000);
   digitalWrite(13, LOW);
   delay(1500);
   digitalWrite(13, HIGH);
   delay(2500);
   digitalWrite(13, LOW);
   delay(1500);
   digitalWrite(13, HIGH);
   delay(3000);
   digitalWrite(13, LOW);
   delay(1500);
   digitalWrite(13, HIGH);
   delay(3500);
   digitalWrite(13, LOW);
}
Good links: Eagle tutorial= http://www.youtube.com/playlist?list=PLDE1858BD83D19C70
General Arduion tutorials = http://tronixstuff.wordpress.com
http://www.gammon.com.au/forum/bbshowpost.php?bbtopic_id=123

goleynik

It gave me this   error: expected unqualified-id before '[' token with the first line highlighted. I didn't know what to change

MichaelMeissner


I changed your code a little. Tell me if it makes the solenoid work. Also, watch the Led that is attached to pin 13. It should blink according to the delay times.

Code: [Select]

[/void setup(){



This should be

Code: [Select]

void setup () {

goleynik

That is now causing the led to blink but the solenoid is still not firing. I am assuming that it is a hardware issue now. Am I correct about that? Should I try re- wiring everything?

cyclegadget

  The fact you can see the LED blinking tells us that the UNO is working and the pin13 is going from HIGH to LOW back and forth so, it is working also. That leave you with a wiring or hardware issue other than the UNO.

You didn't say which transistor you were using for this project and the instructable gave two choices but, your wiring should be like this.
http://www.arduino.cc/playground/uploads/Learning/solenoid_driver.pdf
Good links: Eagle tutorial= http://www.youtube.com/playlist?list=PLDE1858BD83D19C70
General Arduion tutorials = http://tronixstuff.wordpress.com
http://www.gammon.com.au/forum/bbshowpost.php?bbtopic_id=123

goleynik

I am using the TIP120 transistor. I will try and find the flaw in my system. Thank you so much!

Go Up