Arduino & 12vdc Relay coil

I've done my best to search both the forum and the web for answers to my questions, but haven't found any. Apologies for any repetition.

I've been following the diagram: http://www.arduino.cc/playground/uploads/Learning/relays.pdf and have tried as many possible combinations of transistors/resistors I can manage to try and get the circuit to work with both a 5vdc coil relay and a 12vdc coil relay, and I can't get either to work.

Here's my circuit, following, as best I can, the playground diagram: http://www.flickr.com/photos/80458750@N00/819738972 In the picture, the green wire is the Arduino pin 13 -> 2.2k resistor -> 2N2222 transistor. The diode is a IN4001. The relay has a 12vdc coil. The black wire is the 12vdc ground, the red wire is the 12vdc power. I have limited experience with electronics. Here is what I know: it is not a problem with either the power supply, relay, diode, arduino or arduino program. A LED lights up when connected to pin 13 running the same program. The relay switches when connected directly to the power supply without either the resistor or transistor.

I'm assuming that I'm making a glaringly obvious mistake. I have tried replacing the transistor, resistor and diode thinking that one of the might be faultly. I've also tried a 1k resistor, and a IN4004 diode. I've also tried exchanging the connections to the 12vdc relay coil. No success.

Any ideas? Any help would be much appreciated. Thanks

hi

the transistor is plugged in backwards :)

Try using a new one, as the one in the pic may eb destroyed. This type of package is called a TO-92. While you have to check the manufacturers datasheet for the pinout, the standard pinout is usually E-B-C when looking at it from the front.

D

you are right. you are absolutely right.

Here's the crazy thing: I was right too (in a way). What was wrong was the diagram on the back of the radio shack box, it has the order listed backwards - the way that I had put it together.

Thanks, Daniel, for this and for reminding me of the value of forums such as these.

hi

Well that is lesson one of electronics: don't buy form Radio Shack, unlkess it's an emergency :) They buy that transistor in Asia for 2 cents, and then sell it for $2 and mislabel it! Any local electronics supplier will usually sell you a transistor like that for less than 25 cents.

D

Lesson learned here.

Thanks again.