LED & Resistor befuddlement - Page 2

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Re: LED & Resistor befuddlement
Quoted text here. Click to load it

You squeezed the trigger too soon and missed the point. Besides, when a
micro is in reset all IO are inputs and floating, and that's for at
least several if not 100's of milliseconds, isn't it? This includes
spare pins that are not terminated and that configured as outputs for
this reason.

If you had thought about it further you would of realized that the pin
is normally in output mode anyway and just switching to input mode when
testing.

We can't work with "ideal" circuits, we just make real circuits work for
us, that's what engineers do.

--
Peter Jakacki



Re: LED & Resistor befuddlement

Quoted text here. Click to load it

OK, if the LED is connected, what will you see? Still a low?



Re: LED & Resistor befuddlement
Quoted text here. Click to load it

With the LED in the circuit the pin will be pulled up very quickly to a
high voltage.  

--

Rick "rickman" Collins

snipped-for-privacy@XYarius.com
We've slightly trimmed the long signature. Click to see the full one.
Re: LED & Resistor befuddlement

Quoted text here. Click to load it
should

I'm not clear on the concept. Is this the circuit?

+5
|
|
1k ohm
|
|
LED
|
----------------- I/O


If the LED is not in the circuit, given the capacitance of a CMOS output, I
can see the output staying at whichever state it is driven for long enough
to be measured (State 1 & 2).

1) No LED. Output 0 & measure back 0

2) No LED. Output 1 & measure back 1

When you put the LED in the circuit, I guess I don't understand how it is to
operate  (State 3 & 4):

3) Has LED. Output 0 & measure back ? (Turns on LED)

4) Has LED. Output 1 & measure back ?

Thanks,

Mike



Re: LED & Resistor befuddlement
Quoted text here. Click to load it


1) No LED. Output 0, disable output, measure back 0

When you put the LED in the circuit, I guess I don't understand how it
is to
operate  (State 3 & 4):

2) Has LED. Output 0, disable output, measure back 1


--

Rick "rickman" Collins

snipped-for-privacy@XYarius.com
We've slightly trimmed the long signature. Click to see the full one.
Re: LED & Resistor befuddlement
Quoted text here. Click to load it

This circuit fulfills your requirements and works just like you want it
to. Furthermore, you can use any value resistor practical.

With LED in circuit
1. Output logic low
Led draws current and output pin goes to within Vss
Parasitic capacitance of pin is now at this level

2. Release output (tristate)
Pin is now high impedance with parasitic input capacitance holding last
state.

3. very short delay
Resistor + led charges parasitic input capacitance up to within Vdd

4. Read input as logic high

5. Switch pin back to an output to whatever state you want.


With no LED in circuit
1. Output logic low
Led draws current and output pin goes to within Vss
Parasitic capacitance of pin is now at this level

2. Release output (tristate)
Pin is now high impedance with parasitic input capacitance holding last
state.

3. very short delay
As there is nothing connected to input pin the parasitic input capacitor
will hold the last state (logic low). This may eventually float to some
indeterminate state if left in this condition.

4. Read input as logic low

5. Switch pin back to an output to whatever state you want.

--
Peter Jakacki


Re: LED & Resistor befuddlement
Quoted text here. Click to load it

The above solution is a little flakey.

If you like, add an external capacitor and a pull-down resistor.

--
Joe Legris


Re: LED & Resistor befuddlement
Care to quantify flakey???? As I stated, this solution works, is
repeatable, and is based on real-life component parametric behaviour.

*Any fool knows that a rock can't burn Marco.*

The original poster called for only two components, the led, and the
resistor. You have just doubled his component count and left the
solution open-ended by omitting details.

Besides, where's the fun in doing things the easy way. Have fun in
meeting the challenge and then afterwards the solution becomes the new
"easy way", till next time...

--
Peter Jakacki


Joe Legris wrote:
We've slightly trimmed the long signature. Click to see the full one.
Re: LED & Resistor befuddlement


Quoted text here. Click to load it
when
you
and

I think the problem with doing that is that the forward voltage drop of
the LED puts the input pin in the area of "uncertain" results.


Re: LED & Resistor befuddlement
Quoted text here. Click to load it

But the "high" voltage with the LED installed is at best 3.5 Volts and
probably less, depending on the LED. The threshold voltage of the input
may be around 2.5 volts, so it's all a little dicey.

--
Joe Legris


Re: LED & Resistor befuddlement
Quoted text here. Click to load it

I picked the 10K value from air.  The diode drop is not a fixed number,
but varies with current.  Simply increase the 10K resistor value until
you get an acceptably high voltage at the pin.  It won't take much to
pull down an open input to make it read low with no LED.  I expect a
100K will work, or possibly you will need something closer to 1M.  

I have never been able to get an IV curve on LEDs and I have not
measured it myself.  Anyone know how low the current must be to get the
voltage drop below 1 volt?  

--

Rick "rickman" Collins

snipped-for-privacy@XYarius.com
We've slightly trimmed the long signature. Click to see the full one.
Re: LED & Resistor befuddlement
On Wed, 02 Jun 2004 17:20:46 -0400, the renowned rickman

Quoted text here. Click to load it

Very, very low. I measure about 60nA with the one I mentioned earlier.

They follow the classic diode equation in this region up to perhaps a
few mA where the series resistance starts to have a significant
effect.  

Best regards,
Spehro Pefhany
--
"it's the network..."                          "The Journey is the reward"
snipped-for-privacy@interlog.com             Info for manufacturers: http://www.trexon.com
We've slightly trimmed the long signature. Click to see the full one.
Re: LED & Resistor befuddlement
Quoted text here. Click to load it

What voltage do you measure on the LED with a current of 4 uA?  

--

Rick "rickman" Collins

snipped-for-privacy@XYarius.com
We've slightly trimmed the long signature. Click to see the full one.
Re: LED & Resistor befuddlement

Quoted text here. Click to load it

Once a diode is turned on, the voltage remains pretty much the same
regardless of the amount of in-spec current you run through it. If you limit
the current too much, the LED won't be bright enough, or won't turn on.

In general, LED's drop between 1.5 and 2V. As you vary the current through
the LED, you will see some variation in the forward voltage, but not enough
to make a difference, and I doubt that a reliable way to use these devices.

Mike



Re: LED & Resistor befuddlement
Quoted text here. Click to load it

I don't think you have read enough of the thread to understand what we
are doing.  I am trying to use a pull down resistor to pull the IO pin
on the MCU to ground when the LED is absent.  When the LED is in place,
the pull down resistor needs to be light enough (high enough resistance)
to *not* draw any more current than necessary.  The pull down resistor
is not trying to make the LED light.  The goal is to allow the LED to
pull the IO pin up to a voltage that will be seen as a 1 on the MCU IO
pin.  

I originally assumed that we were talking about TTL levels, but I expect
there may be some devices that use CMOS thresholds on the inputs.  

--

Rick "rickman" Collins

snipped-for-privacy@XYarius.com
We've slightly trimmed the long signature. Click to see the full one.
Re: LED & Resistor befuddlement

Quoted text here. Click to load it
the
limit
through
enough
devices.

I'd better read it from the top.

Quoted text here. Click to load it

I understand what you're saying. The thing is that the drop across the LED
is a fixed voltage of about two volts, and that puts the logic level into
never-never land.

Quoted text here. Click to load it

OK, lets say you have a 1k pull-up resistor and a 10k across the LED. The
voltage drop across the 10k resistor is going to be ~ 2V. So, then, you
change the pull-up to 330 and the 10k to a 100k, but it doesn't make a
difference? Why? Because the voltage across the LED is always going to be
pretty much the same -- that's the nature of a diode.

Another thing I thought about doing is putting two resistors in series under
the LED. But it just doesn't cut it.

Last night I was thinking about this problem for just one LED. The fact is
that I need to implement this into a 4x4 array of these "LED Switches".
So.... the basic question remains, but its not so many transistors after
all.

Quoted text here. Click to load it

I will probably use a mux on the keypad rather than a controller, so I have
a choice between TTL & CMOS, but not A/D.

Mike





Re: LED & Resistor befuddlement
Quoted text here. Click to load it

Oh, I see you are the OP.  But your assumption that the LED has a
constant 2 volt drop is not accurate.  The drop is a function of
current.  Anyway, if your MCU input levels are TTL compatible, you don't
have a problem in any event.  What does your data sheet say?  


Quoted text here. Click to load it

If you can pick TTL levels, then the problem goes away....

--

Rick "rickman" Collins

snipped-for-privacy@XYarius.com
We've slightly trimmed the long signature. Click to see the full one.
Re: LED & Resistor befuddlement

Quoted text here. Click to load it

The drop is usually closer to 1.5 or 1.8v, which really doesn't cut it for
TTL or CMOS.

Quoted text here. Click to load it

I'm still working on the schematics. I plan to use the usbmicro U421, or
something like that, and am still looking for a mux.

Quoted text here. Click to load it

Anything between .8 and 2V is in la-la land for TTL, and the level for CMOS
(IIRC), are 1.5 and 3V. There may be LED's out there that put me on the cusp
of conformity.

Next time you get hold of an LED and a few resistors, you might want to
build a little circuit. Just an LED, a resistor and a power source. Change
the value of the resistor and measure the voltage across the LED. You'll
find that the voltage across the LED changes very little, if at all, with
any amount of current you drive through the device, within reasonable
limits.

Mike



Re: LED & Resistor befuddlement
Quoted text here. Click to load it

We are not communicating somehow.  If the LED and current limit resistor
are connected to VCC and you have a 1.5 volt drop, the IO pin will be at
3.5 volts which is *well* above the required 2.0 volts for a TTL input.  

But as I said, the voltage drop across an LED or any other diode is a
function of current.  If you have a very light current, you can get the
voltage drop to anything you want.  Since CMOS inputs are typically
rated for 0.7 * VCC you will need an off state voltage on the IO pin of
3.5 volts min to see a one and show the LED is connected.  Until someone
shows me otherwise with a IV curve, I expect you can reach that voltage
with a 1 MOhm pulldown.  


Quoted text here. Click to load it

The mux can be either a digital mux with inputs and outputs, or you can
use an analog switch type mux.  If you use an analog switch, you can get
away with just one sense circuit, but then I may not understand what the
mux is doing.  Can't you use your outputs as OC drivers and also inputs
and do without the mux?


Quoted text here. Click to load it

You are thinking of an LED that is connected to ground.  Connect it to
VCC instead and you get 3 to 3.5 volts in the pulled up state with a
stiff pulldown resistor.  Use a (very) light pulldown and you will get a
higher voltage.  


Quoted text here. Click to load it

What do you call "reasonable limits"?  What voltage do you get with 4 uA
vs. 4 mA?  If you think a diode is a constant voltage device, you need
to go back to your textbooks.  All diodes that I work with have a
logarithmic IV curve.  

I think the real problem here is that you are not following what I am
proposing.  Check the circuit that I drew again.  You will see that the
IO pin will not see .8 to 2 volts.  It will either be ground when the
LED is turned on, or some high voltage determined by the VCC minus LED
voltage with an appropriately low test current.  

--

Rick "rickman" Collins

snipped-for-privacy@XYarius.com
We've slightly trimmed the long signature. Click to see the full one.
Re: LED & Resistor befuddlement

Quoted text here. Click to load it

I am slightly lysdexic and, oddly enough, a visual thinker. This ASCII art
stuff really throws me for a loop. Any chance you could email me a .gif? My
email address is snipped-for-privacy@miketurcoisamillionaire.com , minus the part about 'is
a millionaire'.

Thanks,

Mike



Site Timeline