I thought that a typical LED could take a very high voltage but I thought wrong! I just put the LED onto the 5v pin on my Arduino board and it got very hot and then broke (The LED) so is it my LED or what?
your typical red led is around 2v with 20ma current, current is the key part you need to keep that in control, if you do that voltage will fall in line
You have to limit the current with a resistor; otherwise I think they can work at nearly any voltage...
You really should read up on basic electronic principles.
LEDs have both a forward voltage and forward current.
For example, a red LED might have a forward voltage of 1.8V, and a forward current of 20mA (this is just an example, every LED is different!)
You will ALWAYS need a resistor when you use LEDs! This is very important, otherwise not only will you damage the LED, but you will damage the power source too (your Arduino).
Before trying to power on your LED, use this handy LED resistor calculator. You enter the source voltage (if you're using a typical Arduino, that's 5V), the forward voltage of the LED (check the datasheet), and the forward current (again, check the datasheet). It will then tell you the required value resistor to not break things.
As a general rule, rather than calculating each time, I use 330 Ohm resistors with all of my LEDs. This is (most of the time) high enough to prevent anything from breaking.
Bare in mind that each Arduino pin can only provide +40mA at the MAX, and you should avoid sourcing more than ~30.
If you exceed this limit, that pin on the processor will stop working, and possibly damage the rest of the chip.
Thats because LED's are constant current devices and not voltage driven devices. Your question should have been how to I supply my LED with the correct amount of current. A typical LED needs 20mA of current. You basically fried the LED because you did not limit the current to the LED.
The way to calculate the resistor needed is to look at the specifications for the LED. Typically you will find the current rating (typically 20mA for standard LED's) and the forward voltage of the LED. The using Ohms law you determine the required resistance
For example 20mA (I) LED with a forward voltage drop of 2V (Vf) and a supply voltage of 5V (Vs).. formula would be R=(Vs-Vf)/I or R=(5-2)/.020
or R=3/.020 which equals 150ohm.
Now you need to determine the wattage of the resistor you need.
That formula is W=(Vs-Vf)I or W=(5-2).020 or W=3*.02 which equals .06W Then multiply that value times 2 (safety factor to prevent the resistor from running too hot... So you need a 150 ohm 1/8W resistor in series with the LED and it will be perfect.
Brilliant, thanks all for the great help, and that calculator site looks like its going to be very helpful! And I am uessing that pin 13 on the Arduino board has a built in resister as I can plug the same LED's directly into those pins and they do not blow? If this is the case, is pin 13 the only one with a built in resister? P.s My resistors are 100 Ohm's!
And I am uessing that pin 13 on the Arduino board has a built in resister as I can plug the same LED's directly into those pins and they do not blow?
That's a shockingly common misconception. Pin 13 is set up like this:
o Header
|
GND--LED--///-|
|
uC pin
You see how the resistor is parallel to the header? So it's not going to limit the current to anything you connect. You will still have to use an external resistor.
You can check the schematic here to see more accurately what I mean. "R7" is the built in resistor.
O ok, so I will make sure I always use a resister ;D
O ok, so I will make sure I always use a resister
That's always a good plan :). When in doubt, do some research or post it here, we're always willing to help out ;D!
K thanks, and yes I do like this forum as I do not feel afraid to ask so slightly dumb questions at time, where as some forums I do since I get told of so this one is great, the people are nice and helpful ;D
the only dumb questions I have seen around here came out of my mouth
;D
welcome and enjoy your stay
;D ;D ;D ;D ;D ;D
And I am guessing that pin 13 on the Arduino board has a built in resister...
That's a shockingly common misconception
That shockingly common misconception may be held by people who actually did RTFM, as I did when I was just getting started with Arduino a couple of months ago.
I bought the little book "Getting Started with Arduino" by Massimo Banzi (O'Reilly Press, 2008) and browsed through it (it's a quick read) while I was waiting for my Arduino stuff to be delivered.
In the book there is a drawing (on page 31) of an LED being plugged into an Arduino board header. The anode of the LED is shown going into the D13 position of the header, and the cathode of the LED is shown going into the GND position of the header. No series resistor.
I was disturbed by this and I was not about to plug an LED directly between a processor pin and GND, so I did a little further reading on the arduino.cc web site.
Note that the book talks about two Arduino boards: the NG and the Duemilanove. The cover shows a line drawing of a board marked Duemilanove. There are drawings on both boards on page 21. They look pretty much the same except for the orientation of one of the chips and relative positions of a couple of other components (they are line drawings and don't show any fine details). There are no actual schematics of the boards in the book.
The drawing on page 31 (with the LED going directly into the header) is a "close up" of the header area and does not identify the board.
Now, reading the descriptions on the web site (and looking at schematics), I see that the NG board, indeed, does have a total of 940 ohms resistance between the ATmega chip and the header, so plugging the LED between header pin D13 and header pin GND works just fine.
This does not work just fine on the Duemilanove, since there is no resistor.
Obviously, (well, now it is obvious) the picture on page 31 is for an NG board, not a Duemilanove. The book does not mention anything about this.
Maybe this subject has been covered on this forum some time in the past; I haven't really wanted to go back over all of the hundred thousand or so past posts to look it up. That's why I bought the book.
Bottom line: I can see where people with little or no background in electronics (a significant percentage of the intended Arduino target audience, I'm thinking) might think it's OK to connect an LED without a series resistor.
Regards,
Dave
Well my first start in the Arduino world was through a book I bought called, Making Things Talk, by O'reilly. The book is very nicely laid out and easy to understand, but the first project in the book is a simple "hello world" blink project.
The blink project on page 39 tells you to first purchase a Arduino Mini (Duemilanove) and to plug an LED directly into the ground pin and pin 13 and to then upload the code and away you go.
Since I was just getting started with Arduino, I thought nothing of it and carried on as normal, and then from that project continued to add LED on my own and blow a few, but I now know that I should not have done this without resistors in place. Maybe this beginners book should have mentioned more about the resistors before hand :-/
Arduino Mini
Like the NG board, the schematics on the Mini show a resistor (1 K Ohms) between the ATmega pin and the D13 position on the header. So: It's safe to connect an LED directly between the D13 position on the header and GND on the Mini as well as the NG (but not the Duemilanove). Is is not safe to connect an LED without a series resistor for anything other than D13 on any of these boards.
Of course, I have to ask:
Who would know to look for such a thing before proceeding with other Arduino projects?
Answer: People who aren't electronics beginners. That's who.
Maybe this beginners book should have mentioned more about the resistors before hand.
Indeed.
Regards,
Dave
Something I find curious is why people who are beginners with electronics think that microcontrollers are the place to start?
I first really learned electronics from a tech school here in Phoenix, Arizona; we didn't use microcontrollers, but we did do interfacing with computer buses, which is virtually the same thing (albeit a more expensive issue if you -don't- use resistors on your LEDs; actually, there was usually a buffer IC used somewhere in there).
However, we didn't start with interfacing; our first few weeks was spent mainly reading and understand voltage, resistance, current, and Ohm's Law; then we got to assemble a multi-meter (analog - we learned on analog Simpson meters, and only later got to use digital bench meters). Things scaled from there.
We didn't do anything with digital interfacing until about 6 months into the year-long course; at that point we started playing with interfacing using the ISA bus (8255 cards and such); then three months after that, interfacing with the bus on an Amiga (at the time, the Motorola 68000 series was the "controller" of choice in industry, from what I understand).
We certainly didn't start there, though. Now, I understand that a microcontroller and its cost are nothing like a full computer or microprocessor; certainly if you "blow something up" on the microcontroller, its not the end of the world. However, if you do it often enough, not understanding the principles - unless you are really determined and have some cash (because dead microcontrollers do add up in costs) - you're going to get frustrated and move on...
So, why aren't we encouraging beginners to flash LEDs using cheap parts (ie, discrete transistors and/or 555 timers), where they can "blow things up" without worrying about costs so much - and also where they can learn the basics of electronics that can then be applied to later and more complex projects?
I know some people will have the "knack", or will be able to struggle through no matter the cost or time needed; these individuals would succeed no matter what the path. There are others, though, who struggle because of the costs, and the lack of understanding, who still want to learn, but can't afford to make the same mistakes as they learn. So - why does the community (hobbyist electronics) continue to push the concept (not directly) that microcontrollers are easy and anyone can get them to work - when the truth is much different?
I can't tell you the number of times I have seen people on this forum (and others) who seem to think a microcontroller (or transistor, or voltage regulator, or...{insert your part here}) is a magic "plug-n-play" box, akin to Lego (indeed, sometimes I wonder if this is where some of the attitude and ideas come from!). Without the understanding of what is actually going on, these people likely will end up frustrated, surrounded by a bunch of burnt-out parts (literally burning their money!).
I think a better solution is needed; I think the Arduino community could come up with it. Perhaps a tiered online learning scheme, with sections that start with the basics (Ohm's Law, using your multimeter, how to solder), and advance up the tiers until you get to microcontroller interfacing. There ultimately also needs to be a "real FAQ" document or system, that details all the little quirks and such, and what they mean, or how to do certain things, etc - those items that we seem to answer here every day, over and over and over (and over!)...
/rant over
I think this is about the best online learning site I've seen.
I definitely don't have lots of money, but I do however only seem to learn from doing and not reading, and also making expensive mistakes is not always that bad as it often means that you will never make the same mistake again.
The reason I was interested in Arduino and micro controllers is because I am currently on a 2 year ICT national diploma course at College and part of the course is to learn the basics of C+ programming. Since I completed those lessons with flying colours and enjoyed them so much, I wanted to move onto something else involving programming. And as for the electronics, well that's just an added bonus since I love electronics and hands on stuff. I personally don't think I am doing to bad for a 17 year old
I personally don't think I am doing to bad for a 17 year old
Not too bad :). Everyone has to learn somewhere. I'm 16, and I struggled a bit at first, but now I'm doing pretty well (at least I think so :P).
I did start with some general electronics rather than Microcontrollers though, and just now tried out some 555 timers (and am baffled by the complex formulas for frequency, duration, etc.)!
your definitely not doing bad for 16! And yes that does sounds a little baffling lol ;D