Regarding resistors and safe ampere

It's amazing that I actually had two courses about electricity and integrated circuits, and still I feel lost and confused right now. I recently (today) bought an Arduino (Dueminalove) starter kit, and now I'm trying out the basics. The biggest problem I have right now is about resistors.

The first thing I tried out was a blinking LED. Apparently the digital pin 13 has an in-built 1K resistor, so I plugged it in there. No problems.

The Arduino can output 5v and 0.04 ampere. Does this mean, when using it as output, that as long as I have at least 150 Ohm resistor I can't damage the board? For example when using a LED, if I plug it directly into a pin without a resistor, there's a chance that the LED and the Arduino might damage? Does this mean that as long as I have at least a resistor of 150 Ohm, the Arduino won't be damaged because it stays at 0.04 ampere?

And if I use a resistor with a high value, such as 400k resistor, the only thing that can happen is that he LED won't work? No damage can occur?

Right now I'm sitting with 3.43k resistors, I tried using it with the LED, and it seems to be blinking well for a couple of seconds, then I didn't have the guts to continue. Same thing with a small speaker at 8 Ohm 0.5 watt. Tried it using the 3.43k resistor (yeah I'll buy more resistors), it worked quite well.

That's it, I'll continue reading about it.

150 ohms would be pushing the arduino pins pretty hard

the datasheet of the chip says max 40ma, what it should really state is


for most dc applications yes, as long as you have suitable resistance in the ciruit it will not overload the chip and burn out a pin (whether instantly or over time)

where it starts getting tricky is with items that are inductors, solinoids, relays, motors n speakers, cause when you shut off the juice the magnetic feild backlash can generate hundreds of volts, this is taken care of by a diode tween the + and ground of the device so it can short out when traveling backwards, in the case of your little speaker and the high resistance you should be ok for experimenting

and yes if your using a larger resistor your just cutting down on how much current your allowing to pass

If you plug the LED in without a resistor it can blow the LED. But it all depends on the LED being used. You wouldn’t damage the Arduino. Also the size resistor you use will be based on the LED’s specs.

Here is a basic calculator for that.

Input the source voltage, then the forward voltage/voltage required to light the LED, and then the forward current/ current needed to light the LED. Typically a 220 Ohm resistor is more then enough for most LEDs.

If the resistor value is too high then yes the LED may not light at all. No damage whatsoever.

You wouldn't damage the Arduino.

I have to respectfully disagree with this, yes the led would probably blow before damage to the pin happened, but where is that current coming from?

Its kinda like saying "getting shot a million times in the crotch is much better than once in the face"

and while this theory can be applied to many other components (ie transistors) no one ever goes around stating that, LED's are special in the regard that everyone thinks they are magical devices

The first thing I tried out was a blinking LED. Apparently the digital pin 13 has an in-built 1K resistor, so I plugged it in there. No problems.

There is a common misconeption about Arduino pin 13 and how external LEDs one might wire to it. There is an on-board resistor and LED wired to pin 13 on a standard (and most clone) Arduino boards. However this does not limit current to anything wired externally to pin 13, such as a LED.

Pin 13 requires the same external current protection requirements that any other digital ouput pin requires. If you look at a schematic of a Arduino board (example: You will see that there is a direct connection between the Arduino pin 13 connector and the pin on the processor chip, and that the on-board series resistor/LED does not protect external components from trying to draw too much current from the processor I/O pin.

Bottom line: If you wire an external LED to pin13 you must also wire a current limiting series resistor to protect the output pin.


For noobs reading this, resistors "resist" or restrict current flow. Low values restrict less, high values restrict more. I see you applied OHMS law to determine the MAX the Arduino pin can drive... but it's the LED's perspective you need to be working from.

Typical RED LED specifications: 1.7V at Typically 20 Milliamps (usually LEDs are in the range of 10-50 Milliamps).

So with 5 Volt Logic and say roughly 20 Milliamps required by the LED = 220 or 330 ohm resistor is just fine. Using 3000 ohms is starving the LED and it won't light very well if at all.

So... get an assortment of resistor values. If you want to stock up on special values commonly needed... get 220, 330, 1K, 4.7K and 10K values.

Powering LED's with no current limiting is a sure way to watch them die. Being careless with parts in general can be costly.

Thank you for all the answers it sure is helpful. The problem with the courses in school was that we where pretty much only following schematics, it was quite braindead.

I had no idea about the usefulness of the diode when using a speaker. I'm going to buy a big pack of resistors as well.

Since I'm already asking newbie-questions I might as well keep going. What's the maximum input of analog and the digital pins? For example when using a piezo transducer which I got with the starter kit, apparently I'm supposed to use a 1M transistor. I'm not even sure how it works, since it works both ways apparently, pressure and sound?

the analog pins are more or less the same as any other pin, 5v max and can sink (take current in and eventually run it into ground) about the same max 40ma

you need a high value resistor because piezo's can generate a ton of current when active

also sound and pressure are very similar, sound is just pressure that has formed into waves

The thing I don't understand about the pressure part is how the Arduino receives signals. Since ground is connected to ground and current is connected to analog input. How does it measure the value when it's outputting on the same pin?

What's the maximum input of analog and the digital pins?

It's basically whatever the operating voltage of the processor chip is. If it's being powered by +5vdc then that is the limit for all the normal I/O pins is 5vdc and ground (+/- 1/2 volt or so). If it's running at 3.3vdc supply then that is the limit.

There are a couple of exceptions, special cases. Many of the AVR processor chips have a special high voltage programming mode where you have to pull the reset pin (only that pin) up to I think +12vdc to enter the HV programming mode.

Also all the standard I/O pins have diode clamping protection that prevents too high a positive or negative voltage from going any further into the chip, however unless you limit the current during these clamping situations the clamping diodes and pin will still be damaged. However, with a high enough series current limiting resistor you can have voltage wired to a I/O pin well above the normal Vcc limit. I saw one AVR application showing how to wire 120vac into a digital input pin for using the 60hz voltage as a timing source. The trick was that there was a very high value resistor (megohms?) used to limit the current to a safe value to protect the clamping protection diodes. This is not something one should fool with without proper understanding of the Chip's data sheet and/or application notes when using these 'unusual' methods.


Okay, thanks. One thing that is quite odd though, I'm using a 3.4k resistor and I have no problem making the LED flash. But apparently 250 ohm should be enough. There's approximately 5.5 mA going to the LED, and 10 mA to the speaker.

When dealing with LED’s you will need to know the specs of the individual LED. These specs include the forward voltage Vf drop and the max current of the LED. For a 5mm LED these are around Vf= 1.7-2.2V and 20mA max. So based on those specs you can calculate the necessary resistor value.

R = (Vcc-Vf,LED)/Imax, LED

This means the lowest value resistor you should use = your supply voltage Vcc minus the forward voltage of the LEDs (Assume the lowest voltage in the given spec range to start) all divided by the max current allowed through the LED.

If you use a higher resistor value, that will limit the current flowing through the LED and thus makeing it dimmer than tha max brightness.

If you are reading a current of 5.5ma through your circuit with 1 led connected to 5V and a series resistor of 3400ohm, your breaking ohms law. If you have a 3.4k resistor and Vf of 1.7v that means you have approx 0.1mA going through your LED. [edit]Ok your not breaking the law, you just shouldn’t be seeing the LED light up[/edit]

Unless you're trying to get the most light out of a LED, you'll find 1k is a nice safe option for both the LED and the Arduino. I've found you can get some light out of the new fangled water clear LEDs (the ones you have to wire up to see what colour they are) even with a 10k resistor on 5v. Not using a resistor, its a lottery which frys first, the LED or the output pin on the Arduino. What screws things up is that there are tutorials out there showing leds plugged straight into ground and pin 13. These were made for old model Arduinos (NG and earlier) which didn't have a built in LED, but did have a resistor wired direct to pin 13.

For example when using a LED, if I plug it directly into a pin without a resistor, there's a chance that the LED and the Arduino might damage?

No there is not a chance there is a certainty.

Please read:-

In general anything between 220R and 510R is normal for a directly driven LED.

How does it measure the value when it's outputting on the same pin?

Can you explain the confusion a bit more, it is not outputting on the same pin as it is measuring.

How does it measure the value when it's outputting on the same pin?

That's not what is happening. If you are measuring... the PIN is set up as an input... if it is "outputting", it's NOT measuring. But you CAN change PIN MODE on the fly... they work bi-directionally... just not at the exact same time.

Yeah that was a quite unspecific question. What I mean is, how the piezo transducer works when measuring pressure. For example, a potentiometer uses ground, 5v and a signal cable, and that makes perfect sense. But with a piezo transducer, there's only ground and power cable, how does that work, how does the Arduino measure the pressure?

Might as well add this question, I have a pair of 6v motors for a small car-looking thing we built in school, how do I power these best? Obviously the Arduino doesn't have a 6v output.

piezo’s generate electricity when under pressure, actually most crystals will, just at different extremes

piezo's generate electricity when under pressure

True but only when the pressure changes.

If it did generate electricity under constant pressure you would have an everlasting power source, just take a piezo and place it under a big book, .... electricity forever. :o

End of world power shortage :)


you should patent that ;)