Problem with transistor [solved...pure user error]

So I have a weird problem that I ran into. I am following this circuit exactly: im using 9v instead of 5v), and I had it all set up on a proto board and it has been working great for awhile. Just today I was having problems on the board and tried replacing the transistor. That didn't work so I decided to go back to square one and make the circuit on a breadboard. So after setting it up on the breadboard I tried it with the relay and I can feel the relay a tiny bit, but nowhere near fully closing. Using the battery alone against the relay it works fine. It seems to me like somehow the current is unable to pass through the transistor or something. I can't understand whats going on since the exact same circuit was working perfectly before.

If anyone can help me that would be GREATLY appreciated. I am so close to finishing this project, but now this is stopping me from moving any further.

Thank you!

Which relay are you using ? Check the datasheet. Is it supposed to switch at 4.5V ( or at 8.5V if you are using 9V ) ?
Is the current it draws ok for the transistor ?

What's the value of R1 ?
Do you have a multimeter to check the transistor's collector voltages ( a) when Arduino output pin is high b) when it's low ) ?

Which questions have you answered to yourself already ?

So actually I managed to get it working on the bread board. All I did was switch collector and emitter...I'm not sure why or how that changed it, but it is working pretty well now. Another question if the answer is even known(or should I delete this thread and make a new one?): How reliable will this circuit be. I intend to have it in a car and I would like it to work for at least a year at a time if not more. If relays need to be changed that can be done easily, but what about everything else?

If you miss identify the collector and emitter a transistor will still work but with much reduced gain. That is what you have just found.

Reliability is a very big topic, bottom line is that any component can fail at any time.

On the positive side with regards to the circuit is that this is a very basic circuit that has had many many years of implementation in real product designs so reliability will be based on the quality of your parts and how much below their maximum ratings they are operating at.

So, one important aspect of reliability is keeping a part from being "abused". If your circuit needs a part that controls a load (like a relay) and the relay will use 100mA of current at 12V when energized, using the right part is key.

Lets say you have 3 transistors... 2N4124, 2N4400 and 2N2222A... Which one do you choose?

The first thought is: "Yes, They will ALL work", but lets look at a some key values...

2N4124 - Collector Current - 200mA, Voltage (emitter collector) 25V
2N4400 - Collector Current - 600mA, Voltage (emitter collector) 40V
2N2222A - Collector Current - 800mA , Voltage (emitter collector) 30V

From an excess current handling capacity perspective, the 2N2222A wins with 800mA and would be a good choice since 100mA will hardly impact a device that will work great up to around 800mA.

However, what if the conditions of your circuit included a collector side voltage that was unregulated and could see, for example, brief spikes of 25V for some crazy reason... (IE; like in a car or moped) . In that case, you might do better with the 2N4400 that has a higher voltage rating.

Note: These numbers from the data sheet are not where your should strive to operate the part at. They are the recommended maximums that the part should be subjected to before the part will begin to fail. Avoid the MAX value in the characteristics tables... and you achieve reliability.

@ Grumpy_Mike:
Ya I read about that afterwards, it's nice it was a simple fix haha. And I guess that's true and I'll just have to live with it. One thing I may try is I'll see if I can find transistor's specifically for automotive operation. Everything else other than the arduino that I'm using is for automotive use(if an automotive version exists) so there is probably an automotive transistor too. The best strategy overall will probably be to make my project as fail safe as possible(such as plain simple kill switch and where the car will die/not start rather than start on it's own or something).

Thank you very much! That's a lot of helpful info and I hadn't even looked at those other transistors. I've been using the 2n2222A and I probably will continue to use it since I am only running a regulated 9v across it. I basically have the transistor working as a switch for the relay so it should never see the car's 12v(up to 16v) line and if it does it would be very unusual and even if it happened just when there was a voltage spike the transistor should be able to handle the 12 - 25v that it would encounter.

Again, thank you so much!

If your using the arduino and are afraid of it locking up you could implement a watchdog timer, then it will reset if it fails
other than that the best fail safeing is all in the design, circuits made in such a way that the most probably failure mode will not be harmful
and a backup always helps

I was looking at the watchdog timer, I'd have to burn a custom bootloader for it though correct? Right now I was planing on just making a reset circuit that safely resets the device(mostly for testing since I don't have the stuff for burning a bootloader).

Also two more things...

  1. Somehow, I'm back to square one again! I am using the exact same set up(i'm pretty sure) as before and it's not working. Two things I noticed are that if i remove the diode the relay activates and the transistor gets ridiculously hot when the diode is in if i remove the diode the transistor does not get hot. I may try to upload an actual picture of my set up if I can get the chance. And yes I have tried the transistor both ways. Same results.

  2. Could I use a transistor array with similar specs to the 2N2222A? Will this be any less reliable?

EDIT: I tested continuity with a multimeter and the transistor seems to be functioning correctly. I am simply running the blink script for testing it and the continuity blinks with the arduino. on one side of the transistor i have it inline(on a breadboard so connected) with a diode and the ground side of the relay. The other side of the transistor is inline with the arduino ground and the 9v battery's ground. Also the diode goes from the one side of the transistor to another point where it is inline with the relay's positive terminal and the 9v battery's positive side.

Hopefully this can help someone help me.

Ok all is well now. I made the stupid mistake of having a messy setup and I was accidentally connecting the 9v battery backwards...which explains everything. Lesson learned: Organization is VERY important haha