Pages: [1]   Go Down
Author Topic: Solenoid Controll  (Read 719 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
[/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(){

   
}]


* 2012-08-03 19.09.20.jpg (1623.98 KB, 3264x2448 - viewed 20 times.)
Logged

Greenville, IL
Offline Offline
Edison Member
*
Karma: 15
Posts: 1328
Warning Novice on board! 0 to 1 chance of errors!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
[/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);
 }
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Ayer, Massachusetts, USA
Offline Offline
Edison Member
*
Karma: 53
Posts: 1833
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
[/void setup(){

This should be

Code:
void setup () {
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Greenville, IL
Offline Offline
Edison Member
*
Karma: 15
Posts: 1328
Warning Novice on board! 0 to 1 chance of errors!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

  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
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: