I have connected the base (pin 2) to the Arduino, the emitter (pin 1) to ground and the collector to what I intent to drive. Right now the collector is in series with a diode and a resistor and from there to 24V. I have set the base pin to switch between 0 and 5 volt which I have verified that it does. However the diode is constantly on and the transistor is acting like a short circuit. What am I doing wrong. Thanks!
You need a resistor between the arduino pin and the base. You need to make the diode reverse biased, that is cathode pointing to +12V.
You need to post a schematic.
I have set the base pin to switch between 0 and 5 volt which I have verified that it does.
How have you done that, you will never see 5V on the base of a transistor connected directly to an arduino output. At least not on a transistor that still works.
Thanks for the links, but I have another schematics I am following. The reason for this post is to find out why My Darlington transistors is acting like a short circuits. Are the base current to high? Is the pin assignment wrong? Does the load has to be before the transistor?
The transistor probably is a short circuit, because it has been destroyed.
As all the tutorials clearly explain, you need a diode to protect the transistor from inductive kickback.
That's "E B C", not "1 2 3". Transistors have a symbol - you use the symbol in a circuit
diagram so it can be read.
Yes, that's a high brightness LED I'm guessing, powered from a darlington? Yes it
will glow a bit when the darlington is off, that's leakage current (which is ~100 times
larger for darlington's than simple NPN transistor). Darlingtons aren't great at
leakage current, Vsat or speed of switching, often a MOSFET is a much better idea,
Also if this is the same darlington you used before with the diode in the wrong place
it is almost certainly damaged - you cannot get away with driving a solenoid without
a flyback diode across the winding - the transistor will be destroyed or degraded the
instance it first switches off.
The base resistor of 100 ohms is far too low for a darlington, 1k is plenty low enough.
It might be OK for an NPN base resistor apart from the fact you will overload the
Arduino pin past its absolute maximum ratings and risk blowing a pin. Changing the
darlington to an NPN or MOSFET will bring the leakage current down and extinguish
the LEDs properly.
Use no lower than 150 ohm for a base resistor from a 5V Arduino - the pins have an
absolute maximum current of 40mA.