Sunteți pe pagina 1din 11

28/5/2015

Light-emitting Diodes (LEDs) - learn.sparkfun.com

LightemittingDiodes(LEDs)
CONTRIBUTORS:
FAVORITE

NPOOLE
2

TheBasics

LEDsareallaroundus:Inourphones,ourcarsandevenourhomes.Anytimesomethingelectronic
lightsup,theresagoodchancethatanLEDisbehindit.Theycomeinahugevarietyofsizes,shapes,
andcolors,butnomatterwhattheylookliketheyhaveonethingincommon:theyrethebaconof
electronics.Theyrewidelypurportedtomakeanyprojectbetterandtheyreoftenaddedtounlikely
things(toeveryonesdelight).
Unlikebacon,however,theyrenogoodonceyouvecookedthem.Thisguidewillhelpyouavoidany
accidentalLEDbarbecues!Firstthingsfirst,though.WhatexactlyisthisLEDthingeveryonestalking
about?
LEDs(thatselleedees)areaparticulartypeofdiodethatconvertelectricalenergyintolight.Infact,
LEDstandsforLightEmittingDiode.(Itdoeswhatitsaysonthetin!)Andthisisreflectedinthe
similaritybetweenthediodeandLEDschematicsymbols:

Inshort,LEDsareliketinylightbulbs.However,LEDsrequirealotlesspowertolightupby
comparison.Theyrealsomoreenergyefficient,sotheydonttendtogethotlikeconventionallightbulbs
do(unlessyourereallypumpingpowerintothem).Thismakesthemidealformobiledevicesandother
lowpowerapplications.Dontcountthemoutofthehighpowergame,though.HighintensityLEDs
havefoundtheirwayintoaccentlighting,spotlightsandevenautomotiveheadlights!
Areyougettingthecravingyet?ThecravingtoputLEDsoneverything?Good,stickwithusandwell
showyouhow!
https://learn.sparkfun.com/tutorials/light-emitting-diodes-leds?_ga=1.265836111.1779269414.1415981811

1/11

28/5/2015

Light-emitting Diodes (LEDs) - learn.sparkfun.com

SuggestedReading
Herearesomeothertopicsthatwillbediscussedinthistutorial.Ifyouareunfamiliarwithanyofthem,
pleasehavealookattherespectivetutorialbeforeyougoanyfurther.
WhatisElectricty?
WhatisaCircuit?
Voltage,Current,Resistance,andOhmsLaw
MetricPrefixesandSIUints
ElectricPower
Polarity
Diodes

HowtoUseThem

SoyouvecometothesensibleconclusionthatyouneedtoputLEDsoneverything.Wethoughtyoud
comearound.Letsgoovertherulebook:

1)PolarityMatters
Inelectronics,polarityindicateswhetheracircuitcomponentissymmetricornot.LEDs,beingdiodes,
willonlyallowcurrenttoflowinonedirection.Andwhentheresnocurrentflow,theresnolight.Luckily,
thisalsomeansthatyoucantbreakanLEDbypluggingitinbackwards.Rather,itjustwontwork.

https://learn.sparkfun.com/tutorials/light-emitting-diodes-leds?_ga=1.265836111.1779269414.1415981811

2/11

28/5/2015

Light-emitting Diodes (LEDs) - learn.sparkfun.com

ThepositivesideoftheLEDiscalledtheanodeandismarkedbyhavingalongerlead,orleg.The
other,negativesideoftheLEDiscalledthecathode.Currentflowsfromtheanodetothecathode
andnevertheoppositedirection.AreversedLEDcankeepanentirecircuitfromoperatingproperlyby
blockingcurrentflow.SodontfreakoutifaddinganLEDbreaksyourcircuit.Tryflippingitaround.

2)MoarCurrentEqualsMoarLight
ThebrightnessofanLEDisdirectlydependentonhowmuchcurrentitdraws.Thatmeanstwothings.
ThefirstbeingthatsuperbrightLEDsdrainbatteriesmorequickly,becausetheextrabrightnesscomes
fromtheextrapowerbeingused.ThesecondisthatyoucancontrolthebrightnessofanLEDby
controllingtheamountofcurrentacrossit.But,settingthemoodisnttheonlyreasontocutbackyour
current.

3)ThereisSuchaThingasTooMuchPower
IfyouconnectanLEDdirectlytoacurrentsourceitwilltrytodissipateasmuchpowerasitsallowedto
draw,and,likethetragicheroesofolde,itwilldestroyitself.Thatswhyitsimportanttolimittheamount
ofcurrentflowingacrosstheLED.
Forthis,weemployresistors.ResistorslimittheflowofelectronsinthecircuitandprotecttheLEDfrom
tryingtodrawtoomuchcurrent.Dontworry,itonlytakesalittlebasicmathtodeterminethebest
resistorvaluetouse.Youcanfindoutallaboutitinourresistortutorial!
Dontletallofthismathscareyou,itsactuallyprettyhardtomessthingsuptoobadly.Inthenext
section,wellgooverhowtomakeanLEDcircuitwithoutgettingyourcalculator.

LEDsWithoutMath
Beforewetalkabouthowtoreadadatasheet,letshookupsomeLEDs.Afterall,thisisanLED
tutorial,notareadingtutorial.
Itsalsonotamathtutorial,sowellgiveyouafewrulesofthumbforgettingLEDsupandrunning.As
youveprobablyputtogetherfromtheinfointhelastsection,youllneedabattery,aresistorandan
LED.Wereusingabatteryasourpowersource,becausetheyreeasytofindandtheycantsupplya
dangerousamountofcurrent.
ThebasictemplateforanLEDcircuitisprettysimple,justconnectyourbattery,resistorandLEDin
series.Likethis:
https://learn.sparkfun.com/tutorials/light-emitting-diodes-leds?_ga=1.265836111.1779269414.1415981811

3/11

28/5/2015

Light-emitting Diodes (LEDs) - learn.sparkfun.com

AgoodresistorvalueformostLEDsis330Ohms.Youcanusetheinformationfromthelastsectionto
helpyoudeterminetheexactvalueyouneed,butthisisLEDswithoutmathSo,startbypoppinga
330Ohmresistorintotheabovecircuitandseewhathappens.
Theinterestingthingaboutresistorsisthattheylldissipateextrapowerasheat,soifyouhavea
resistorthatsgettingwarm,youprobablyneedtogowithasmallerresistance.Ifyourresistoristoo
small,however,youruntheriskofburningouttheLED!GiventhatyouhaveahandfulofLEDsand
resistorstoplaywith,heresaflowcharttohelpyoudesignyourLEDcircuitbytrialanderror:

https://learn.sparkfun.com/tutorials/light-emitting-diodes-leds?_ga=1.265836111.1779269414.1415981811

4/11

28/5/2015

Light-emitting Diodes (LEDs) - learn.sparkfun.com

AnotherwaytolightupanLEDistojustconnectittoacoincellbattery!Sincethecoincellcantsource
enoughcurrenttodamagetheLED,youcanconnectthemdirectlytogether!JustpushaCR2032coin
cellbetweentheleadsoftheLED.ThelonglegoftheLEDshouldbetouchingthesideofthebattery
markedwitha+.Nowyoucanwrapsometapearoundthewholething,addamagnet,andstickitto
stuff!Yayforthrowies!

Ofcourse,ifyourenotgettinggreatresultswiththetrialanderrorapproach,youcanalwaysgetout
yourcalculatorandmathitup.Dontworry,itsnothardtocalculatethebestresistorvalueforyour
circuit.Butbeforeyoucanfigureouttheoptimalresistorvalue,youllneedtofindtheoptimalcurrentfor
yourLED.Forthatwellneedtoreporttothedatasheet

GettheDetails
DontgoplugginganystrangeLEDsintoyourcircuits,thatsjustnothealthy.Gettoknowthemfirst.
Andhowbetterthantoreadthedatasheet.
AsanexamplewellperusethedatasheetforourBasicRed5mmLED.

LEDCurrent
Startingatthetopandmakingourwaydown,thefirstthingweencounteristhischarmingtable:

Ah,yes,butwhatdoesitallmean?
ThefirstrowinthetableindicateshowmuchcurrentyourLEDwillbeabletohandlecontinuously.In
thiscase,youcangiveit20mAorless,anditwillshineitsbrightestat20mA.Thesecondrowtellsus
whatthemaximumpeakcurrentshouldbeforshortbursts.ThisLEDcanhandleshortbumpsto30mA,
butyoudontwanttosustainthatcurrentfortoolong.Thisdatasheetisevenhelpfulenoughtosuggest
astablecurrentrange(inthethirdrowfromthetop)of1618mA.Thatsagoodtargetnumbertohelp
youmaketheresistorcalculationswetalkedabout.

https://learn.sparkfun.com/tutorials/light-emitting-diodes-leds?_ga=1.265836111.1779269414.1415981811

5/11

28/5/2015

Light-emitting Diodes (LEDs) - learn.sparkfun.com

Thefollowingfewrowsareoflessimportanceforthepurposesofthistutorial.Thereversevoltageisa
diodepropertythatyoushouldnthavetoworryaboutinmostcases.Thepowerdissipationisthe
amountofpowerinmilliWattsthattheLEDcanusebeforetakingdamage.Thisshouldworkitselfout
aslongasyoukeeptheLEDwithinitssuggestedvoltageandcurrentratings.

LEDVoltage
LetsseewhatotherkindsoftablestheyveputinhereAh!

Thisisausefullittletable!ThefirstrowtellsuswhattheforwardvoltagedropacrosstheLEDwillbe.
ForwardvoltageisatermthatwillcomeupalotwhenworkingwithLEDs.Thisnumberwillhelpyou
decidehowmuchvoltageyourcircuitwillneedtosupplytotheLED.IfyouhavemorethanoneLED
connectedtoasinglepowersource,thesenumbersarereallyimportantbecausetheforwardvoltageof
alloftheLEDsaddedtogethercantexceedthesupplyvoltage.Welltalkaboutthismoreindepthlater
inthedelvingdeepersectionofthistutorial.

LEDWavelength
Thesecondrowonthistabletellsusthewavelengthofthelight.Wavelengthisbasicallyaveryprecise
wayofexplainingwhatcolorthelightis.Theremaybesomevariationinthisnumbersothetablegives
usaminimumandamaximum.Inthiscaseits620to625nm,whichisjustatthelowerredendofthe
spectrum(620to750nm).Again,wellgooverwavelengthinmoredetailinthedelvingdeepersection.

LEDBrightness
Thelastrow(labeledLuminousIntensity)isameasureofhowbrighttheLEDcanget.Theunitmcd,
ormillicandela,isastandardunitformeasuringtheintensityofalightsource.ThisLEDhasan
maximumintensityof200mcd,whichmeansitsjustbrightenoughtogetyourattentionbutnotquite
flashlightbright.At200mcd,thisLEDwouldmakeagoodindicator.

ViewingAngle

Next,wevegotthisfanshapedgraphthatrepresentstheviewingangleoftheLED.Differentstylesof
LEDswillincorporatelensesandreflectorstoeitherconcentratemostofthelightinoneplaceorspread
itaswidelyaspossible.SomeLEDsarelikefloodlightsthatpumpoutphotonsineverydirection
Othersaresodirectionalthatyoucanttelltheyreonunlessyourelookingstraightatthem.Toreadthe
graph,imaginetheLEDisstandinguprightunderneathit.Thespokesonthegraphrepresentthe
viewingangle.Thecircularlinesrepresenttheintensitybypercentofmaximumintensity.ThisLEDhas
aprettytightviewingangle.YoucanseethatlookingstraightdownattheLEDiswhenitsatits
https://learn.sparkfun.com/tutorials/light-emitting-diodes-leds?_ga=1.265836111.1779269414.1415981811

6/11

28/5/2015

Light-emitting Diodes (LEDs) - learn.sparkfun.com

brightest,becauseat0degreesthebluelinesintersectwiththeoutermostcircle.Togetthe50%
viewingangle,theangleatwhichthelightishalfasintense,followthe50%circlearoundthegraphuntil
itintersectstheblueline,thenfollowthenearestspokeouttoreadtheangle.ForthisLED,the50%
viewingangleisabout20degrees.

Dimensions

Finally,themechanicaldrawing.Thispicturecontainsallofthemeasurementsyoullneedtoactually
mounttheLEDinanenclosure!Noticethat,likemostLEDs,thisonehasasmallflangeatthebottom.
Thatcomesinhandywhenyouwanttomountitinapanel.Simplydrillaholetheperfectsizeforthe
bodyoftheLED,andtheflangewillkeepitfromfallingthrough!
Nowthatyouknowhowtodecipherthedatasheet,letsseewhatkindoffancyLEDsyoumight
encounterinthewild

TypesofLEDs
Congratulations,youknowthebasics!MaybeyouveevengottenyourhandsonafewLEDsand
startedlightingstuffup,thatsawesome!Howwouldyouliketostepupyourblinkygame?Letstalk
aboutmakin'itfancy.
Heresthecastofcharacters:

https://learn.sparkfun.com/tutorials/light-emitting-diodes-leds?_ga=1.265836111.1779269414.1415981811

7/11

28/5/2015

Light-emitting Diodes (LEDs) - learn.sparkfun.com

RGB(RedGreenBlue)LEDsareactuallythreeLEDsinone!Butthatdoesntmeanitcanonlymake
threecolors.Becausered,green,andbluearetheadditiveprimarycolors,youcancontroltheintensity
ofeachtocreateeverycoloroftherainbow.MostRGBLEDshavefourpins:oneforeachcoloranda
commonpin.Onsome,thecommonpinistheanode,andonothers,itsthecathode.

SomeLEDsaresmarterthanothers.TaketheflashingLED,forexample.InsidetheseLEDs,theres
actuallyanintegratedcircuitthatallowstheLEDtoblinkwithoutanyoutsidecontroller.Simplypowerit
upandwatchitgo!Thesearegreatforprojectswhereyouwantalittlebitmoreactionbutdonthave
roomforcontrolcircuitry.ThereareevenRGBflashingLEDsthatcyclethroughthousandsofcolors!

SMDLEDsarentsomuchaspecifickindofLEDbutapackagetype.Aselectronicsgetsmallerand
smaller,manufacturershavefiguredouthowtocrammorecomponentsinasmallerspace.SMD
(SurfaceMountDevice)partsaretinyversionsoftheirstandardcounterparts.SMDLEDscomein
severalsizes,fromfairlylargetosmallerthanagrainofrice!Becausetheyresosmall,andhavepads
insteadoflegs,theyrenotaseasytoworkwith,butifyouretightonspacetheymightbejustwhatthe
doctorordered.

HighPowerLEDs,frommanufacturerslikeLuxeonandCREE,arecrazybright.Generally,anLEDis
consideredHighPowerifitcandissipate1Wattormoreofpower.ThesearethefancyLEDsthatyou
findinreallyniceflashlights.Arraysofthemcanevenbebuiltforspotlightsandautomobileheadlights.
BecausetheressomuchpowerbeingpumpedthroughtheLED,theseoftenrequireheatsinks.A
heatsinkisbasicallyachunkofheatconductingmetalwithlotsofsurfaceareawhosejobistotransfer
https://learn.sparkfun.com/tutorials/light-emitting-diodes-leds?_ga=1.265836111.1779269414.1415981811

8/11

28/5/2015

Light-emitting Diodes (LEDs) - learn.sparkfun.com

asmuchwasteheatintothesurroundingairaspossible.HighPowerLEDscangeneratesomuch
wasteheatthattheylldamagethemselveswithoutpropercooling.Dontletthetermwasteheatfool
you,though,thesedevicesarestillincrediblyefficientcomparedtoconventionalbulbs.

ThereareevenLEDsthatemitlightoutsideofthenormalvisiblespectrum.YouprobablyuseInfrared
LEDseveryday,forinstance.TheyreusedinthingslikeTVremotestosendsmallpiecesof
informationintheformofinvisiblelight!Ontheoppositeendofthespectrumyoucanalsoget
UltravioletLEDs.UltravioletLEDswillmakecertainmaterialsfluoresce,justlikeablacklight!Theyre
alsousedfordisinfectingsurfaces,becausemanybacteriaaresensitivetoUVradiation.
WithfancyLEDsliketheseatyourdisposal,theresnoexcuseforleavinganythingunilluminated.
However,ifyourthirstforLEDknowledgehasntbeenslaked,thenreadon,andwellgetintothenitty
grittyonLEDs,color,andluminousintensity!

DelvingDeeper
SoyouvegraduatedfromLEDs101andyouwantmore?Oh,dontworry,wevegotmore.Letsstart
withthesciencebehindwhatmakesLEDstickerrblink.WevealreadymentionedthatLEDsarea
specialkindofdiode,butletsdelvealittledeeperintoexactlywhatthatmeans:
WhatwecallanLEDisreallytheLEDandthepackagingtogether,buttheLEDitselfisactuallytiny!Its
achipofsemiconductormaterialthatsdopedwithimpuritieswhichcreatesaboundaryforcharge
carriers.Whencurrentflowsintothesemiconductor,itjumpsfromonesideofthisboundarytothe
other,releasingenergyintheprocess.Inmostdiodesthatenergyleavesasheat,butinLEDsthat
energyisdissipatedaslight!
Thewavelengthoflight,andthereforethecolor,dependsonthetypeofsemiconductormaterialusedto
makethediode.Thatsbecausetheenergybandstructureofsemiconductorsdiffersbetweenmaterials,
sophotonsareemittedwithdifferingfrequencies.HeresatableofcommonLEDsemiconductorsby
frequency:

https://learn.sparkfun.com/tutorials/light-emitting-diodes-leds?_ga=1.265836111.1779269414.1415981811

9/11

28/5/2015

Light-emitting Diodes (LEDs) - learn.sparkfun.com

Truncatedtableofsemiconductormaterialsbycolor.ThefulltableisavailableontheWikipediaentry
forLED
Whilethewavelengthofthelightdependsonthebandgapofthesemiconductor,theintensitydepends
ontheamountofpowerbeingpushedthroughthediode.Wetalkedaboutluminousintensityalittlebit
inaprevioussection,buttheresmoretoitthanjustputtinganumberonhowbrightsomethinglooks.
Theunitformeasuringluminousintensityiscalledthecandela,althoughwhenyouretalkingaboutthe
intensityofasingleLEDyoureusuallyinthemillicandelarange.Theinterestingthingaboutthisunitis
thatitisntreallyameasureoftheamountoflightenergy,butanactualmeasureofbrightness.Thisis
achievedbytakingthepoweremittedinaparticulardirectionandweightingthatnumberbythe
luminosityfunctionofthelight.Thehumaneyeismoresensitivetosomewavelengthsoflightthan
others,andtheluminosityfunctionisastandardizedmodelthataccountsforthatsensitivity.
TheluminousintesityofLEDscanrangefromthetenstothetensofthousandsofmillicandela.The
powerlightonyourTVisprobablyabout100mcd,whereasagoodflashlightmightbe20,000mcd.
Lookingstraightintoanythingbrighterthanafewthousandmillicandelacanbepainfuldonttryit.

ForwardVoltageDrop
Oh,IalsopromisedthatwedtalkabouttheconceptofForwardVoltageDrop.Rememberwhenwe
werelookingatthedatasheetandImentionedthattheForwardVoltageofallofyourLEDsadded
togethercantexceedyoursystemvoltage?Thisisbecauseeverycomponentinyourcircuithasto
sharethevoltage,andtheamountofvoltagethateverypartusestogetherwillalwaysequaltheamount
thatsavailable.ThisiscalledKirchhoffsVoltageLaw.Soifyouhavea5Vpowersupplyandeachof
yourLEDshaveaforwardvoltagedropof2.4Vthenyoucantpowermorethantwoatatime.
KirchhoffsLawsalsocomeinhandywhenyouwanttoapproximatethevoltageacrossagivenpart
basedontheForwardVoltageofotherparts.Forinstance,intheexampleIjustgavetheresa5V
supplyand2LEDswitha2.4VForwardVoltageDropeach.Ofcoursewewouldwanttoincludea
currentlimitingresistor,right?Howwouldyoufindoutthevoltageacrossthatresistor?Itseasy:
https://learn.sparkfun.com/tutorials/light-emitting-diodes-leds?_ga=1.265836111.1779269414.1415981811

10/11

28/5/2015

Light-emitting Diodes (LEDs) - learn.sparkfun.com

5(SystemVoltage)=2.4(LED1)+2.4(LED2)+Resistor
5=4.8+Resistor
Resistor=54.8
Resistor=0.2
Sothereis.2Vacrosstheresistor!Thisisasimplifiedexampleanditisntalwaysthiseasy,but
hopefullythisgivesyouanideaofwhyForwardVoltageDropisimportant.Usingthevoltagenumber
youderivefromKirchhoffsLawsyoucanalsodothingslikedeterminethecurrentacrossacomponent
usingOhmsLaw.Inshort,youwantyoursystemvoltageequaltotheexpectedforwardvoltageof
yourcombinedcircuitcomponents.

ResourcesandGoingFurther
Youvemadeit!Youknow,like,almosteverythingaboutLEDs.NowgoforthandputLEDson
whateveryouplease!
IfyoudliketolearnmoreaboutsomeLEDrelatedtopics,visittheseothertutorials:
Light
IRCommunication
RGBPanelHookupGuide
DasBlinkenTopHat
LEDDisplayDriverHookupGuide
InteractiveHangingLEDArrayCreateagiantLEDarraydrivenbytheArduinoProMini.
AndnowadramaticreenactmentofanLEDbeingoverpoweredandburningitselfout:

Yeahitsnotspectacular.

https://learn.sparkfun.com/tutorials/light-emitting-diodes-leds?_ga=1.265836111.1779269414.1415981811

11/11

S-ar putea să vă placă și