Since the solenoid requires higher current than the arduino can provide we will be using an alternative power source for the solenoid (a couple batteries) and will be "driving" it with a TIP120 transistor.
The circuit we're using can be found online here. This instructable draws from the excellent documentation in Tod Kurt's bionic arduino workshops.
Build time was exactly one-beer. Excluding the arduino and computer you use to program it, we are using less than $10 in parts. Ok!
Remove these ads by
Signing UpStep 1: Parts
• USB cable for programming and powering the Arduino
• Breadboard
• Some jumper cables
• A 1K resistor
• TIP120 transistor (TIP102 will also work fine)
• 1N4004 diode (1N4001 also works)
• Some batteries and connectors for solenoid power
• A solenoid with leads to connect to the breadboard







































Visit Our Store »
Go Pro Today »




i have the same project,, but my solenoid only push and is difficult to get back ..
could you please post here the program code that u write to control the solenoid ..
thanks in advance
I purchased a solenoid valve . i want to control it from my arduino. I did not get
TIP 120/102 transistor. I got TIP 122 only. Can that be an alternative yo TIP 120? If yes is there any change i need to make with the above circuit? Please reply asap.
Regards
If you are looking at the sample code the line you need is:
digitalWrite(ledPin, HIGH);
delay(1000);
changing that delay (in miliseconds) will make it stay open longer.
If you need info on uploading or getting the sketch you can check a great tutorial here http://www.ladyada.net/learn/arduino/lesson1.html
This is only because it is the ground, which creates as he mentions a "common ground" which is needed when running to different power supplies on one system.
If you know anything about PCB design its essential the representation of having a ground plane and everything one the board being grounded to that plane while there could be more than one power supply input throughout the design.
I want to implement this with a push button on/off.
Lastly, does it matter the mAh? I'd like to avoid using 9v batteries and instead use an AC adapter that outputs 12V natively
http://www.goldmine-elec-products.com/prodinfo.asp?number=G16822
A "continuous duty" solenoid is preferable to "intermittent duty."
as someone who has used solenoid valves for many projects heres a little word of the wise: 1. use the exact same circuit to drive a small relay, wich will then control the current to the solenoid, this allows for two things, no kickback current, and a intermediate that will allow for a safety switch/ debug point. but yea your probably not going to be doing anything too dangerous to have to deal with these kind of problems but thats just the policy ive stuck to for many years.
but still great work!
I have a very similar circuit set up except that it's not driving a solenoid and instead of 9V batteries I'm using a power supply to give the arduino 8.5V and using a voltage regulator circuit to bring 3V to the collector pin on the transistor, and I wanted 3V on the emitter when it was on.
I ran into trouble when the voltage on my emitter pin was a good 0.7V lower than the voltage on the collector. This seems like a lot when we are dealing with voltages in the single digits ... I think this transistor is designed for higher voltage/current, but we have to work with what we have :)
To solve this, I had to realize that like it or not I had created a voltage divider. I found there was about a 100 ohm resistance between the C and E pins in the TIP120 when it was "on" and about 365 ohms in my load. I drew a little voltage divider circuit, filled in my known values and solved for the input voltage I needed to get 3V at the middle node of my accidental voltage divider.