Resistors

I have just started with electronics and most tutorials and posts on this forum have used resistors a lot. What I don't get is how to know what kind of resistor you need for your project and when they are used.

Thanks!

That depends on your project.

But what are they used for?

Edit: also what is a pull up ad a pull down resistor?

Resistors are used for many things. They can be used in conjunction with Ohm's Law to create voltage drops, or limit current, etc. With a capacitor they form a filter, or a circuit with a time constant. In pairs they can be a potential divider. They can be pull-up, or pull-down on inputs, or communication lines. They can be used in RF circuits for impedance matching, or termination of communication lines.

In short, there are many applications where resistors are used.

They resist the flow of current.

A pullup pulls a point in a circuit towards (usually) the positive supply voltage.

I'll leave you to figure what a pulldown does.

Thanks! I have never really done electronics like this before. The only thing like this I have used is mindstorms which is really basic.

I disagree; Mindstorms is incredibly complex.
The clever bit is that the complexity is hidden, and you don't have to worry about it.

Resistors are used to resist current flow.
With an LED for example, they are used to limit the current flowing thru the LED to prevent damaging the LED, or the Arduino pin that is trying to source current into the LED from 5V, or to sink current thru the LED.

So if the Arduino pin is trying to drive an output pin to 5V, it will connect an internal transistor from 5V to the output pin, and will drive out as much current as the transistor can take until it burns out.

LEDs have a known voltage drop across the anode to cathode when turned on, typically ~2V for a Red LED. With less than 2V, the LED will not turn on, and above 2V they turn on and will conduct all the current you care to supply it until it burns up. So we use resistor to limit that current.

So if we take that 5V, and drop 2V across the LED, that leaves 3V to drop across the resistor.
Knowing there will be 3V across the resistor, Ohms Law can be used to determine how much current can flow.

Voltage = Current * Resistance, or more commonly V = I*R, mathematically this is also V/I = R and V/R = I
3V = I * R, rearrange this to 3V/I = R
if want only 20mA to flow, the max continuous current for many LEDs, then
3V/0.02A = R needed, or 150 ohms.

In other cases, a Resistor is used to pull a floating input pin high or low.
This is seen with the 10K reset pullup resistor.
The input pins on the Atmega328 are basically open circuits, requiring miniscule amounts of current to make them change from high to low.
Thus a 10K resistor connected to 5V on one and the reset pin on the other will have very little current flow and will read as 5V.
A reset switch can then connect the pin to ground to make the pin low, and current thru the resistor will still be small - 5V/10,000 = .0005A, or 0.5mA,
and nothing is damaged.
Similarly, two resistors can be used to divide a higher voltage down to a lower voltage.
The total current flowing across two resistors in series will be (using 12V as an example):

12V --- R1 --- R2 --- Gnd.

12V/(R1 + R2), and if R1 and R2 are both 5K, 12V(5000 + 5000) = 1.2mA.
Vout at the junction of the resistors is thus V = I*R = 5000 * 0.0012 = 6V.
Say you wanted only 4.5V instead to avoid damaging your arduino input?
And say you wanted to keep the same 1.2mA?
You obviously lower one resistor and raise the other.
V=IR, 4.5V = 1.2mA * R, thus R2 = 4.5V/.0012 = 3750 phms
and R1 = 7.5/.0012 = 6250 ohm.
However, that are not 2 standard values = 3.9K and 6.2K are tho.

You can work thru the total current flow, again,
or you can do some equation subsituting and eventually come up with: Vout = Vin R2/(R1+R2)

For our examples, Vout = 12V*3900/(6200 + 3900) = 4.6V.

Those are typical uses of resistors. Current limiting and voltage control.
Current limiting has many uses, this is just 1 example.

To know which resistor you need to calculate your voltage requirements. Then use Ohms law.

OH Good, You got it too, that's pretty much what he said and you repeated it perfectly, I'm Glad you agree.

Doc