Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Proper LED Circuit


  • Please log in to reply
15 replies to this topic

#1 CwbhX

CwbhX

    Advanced Member

  • Members
  • PipPipPip
  • 85 posts
  • LocationNYC

Posted 01 December 2010 - 01:45 AM

I have heard, there has to be a certain way I should wire an LED (10mm 3.5-4.0v) to the Netduino safely. If someone could help me picture what I have to put together that would be great! -Cwbh
-Cwbh

#2 Omar (OZ)

Omar (OZ)

    Advanced Member

  • Members
  • PipPipPip
  • 564 posts

Posted 01 December 2010 - 02:32 AM

I have heard, there has to be a certain way I should wire an LED (10mm 3.5-4.0v) to the Netduino safely. If someone could help me picture what I have to put together that would be great!

-Cwbh


I've hooked up one of those straight into 3.3V and an OutputPort, but I've also heard that this isn't suggested so I'll attach a schematic of what is (I'm 90% sure) a 'safe' way to do it. I personally think that unless you got a bunch of LEDs you don't have to use transistors, but I could be wrong.... I guess until you hear from Chris or another member that knows a lot about this stuff then its best to stay on the safe side?

Attached Files



#3 CwbhX

CwbhX

    Advanced Member

  • Members
  • PipPipPip
  • 85 posts
  • LocationNYC

Posted 01 December 2010 - 11:49 AM

Okay, thanks Omar! Good thing I now have experience from my last project :), so I think I can get this working... -Cwbh
-Cwbh

#4 Fred

Fred

    Advanced Member

  • Members
  • PipPipPip
  • 302 posts
  • LocationUK

Posted 01 December 2010 - 12:58 PM

In addition to the resistor limiting the current drawn from the netduino, you'll need one to limit the current flowing through the led. The value depends on the supply voltage, forward voltage of the led and the current required to illuminate it. It's not quite as simple as providing it with s certain voltage. I'm sure a quick search will provide a better explanation of the theory and formula for the resistor value than I can type on my phone keyboard.

#5 bill.french

bill.french

    Advanced Member

  • Members
  • PipPipPip
  • 260 posts
  • LocationPrinceton, NJ

Posted 01 December 2010 - 02:32 PM

Also, in addition to what Fred said, I generally like to have the "load" on the collector side of the transistor, otherwise the load gets involved in the base-emitter current, which can complicate things. So, now with an extra resistor, and the load on the collector side, a diagram:

Posted Image

I would use a 1k transistor to the base, which (using V=IR) works out to a safe 3.3ma (I=V/R, or IB = 3.3v/1000, which is .0033 amps, which is 3.3ma) current from the netduino pin, and a 220k resistor for the LED load, limiting the current to 15ma (IC = 3.3v/220) which should be safe for most leds, but possibly a little dim. (Check your LED specs)

#6 Eric Burdo

Eric Burdo

    Advanced Member

  • Members
  • PipPipPip
  • 130 posts

Posted 01 December 2010 - 02:36 PM

Color me silly... But why the transistor? Is it because you have an external power source?
~ Eric D. Burdo ~ http://brick-labs.com/

Today LED's, tomorrow, the world!!! Well, OK, maybe servos.

#7 bill.french

bill.french

    Advanced Member

  • Members
  • PipPipPip
  • 260 posts
  • LocationPrinceton, NJ

Posted 01 December 2010 - 02:41 PM

The specs of the netduino: max current: 8 mA per pin digital pins 2, 3, 7: 16 mA per pin analog pins 0-3: 2 mA per pin microcontroller max current: 200 mA total 8ma and 16ma are a little "low" for driving many LEDs.. the "standard" i remember from way back for LEDs is 21ma, but there are many different leds out there, and some are much brighter and draw much more current. So, to avoid burning out your netduino's pins, you should probably use a transistor. (certainly I and others have been driving leds directly, but...) Also, this kind of circuit is an easy way to learn about transistors, and with an added diode for safety you can drive motors, relays, etc.

#8 bill.french

bill.french

    Advanced Member

  • Members
  • PipPipPip
  • 260 posts
  • LocationPrinceton, NJ

Posted 01 December 2010 - 02:44 PM

also, i just realized, the OP was using a 10mm 3.5-4v LED, which is higher than the 3.3v of the outputs, so my circuit should probably have the collector side hooked to 5v instead of 3.3v.

#9 Eric Burdo

Eric Burdo

    Advanced Member

  • Members
  • PipPipPip
  • 130 posts

Posted 01 December 2010 - 02:54 PM

Thanks Bill... starting to make sense now. :)
~ Eric D. Burdo ~ http://brick-labs.com/

Today LED's, tomorrow, the world!!! Well, OK, maybe servos.

#10 neonsonicboy

neonsonicboy

    Member

  • Members
  • PipPip
  • 10 posts
  • LocationStaffs, UK

Posted 01 December 2010 - 03:08 PM

I just attach LEDs to a digital i/o and then a ground pin, but I still need to get a breadboard. Maybe that's not the way with a 10mm one.
neonsonicboy - betaarchive.co.uk VIP member - Netduino owner ;)
Posted Image
Follow me on Twitter! | Find me in irc.aurora-irc.eu #aniboshi [often but not always] | Also known as ntkrpamp on IRC channels | I don't post here much but I visit often.

#11 bill.french

bill.french

    Advanced Member

  • Members
  • PipPipPip
  • 260 posts
  • LocationPrinceton, NJ

Posted 01 December 2010 - 03:52 PM

I just attach LEDs to a digital i/o and then a ground pin, but I still need to get a breadboard. Maybe that's not the way with a 10mm one.


You're probably "ok" doing this, but not too many LEDs draw less than 8ma, so you are theoretically risking running outside of the specs and burning out your netduino, if you are using one of the 8ma or 16ma pins. You should probably use some kind of resistor, regardless.

#12 CwbhX

CwbhX

    Advanced Member

  • Members
  • PipPipPip
  • 85 posts
  • LocationNYC

Posted 01 December 2010 - 04:33 PM

Thanks for the diagram Bill! Though, I am using my motor project code, using PWM in D6. Doesn't turn on. I also am using a 100k Ohm resistor as I don't have a 220k at the moment. Is there a way to use an OutPutPort? What is D0? -Cwbh
-Cwbh

#13 bill.french

bill.french

    Advanced Member

  • Members
  • PipPipPip
  • 260 posts
  • LocationPrinceton, NJ

Posted 01 December 2010 - 05:21 PM

You got it working with a motor as I remember -- have you substituted the motor with an LED, now? It should work, assuming you have the LED oriented properly? I would start using any output port, such as D0, which is the most upper-right pin on the netduino. Once you get it working, then move on to PWM. I see you are in NYC, do you have a car? I'm joining a hackerspace in Highland Park, NJ, which is about 1/2 way from NYC, id be happy to get together and work on some stuff. Your previous thread: http://forums.netdui...ch__1#entry4823

#14 CwbhX

CwbhX

    Advanced Member

  • Members
  • PipPipPip
  • 85 posts
  • LocationNYC

Posted 01 December 2010 - 06:39 PM

This time I used a normal PNP transistor rather than the Darlington 120. It is about 40 Miles from my house :(. To be honest I am a student, and I'm only a few years (Soon) until I can drive. I looked at Lawrenceville school actually (I see you are in Princeton). I might join the Brooklyn one, as it seems close(er). I really like Scott's Morse Code Code, which I will probably use for this project, along with the led and other stuff :D . -Cwbh
-Cwbh

#15 bill.french

bill.french

    Advanced Member

  • Members
  • PipPipPip
  • 260 posts
  • LocationPrinceton, NJ

Posted 01 December 2010 - 07:30 PM

Well, PNP is a totally different animal. My circuit assumed the more common NPN style transistor.

From: http://www.kpsec.fre...om/trancirc.htm

Posted Image

#16 CwbhX

CwbhX

    Advanced Member

  • Members
  • PipPipPip
  • 85 posts
  • LocationNYC

Posted 01 December 2010 - 08:58 PM

Oops, that might be the problem... I will be home within 30 minutes, I should be able to work on it again there.
-Cwbh




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.