Solenoid Valve does not open

Our project deadline is in three days and to anyone who either has a job or goes to school should know how important it is. No matter what we've done, the solenoid valve refuses to open at all. Even after we suggested to the professor that the product might be faulty, she still does not comprehend the issue. Here is the code we've tried to use many times, keep in mind this is only high school level work, please don't tell me i'm dumb and expect me to code like a professional. The code is simple and only serves to open the valve. The solenoid valve is the 12V shown from BC robotics and we are using an NPN bipolar transistor.

int solenoidPin=2;

void setup() {
  pinMode(solenoidPin, OUTPUT);

void loop() {
  digitalWrite(solenoidPin, HIGH);


start with the basics

link to the place you got the valve. data sheet of the valve.

what happens when you put power to it directly ?

where is delay() !!! all beginners need to use delay() !

[pre]digitalWrite(solenoidPin, HIGH);
[pre]digitalWrite(solenoidPin, LOW );

where is your schematic ? is the FET between your solenoid and ground ? or did you put it after Vcc and before the valve ?

tip : use different times in delay. that way you know what condition is energized and which is not.

that the product might be faulty

To test it just hook it up directly to your power. Leave the positive lines for testing by briefly touching together.

Interestingly, every single one of "jhope's" few posts begins with the keyword URGENT in the title.

The OP certainly leads a hectic life!

Hi, Do you have a DMM to test your circuit and the solenoid coil?

Tom.... :)

jhope: ...Even after we suggested to the professor that the product might be faulty, she still does not comprehend the issue...

So have you done what @dave-in-nj suggested and tried to power the solenoid directly? Everybody can always [u]suggest[/u] umpteen reasons why their project does not work. The skill is in deciding what reasons are most likely then eliminating them one by one until you have [u]proven[/u] the cause.

Well, first of all, you can STOP putting URGENT in the headlines, because doing is is indeed childish and pointless, and mostly points towards your inability to do proper planning.

I don't care the least if it's urgent for you. That's your problem. You don't pay me (or anyone else) for help - so even the double pay required for URGENT jobs is zero. Understand? Good.

Now to solve your problem (of course you should have done all these steps already as it's just basic troubleshooting):

1) Make sure your power supply can supply more than enough current (>2 times the rated current of the solenoid would be comfortable). If not, get a suitable power supply. 2) Connect your 12V power supply directly to your solenoid. Does it move? If not, it's broken. Get another solenoid.

Now you verified your solenoid actually works, and you can continue. 3) Verify your transistor can handle the current the solenoid requires to operate. If not, get another transistor. 4) Hook up your transistor - collector to solenoid, emitter to negative pole of the power supply. Through a resistor (about 1k) connect the base to the +12V of the power supply. Does this switch the solenoid? Great, your transistor is working.

Time to continue with the Arduino: 5) Connect your Arduino: pin via resistor to base; GND to negative of the Arduino. 6) Open the Blink sketch; change the pin number to match the one your resistor is connected to. 7) Double check that the pin your resistor uses is the same as you use in your code. 8 ) Run the code. Your solenoid should be clicking on and off.

Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

Sorry, but this thread prooves that point is incorrect.

almost every post in response is agreed.

#1) saying urgent is pointless, childish and IMHO a bit insulting.

#2) with the bits of information, no data sheets, no schematic, no description of how things are connected, multiple people offered the solution.

vw , you just did the full scope to lay it out extremely well.

That was more based on forum experience than actual project details, combined with bog standard fault searching procedures (which OP apparently didn't know about, or couldn't think of).

Most here will never respond to posts marked URGENT.

Quit yelling at us.

Interesting, lately some new users have taken to using URGENT in their post. They get rewarded and then other new people think this is a good way to demand to be moved to the front of the line.

@jhope: you have started four topics on the forum, each prefixed "URGENT".

Might I suggest a course in time-management?

How about reading the posting guidelines?

It doesn't matter how many weak excuses you post, if you don't provide details, no-one can help you. "the solenoid valve" tells us nothing apart from you have a valve controlled by a solenoid.

Not posting a schematic helps no-one. You're using an NPN transistor? Whoop-de-do.

I'm coming around to the feeling that commonsense is the new superpower.

Remember: "Anchored in excellence"