tags:

views:

150

answers:

2

I am a CS guy getting started with Arduino. This is probably a very basic electronics question but from going over the arduino tutorials everything is connected to the arduino with a resistor.

Well since i am following the tutorials i know what type of resistor i should use but what i do not know is why i should use one? and What type of resistor to pick i am to do something which is not covered in a tutorial.

+5  A: 

The resistor simply serves to limit the current into or out of a pin in case something goes awry. If your AVR decides to output high on a pin that something else wants low (or vice-versa), large, damaging currents can occur if not limited by some resistance. The current limit for AVRs is about 20 milliamps, and given that the voltages are usually 5V, something larger than 250 ohms "would work".

To give a margin of safety, 1-10k is a great choice; for digital signals it seldom matters unless you're into very high-speed applications (beyond the AVRs capability anyways). For analog inputs, a similar resistor would also be advisable, as the amount of current the ADC takes to sample is negligible when your resistor is in the few kilo-ohm range.

Nick T
+4  A: 

The underlying principle that you want to learn is Ohm's Law, which describes the relationship between voltage, resistance, and current in a circuit.

Joe Internet