Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Technical Discussion (http://www.chiefdelphi.com/forums/forumdisplay.php?f=22)
-   -   Turning LEDs on/off (http://www.chiefdelphi.com/forums/showthread.php?t=107229)

rsisk 07-07-2012 18:31

Turning LEDs on/off
 
I have an LED wired to the digital side car power and ground pins. I want to be able to turn it on/off programatically, but it always stays on. I am using Labview to open a digital output sand setting it to false, but the LED is always staying on.

I have the jumper on the DSC's port.

What am I ding wrong? Should the LED be wired to the ground and signal pins?

connor.worley 07-07-2012 18:36

Re: Turning LEDs on/off
 
Wiring to the signal pin sounds like it would work.

Ether 07-07-2012 19:09

Re: Turning LEDs on/off
 
Quote:

Originally Posted by rsisk (Post 1176517)
I have an LED wired to the digital side car power and ground pins. I want to be able to turn it on/off programatically, but it always stays on. I am using Labview to open a digital output sand setting it to false, but the LED is always staying on.

I have the jumper on the DSC's port.

What am I ding wrong? Should the LED be wired to the ground and signal pins?

The power stays on. Only the signal turns on/off. Whether or not the LED will illuminate when you connect it between signal and ground depends on how much current the LED requires to illuminate, and how much current the signal can source. What's the part number of the LED?



theawesome1730 07-07-2012 21:07

Re: Turning LEDs on/off
 
I think you are right when you say that you should wire to signal and ground, just don't mix up positive and negative on the LED, they make a nice pop sometimes, you can also run LEDs on spike relays if they are 12 volt

Edit: Also the signal may not carry enough current to power LEDs in which case you should use a spike

rsisk 07-07-2012 21:35

Re: Turning LEDs on/off
 
LEDs from SuperBrightLED

Qty | Product / Options | Price/ea |
================================================== ==========
12 | RL5-G7532: 5mm Green LED | $ 0.54 |
RL5-G7532: Green LED
----------------------------------------------------------

Resistors from www.MOUSER.com

299-82-RC
299-82-RC
82ohms

Assuming the flat side of the LED is the negative side.

Going to try the ground/signal setup now.... thanks

Ether 07-07-2012 21:57

Re: Turning LEDs on/off
 
Quote:

Originally Posted by rsisk (Post 1176532)
Resistors from www.MOUSER.com

Why did you select 82 ohm?



flameout 07-07-2012 22:04

Re: Turning LEDs on/off
 
Quote:

Originally Posted by theawesome1730 (Post 1176529)
don't mix up positive and negative on the LED, they make a nice pop sometimes

For anyone who reads this thread in the future:

Reversing polarity on a LED will not damage the LED (or the Digital Sidecar, for that matter) -- it will simply not night. LEDs are diodes. Feeding them too much power, however, can make them pop.

theawesome1730 07-07-2012 22:20

Re: Turning LEDs on/off
 
Quote:

Originally Posted by flameout (Post 1176536)
For anyone who reads this thread in the future:

Reversing polarity on a LED will not damage the LED

Only reason I said that is because I actually did make one pop when I wired it backwards.

And like flameout said it won't hurt the sidecar or the LED at that voltage. An LED is a diode so it only lets current through in one direction and also happens to light up.

Ether 07-07-2012 22:31

Re: Turning LEDs on/off
 
Quote:

Originally Posted by flameout (Post 1176536)
Reversing polarity on a LED will not damage the LED (or the Digital Sidecar, for that matter) -- it will simply not night.

Caution: the above is true only if driving the LED with a source whose open-circuit voltage is less than the reverse voltage which would damage the LED.

A high voltage high impedance source might work fine in the forward direction but damage the LED if polarity is reversed.



rsisk 07-07-2012 23:26

Re: Turning LEDs on/off
 
Quote:

Originally Posted by Ether (Post 1176534)
Why did you select 82 ohm?



I used the calculator linked below to determine the resistor. Forward current was 20mA, source voltage was 5v and the forward voltage was taken from the LED specs.

http://led.linear1.org/1led.wiz

When I switched to the signal tonight, there was no light when I set the DIO to true or false. When the LED is on power and ground, it comes on

Ether 08-07-2012 00:40

Re: Turning LEDs on/off
 
Quote:

Originally Posted by rsisk (Post 1176542)
When I switched to the signal tonight, there was no light when I set the DIO to true or false. When the LED is on power and ground, it comes on

Sounds to me like the output impedance of the DIO signal line is too high to provide enough current to light the LED (as mentioned in my earlier post).

Disconnect your LED circuit and put a voltmeter (a cheap $10 one will do) between signal and ground at the DIO output. Flip the DIO true/false and confirm that you are getting 5 volts and zero volts.

Now connect your LED circuit (leaving the voltmeter connected between signal and ground). My guess is that you will no longer see 5 volts. The load from the LED acting on the impedance of the signal source will drop the voltage below that necessary to provide the current to light the LED.



rsisk 08-07-2012 00:48

Re: Turning LEDs on/off
 
Quote:

Originally Posted by Ether (Post 1176554)
Sounds to me like the output impedance of the DIO signal line is too high to provide enough current to light the LED (as mentioned in my earlier post).

Disconnect your LED circuit and put a voltmeter (a cheap $10 one will do) between signal and ground at the DIO output. Flip the DIO true/false and confirm that you are getting 5 volts and zero volts.

Now connect your LED circuit (leaving the voltmeter connected between signal and ground). My guess is that you will no longer see 5 volts. The impedance of the signal source will drop the voltage below that necessary to provide the current to light the LED.



I'll check as soon as the show is over (the robot is part of the play Something's Afoot). If that is the case, what is the solution?

If I use a spike to control it, I assume I will need a different resistor to handle a 12v input? Or I run 5v throught the spike?

Ether 08-07-2012 01:00

Re: Turning LEDs on/off
 
Quote:

Originally Posted by rsisk (Post 1176555)
I'll check as soon as the show is over (the robot is part of the play Something's Afoot). If that is the case, what is the solution?

Instead of using the signal as a power source to drive the LED, you could use the signal to control a transistor which switches the DIO power line.

I'll draw a sketch and post it here in a few minutes.



rsisk 08-07-2012 01:08

Re: Turning LEDs on/off
 
Quote:

Originally Posted by Ether (Post 1176556)
Instead of using the signal as a power source to drive the LED, you could use the signal to control a transistor which switches the DIO power line.

I'll draw a sketch and post it here in a few minutes.



Very cool thanks Ether.

Ether 08-07-2012 01:19

Re: Turning LEDs on/off
 
1 Attachment(s)
Quote:

Originally Posted by Ether (Post 1176556)
I'll draw a sketch and post it here in a few minutes.

Something like this.

edit: corrected resistor value



rsisk 08-07-2012 03:46

Re: Turning LEDs on/off
 
When I buy the FET, is there anything specific I need to look for? Probably going to Radio Shack to find one tomorrow. If not available then will probably go to mouser.

EricVanWyk 08-07-2012 04:37

Re: Turning LEDs on/off
 
Quote:

Originally Posted by rsisk (Post 1176574)
When I buy the FET, is there anything specific I need to look for? Probably going to Radio Shack to find one tomorrow. If not available then will probably go to mouser.

Your application is really light load and low voltage, so most FETs will work fine. Here are the general things you look for:

Type: Your options are "N" or "P" channel. Either can be made to work, but Ether drew the schematic with an N channel. N is generally preferred because they have better electron mobility.

Vds: Maximum voltage from Drain to Source, or how much voltage you can block. You need at least 5V, but I've never seen a normal discrete FET with a Vds rating less than 5V.

Vgs: Maximum voltage from Gate to Source, or how much signal voltage you can apply. Again, most FETs can handle 5V just fine.

Vgs_thresh: Minimum voltage from Gate to Source to guarantee turning on the FET. Most FETs will be in the 1 to 3 V range, so you'll be fine.

Rds: Resistance from Drain to Source while on. Subtract this from the 82 ohm series resistor you calculated. It'll be relatively small, you can likely ignore it.

Ids: Maximum current from Drain to Source while on. It needs to be more than 20mA. Just about any FET that is big enough to be in its own package can handle this.

rsisk 08-07-2012 13:55

Re: Turning LEDs on/off
 
OK, just got back from Radio Shack trying to get the right components. The transistors were hard to match up, so I got a couple.

One is a MOSFET N-channel transistor and the other is a bag of NPN-Type transistors. I've included pictures below. My guess is the MOSFET is the closest match and where I am starting to build the circuit.

Am I correct in assuming the following:

Source - The +5V/82ohm/LED side of Ether's diagram
Drain - The ground side of the diagram
Gate - The DIO Signal/100Kohm side of the diagram

Here are the components I purchased, 100K-ohm resistors, MOSFET transistor, and NPN transistors



And the back of the MOSFET transistor and NPN transistor bag


Ether 08-07-2012 14:05

Re: Turning LEDs on/off
 
1 Attachment(s)
Quote:

Originally Posted by rsisk (Post 1176604)
Am I correct in assuming the following:

Source - The +5V/82ohm/LED side of Ether's diagram
Drain - The ground side of the diagram
Gate - The DIO Signal/100Kohm side of the diagram

No. For an N-channel MOSFET, the source is connected to ground, and the drain is connected to the load, which is connected to the power.

The gate is connected to the signal, as you said.

So in the sketch I posted earlier, the source is on the bottom of the FET, and the drain is at the top. See annotated sketch attached.



rsisk 08-07-2012 14:25

Re: Turning LEDs on/off
 
Thanks for that timely information, just starting to put this thing together.

Ether 08-07-2012 14:29

Re: Turning LEDs on/off
 
2 Attachment(s)
Quote:

Originally Posted by rsisk (Post 1176604)
Here are the components I purchased, 100K-ohm resistors, MOSFET transistor, and NPN transistors



And the back of the MOSFET transistor and NPN transistor bag


Maybe it's just my connection, but my DNS can't resolve rsisk.com:

EricVanWyk 08-07-2012 14:47

Re: Turning LEDs on/off
 
It resolves for me, that FET will work fine. It is a beefy fellow.

An easy way to figure out which way to orient a FET is to look at the arrow in its schematic symbol, as it (sort of) represents the FET's bonus parallel diode. You want this diode to oppose normal current flow, or else it will always allow it and you won't be able to turn the flow off.

In your symbol it points from the source, so you want normal current flow to go the other direction (from the drain).

Sometimes they draw the diode more explicitly, I've seen it several ways.

Ether 08-07-2012 15:08

Re: Turning LEDs on/off
 
Quote:

Originally Posted by EricVanWyk (Post 1176611)
It resolves for me...

I just ran tracert from a web server and it found it:

216.86.200.206

I'll try that...

edit: got it, using http://216.86.200.206/electronics1s.jpg weird.



DonRotolo 08-07-2012 15:20

Re: Turning LEDs on/off
 
The DSC Digital I/O does not appear to be able to sink 20 mA.
Ether's transistor switch should work fine. A FET (especially an IFF510) may be overkill, a plain NPN switching transistor will be fine.
All these parts (resistors, 2n2222 or 2n3906 transistors) are available at Radio Shack.

Ether 08-07-2012 15:26

Re: Turning LEDs on/off
 
Quote:

Originally Posted by DonRotolo (Post 1176617)
The DSC Digital I/O does not appear to be able to sink 20 mA

source (in this case) :)



Ether 08-07-2012 15:35

Re: Turning LEDs on/off
 
Quote:

Originally Posted by DonRotolo (Post 1176617)
A FET (especially an IFF510) may be overkill, a plain NPN switching transistor will be fine.

But you know, as soon as he gets that little 0.1 watt LED working, he's gonna want to swap it out for an auto headlight and run it straight off the battery.



rsisk 08-07-2012 17:12

Re: Turning LEDs on/off
 
Quote:

Originally Posted by Ether (Post 1176621)
But you know, as soon as he gets that little 0.1 watt LED working, he's gonna want to swap it out for an auto headlight and run it straight off the battery.



Mind reader!

So, I have too admit I am feeling pretty foolish, and I want to get this in the thread for accuracy, as I was working on the wiring for the circuit, I pulled up the specs on the DSC and figured out I had the LED plugged into the PWM instead of the DIO. Moving the LED to the DIO power/ground and turning in on/off via the Digital Output works just fine.

Sorry for the diversion and thanks for the info n making the switch. Now I want to try out the switch to see if I can mAke it work.

Question: why was a 100K ohm resistor used on the gate?

Ether 08-07-2012 17:31

Re: Turning LEDs on/off
 
Quote:

Originally Posted by rsisk (Post 1176630)
Question: why was a 100K ohm resistor used on the gate?

Credit for the following answer goes to Eric VanWyk:

The purpose of the 100K resistor is to dampen electrical oscillations. The gate of the FET has some capacitance. The wiring leading to the gate pin may have some inductance. Under certain circumstances, together these may form an LC oscillator. The resistance is there to prevent those oscillations. The 100K is not critical. It can probably range over an entire order of magnitude. The higher the resistance, the better the damping, but the slower the FET's response to a step input signal (because of the gate capacitance). The lower the resistance, the faster the FET responds to a step input signal, but you increase the chances of oscillations.



Ether 09-07-2012 08:51

Re: Turning LEDs on/off
 
Quote:

Originally Posted by rsisk (Post 1176604)
http://www.rsisk.com/npn.jpg

Rick, just a heads-up: be careful with the part number 276-1617 package of 15 NPN transistors.

According the the reviews here (scroll down), the package may contain PNPs instead of NPNs. And if they are NPNs, the pin labeling on the package may be wrong. Check the datasheets.

... and let us know when you get that MOSFET working.



EricVanWyk 09-07-2012 14:53

Re: Turning LEDs on/off
 
Quote:

Originally Posted by rsisk (Post 1176630)

Question: why was a 100K ohm resistor used on the gate?

100K is extremely conservative. I generally put as large an R in series as I can get away with for a given switching speed, others will put as small an R in as necessary to damp gate ringing. For reference, I'm putting ~5 ohms in gate series for a 400kHz switcher for a hobby project.

So, the PM Ether quoted explains why a resistor is necessary. The reason it is so much larger than you might expect is just to over-protect the gate. It costs the same and lets you rest a bit easier.

Ether 09-07-2012 15:44

Re: Turning LEDs on/off
 
1 Attachment(s)

While we're on the subject of series resistors for the signal line, attached is a sketch of the circuit using one of those NPN transistors you got in the package you bought (2N3904).

Can someone please check my calculation for the base resistor?

I tried to size it to saturate the transistor with a 5V signal.




All times are GMT -5. The time now is 04:32.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi