J
[email protected]
- Jan 1, 1970
- 0
What I think I understand:
Picture trying to drive a relay with a Basic Stamp microcontroller.
The output pin on the Stamp won't sink or source enough current to
power the coil on the relay. So we add an NPN transistor.
We wire a diode parallel to one of the relay coil terminals, to
truncate the analog junk that the coils will generate. We wire the
other coil terminal to the collector of the NPN transistor. The
emitter of the transistor is wired to ground, and the output pin of the
Stamp is wired to the base. When the output pin goes high, it
saturates the transistor, current flows through the relay coils, and
the relay throws.
But what if I want to add an LED indicating that the relay is thrown?
Driving an LED from an output pin is easy - LED + current-limiting
resistor in series between the pin and ground.
But driving an LED and a relay from the same pin?
Where do I put the LED?
In series between the output pin and the base of the transistor?
In series with the relay coil?
In series between the emitter of the transistor and ground?
Between the output pin and ground, parallel with the transistor?
Seems to me that any of these would work.
What's the most usual practice?
And why?
Picture trying to drive a relay with a Basic Stamp microcontroller.
The output pin on the Stamp won't sink or source enough current to
power the coil on the relay. So we add an NPN transistor.
We wire a diode parallel to one of the relay coil terminals, to
truncate the analog junk that the coils will generate. We wire the
other coil terminal to the collector of the NPN transistor. The
emitter of the transistor is wired to ground, and the output pin of the
Stamp is wired to the base. When the output pin goes high, it
saturates the transistor, current flows through the relay coils, and
the relay throws.
But what if I want to add an LED indicating that the relay is thrown?
Driving an LED from an output pin is easy - LED + current-limiting
resistor in series between the pin and ground.
But driving an LED and a relay from the same pin?
Where do I put the LED?
In series between the output pin and the base of the transistor?
In series with the relay coil?
In series between the emitter of the transistor and ground?
Between the output pin and ground, parallel with the transistor?
Seems to me that any of these would work.
What's the most usual practice?
And why?