anonymous said:
OK - so now Im wondering:
+9V ----> positive lead ---> device ----> negative lead ----> ground
seems ok.. yes?
what if I want to have an led light when the plug is inserted?
+9v ----> + lead ---> device ----> - lead -----> R1 ----> led ---->
ground
but if the LED needs 2V then I would be running 11 V through my
device..
right? I can figure R1 with V= IR.. but what voltage should I put
there?
will it be 9?
Since the 2 voltages are in series they are additive. But I don't
want more
than 9 V at my device.
I think this 2nd diagram isn't correct.
I think the problem is that you want some kind of indicator when the
device is active, meaning its passing some current. You don't want to
put the LED in series; that'll make the LED brightness depend on how
much current the device draws, and if the device wants more than 20mA,
the LED will get fried quickly.
If the switch is external to your device, then you can just use the
fact that voltage is applied:
T
---
VCC-o o---o----------,
| |
| V =>
.-------. -
| your | |
| device| |
| | .-.
| | | | 620R
'-------' | |
| '-'
| |
GND------o----------'
created by Andy´s ASCII-Circuit v1.25.250804
www.tech-chat.de
When the switch is closed, your thing turns on, and so does the LED.
However, I think the real problem is that the switch is inside the box
labeled "your device" above. If this is the case, the only thing you
can really do is measure whether current is flowing through the
device. To do that, you put a resistor in series with it, and measure
the voltage across that resistor. If its non-zero, then the current
through it is non-zero.
Generally, sense resistors are quite small so they don't interfere
with the circuit they are measuring (ie, 1 ohm or less). This means
that the voltage across them is also quite small. If your device draws
10mA, then the voltage across a 1 ohm resistor is 10mV. Thats a pretty
small difference to sense using your typical transistor circuit, due
to variations in transistors and resistors.
You can use a comparator to measure differences, and also power your
led from the output:
VCC
------o-------------o------o--------------.
| | | |
| | | |
.----o-----. | | V => (Your LED)
| your | .-. | -
| device | | |R1 | |
| | | | | .-.
| | '-' | | |R4
'----o-----' | | | |
| | | '-'
| | |\| |
o-------------|----|-\ |
| | | >-------------o
| o--o-|+/ |
| | | |/| |
.-. .-. | | ___ |
| |Rs R2| | '--------|___|-----'
| | | | | R3
'-' '-' |
| | |
GND | | |
------o-------------o------'
R1 = 18k
R2 = 10 ohms
R3 = 100k
R4 = 620
Rs = 1 ohm
comparator is an LM339 or something like it
created by Andy´s ASCII-Circuit v1.25.250804
www.tech-chat.de
This circuit measures the current across Rs, and compares it to the
5mV reference at the V+ input. Thus, if the current through your
device is more than 5mA, the LED will turn on. When it drops below
5mA, the LED will turn off. R3 gives you a little bit of hysteresis,
in case your circuit draw wants to hover around 5mA.
R1 and R2 are chosen based on the current you want to turn the LED on
at. Its set up for 5mA, but you can change that if you want. Using a
22k trimmer in place of R1 might be a good substitution, because then
you can adjust the point where the current turns on the LED.
Regards,
Bob Monsen