I'm struggling with what I feel like should be a simple issue, and would greatly appreciate any help. I'm brand new to Arduino and trying to get a switch-controlled valve up and running for a project.
I'm following this tutorial for wiring, with the motor replaced with a Solenoid valve. The valve is 12DC, 1.4A. I'm using a 12 V power supply (vs the 9 V in the diagram). Currently, when I press the switch, the LED turns on/off but nothing happens with the valve. With the valve connected directly to a 9 v battery, it pops right open. Do I need to switch to using a relay? I'm not sure what else to change.
My code is below. Thank you!
*/
int pushButton = 2;
int valveControl = 9;
// the setup routine runs once when you press reset:
void setup() {
// make the pushbutton's pin an input:
pinMode(pushButton, INPUT);
// make the transistor's pin an output:
pinMode(valveControl, OUTPUT);
pinMode(LED_BUILTIN, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
if(digitalRead(pushButton) == HIGH){
// ramp up the motor speed
digitalWrite(valveControl, HIGH);
digitalWrite(LED_BUILTIN, HIGH);
}
else {
digitalWrite(valveControl, LOW);
digitalWrite(LED_BUILTIN, LOW);
}
delay(1);
}
At this point in your project, the code is not important. Are connecting the solenoid valve directly to an Arduino pin? I hoe not, you will kill your Arduino, if you have not done so already. Does your tutorial show a transistor between the Arduino and the motor? It should. You cannot power motors and solenoids with an Arduino pin. You can control a transistor with the Arduino pin, when then can control the current to the motor or solenoid.
Do you have the solenoid connected directly to the Arduino 9 and GND pins ?
An Arduino pin can only supply 5V at a very low current so a 12V 1.4A solenoid is not going to work and you may already have damaged the Arduino by trying to use it.
Using a relay would allow you to switch 12V to the solenoid by driving the relay from an Arduino pin
Please read the first post in any forum entitled how to use this forum. http://forum.arduino.cc/index.php/topic,148850.0.html . Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
What transistor are you using?
We need to see your circuit, can you post a picture of your project so we can see your component layout?
The gnd of the UNO should be connected the neg/gnd of the motor supply.
Can you please post a copy of your circuit as a proper hand drawn circuit in jpg, png?
Fritzy diagrams are hopeless at debugging signal flow and showing things like transistor pinouts, EBC, BCE, ECB ????