Controlling a 12v solenoid...

I have several 12v DC solenoids I want to control. I already have the code written but I'm not good with electronics and I'm not sure what I need to interface with the HIGH/LOW from the OUTPUT pin.

I'm guessing it would be a transistor, but I don't know which/what to use.

Here are some basic solenoid control circuits, with either a MOSFET or BJT transistor:

http://ruggedcircuits.com/html/circuit__7.html

--
The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, speaker, microphone, light sensor, potentiometer, pushbuttons

Hi,

Well, my favorite for this (because a friend designed it, and I sell it :slight_smile: ) is this:

http://arduino-direct.com/sunshop/index.php?l=product_detail&p=60

A important question is "How much current does the solenoid draw"??

Don't forget the reverse diode across the solenoid coil, like Rugged showed you.

You can certainly build this yourself...

The solenoids have a minimum amps of 500mA. I'd likely be using a 1A powersupply.

I can get 1N4004 diodes from radioshack and I have some 2N7000 - N Channel Mosfets. Would that mosfet work? If so, what resistors would
I need and where?

No, a 2N7000 is only good up to about 100mA or so (datasheet says 200mA max.)

For 500mA you could go either way, MOSFET or BJT. If you have several solenoids consider using a ULN2803 transistor array, though it's not good for turning them on all at the same time (the chip will overheat). Otherwise consider discrete transistors like PN2222 or TIP120/122.

The resistor should be something like 220 ohms and would go as shown in the schematics posted above.

--
The Rugged Motor Driver: two H-bridges, more power than an L298, fully protected

Okay to confirm, my shopping list would be:

TIP120 transistors
1N4004 diodes
220 ohms resistors

And wire each one up like: http://arduino.cc/playground/uploads/Learning/solenoid_driver.pdf

Will the TIP120s need to be heatsinked?

Sounds right. I don't think you're going to need heatsinking at only 500mA.

--
Beat707: MIDI drum machine / sequencer / groove-box for Arduino

I'm using a mechanical relay for my small solenoid, probably an overkill:

Well I've got it all hooked up. I'll test it once I finish the rest of hte project and let oyu know how it works. But I assume that would be pointless as it should work flawlessly. XD

Molehs:
TIP120 transistors
1N4004 diodes
220 ohms resistors

And wire each one up like: Arduino Playground - HomePage

Well I did the above and it's not working. I have 4-4.5v, thought the 220ohm resistor, coming in on the Base, the diode (polarity as indicated) and solenoid running in parallel from the 12v to the Collector, and the Emitter going to ground. I alternate the digital out from high to low to high to the Base which reads correctly, but the solenoid never fires. I have this set up twice and neither work. Both solenoids do work if I apply a direct 12v.

I'd be happy to test stuff with the multimeter, but I'm not sure what else to test where. Do the differences in the transistor and resistor from the diagram make a difference?

Hi,
The TIP120 is an NPN Darlington transistor. If you have 4.5V at the "Base" i bet you have the connections wrong. The Emitter-base voltage should be about 1.4V.

Check your connections:

Betcha!

Okay, I see what I did wrong. The diagram, which I made a poor assumption about, looked as if the Base was the 2nd pin. I had hooked it up wrong for sure.

Rewired and that fixed it!

Many thanks. Just wish I could wrap my head around electronics and circuitry better.

Molehs:
Okay, I see what I did wrong. The diagram, which I made a poor assumption about, looked as if the Base was the 2nd pin. I had hooked it up wrong for sure.

Rewired and that fixed it!

Many thanks. Just wish I could wrap my head around electronics and circuitry better.

Yeah, most npn transistors have EBC pin sequence. It's an understandable mistake. Just glad the transistor is not damaged.

Seems to be functioning as expected currently. This is the first time I've run it for any amount of time and the solenoid is a bit warm, not too hot to touch but noticeable. Any thoughts?

It's normal if there is a large current say 1A through it. Ever considered a heat sink?

Thought about it, but it doesn't quite get "that" hot. But I have various ones on hand if I eventually feel the need, thanks again.