Controlling Solenoid Valves

I’m having a problem controlling a 12v Solenoid Valve, when I run the sketch nothing happens. I have attached a couple of photos to help illustrate my wiring (ignore the 2 LEDs).

I have a 1K-Ohm 1/2 Watt 5% Resistor going from Pin 12 to the Base of a TIP120 Transistor. Forward of the TIP120, I have one lead of the Solenoid Valve and a Rectifier Diode (IN4004) connected to the Collector of the TIP120. I have a Jumper going from the Emitter to the 12V(-) on the breadboard. The other end of the rectifier diode goes to the 12v(+) on the Breadboard.

At the top of the Breadboard, I have 12v(+) on the left column and 12v(-) on the right column. At the bottom, I have the remaining Solenoid Valve lead going to the 12v(+) and a Jumper going from 12v(-) to the GND pin on the Arduino.

Im using a modified Blink sketch to control the Valve from Pin 12 as opposed to Pin 13.

When I switch the 12v(+) and 12v(-), the solenoid “knocks” repeatedly, so I know the Breadboard is getting power and the Solenoid works.

This is my first Arduino project and really my first time working with the hardware end of things. Any help (in lamens terms) would be great!


If you reconnect resistor from base to led - ground, is it blinking?

It is hard to say from the photos but it looks like your diode is the wrong way round. It should have the cathode (end with the stripe) to the +12 with the other end to the collector of the transistor. The coil should be across this diode, that is one end to +12V and the other to the transistor's collector.

Thanks Grumpy_Mike! That was it. I didn't realize those went in a certain direction which makes sense because one way is suppose to let no feedback through and the other forward current.

Though now after testing the Solenoid valve idea I've now realized its not going to work for my project (dispense liquid), it causes too much air in the line making a constant stream impossible.