# Arduino Forum

## Using Arduino => General Electronics => Topic started by: gilperon on Nov 14, 2014, 10:05 pm

Title: Resistor before or after led: does it matter?
Post by: gilperon on Nov 14, 2014, 10:05 pm
i
Title: Re: Resistor before or after led: does it matter?
Post by: Genesis92 on Nov 14, 2014, 10:16 pm
no, if the resistor is in serie with the led: no problem!
Title: Re: Resistor before or after led: does it matter?
Post by: Marmotjr on Nov 14, 2014, 11:12 pm
Depends what the yellow wire is connected to........
Title: Re: Resistor before or after led: does it matter?
Post by: ih55t on Nov 15, 2014, 03:11 am
The resistor and the photo cell make a voltage divider. One side of the resistor is connected to +5v, one side of the photo cell is connected to Gnd. The opposite sides of both the photo cell and the resistor are tied together - and connected to the yellow wire. As the photo cell resistance changes, the voltage across it changes because of the resistor connected in series. If you changed where the yellow wire is, you'll be connected to +5 or Gnd. If you eliminated the resistor and connected the photo cell from +5 to Gnd, only the current through the photo cell would change. Adding the resistor to the circuit results is a change in voltage across the resistor, and across the photo cell. As the voltage across the resistor increases, the voltage across the photo cell decreases, and the inverse is true as well.  The voltage across resistor and the photo cell will always equal the supply voltage: +5 volts. Hope this helps.
Title: Re: Resistor before or after led: does it matter?
Post by: PaulRB on Nov 15, 2014, 03:53 pm
no, if the resistor is in serie with the led: no problem!
From a theory point of view, it makes no difference. However, there is sometimes a practical reason for connecting the resistor to 5V. Imagine that in a project, the led is a little way from the circuit board, perhaps mounted through the front of a case, with a pair of wires connecting the led back to the board. If one of those wires connects direct to 5V, there is a risk of a serious short circuit which could cause damage. However, if the resistor is connected to 5V, then neither of the wires to the led connects direct to 5V, so if s short circuit happens, the resistor limits the current that could flow to a low level.

The same applies when using sensors like ldr in a voltage divider. The ldr might need to be located away from the circuit board on a pair of wires. Better to have the ldr between the arduino input and ground, and the fixed resistor between 5V and the Arduino input. Again, this avoids having a wire leading away from the circuit board that connects directly to 5V.

Paul
Title: Re: Resistor before or after led: does it matter?
Post by: Genesis92 on Nov 17, 2014, 12:57 pm
I agree with PaulRB it depends of your application too :)