## What are the use of certain resistors in an Ardiuno Circuit

nitroignika
Member
Posts: 6
Joined: August 10th, 2016, 10:34 am
State: -

### What are the use of certain resistors in an Ardiuno Circuit

So I recently went and bought an Arduino starter Kit to get my self accustomed to the Arduino Chip and the IDE. Now as I build the examples it gives me, I haven't been able to understand what the resisters coming from the LED bulbs that connected with the ground wire were doing. Can the Arduino chip only take a certain amount of voltage? Also, even in the first project, there is a wire from the output of the switch connecting to the digital pin 2. Behind that pin, there is a resistor connecting to the ground wire. Now isn't all the electricity going through the first wire? Why would you need the resistor. My book is not explaining to me very well. Please help as I would like to understand than rather blindly build something I don't understand
~nitroignika
~:33
~ABRHS 2020

killer225whale
Member
Posts: 28
Joined: November 23rd, 2009, 9:28 pm
State: -

### Re: What are the use of certain resistors in an Ardiuno Circuit

The resistor in series with the LED is usually called a "current-limiting resistor". In an LED, the current through that LED is roughly an exponential function of the voltage across the LED (once you pass the threshold voltage that turns on the LED.) So you might have a red LED with a threshold voltage of roughly 1.8V. Once you exceed 1.8V, the current will increase fairly quickly. Of course, this means that the power going through the LED will increase by quite a bit as well, and if too much power goes through the LED it will overheat and burn out. Usually LEDs have a max current rating; (10-20mA are pretty common for the cheap common LEDs.) You want to prevent the current from exceeding that, so you put a resistor in series with it. (The Arduino UNO runs off 5V; if you stick 5V across the LED only, 5V is MUCH bigger than the 1.8V threshold of the LED, and it'll draw a lot of current and burn out.) https://www.sparkfun.com/tutorials/219

For the button sensor, I'm assuming that you mean that there is switch connecting the digital pin to 5V, and a resistor between the digital pin and GND. That resistor would be called a "pull-down resistor." There's the flipped version which is a "pull-up resistor": https://learn.sparkfun.com/tutorials/pull-up-resistors. The concept is fairly the same.
The Arduino can only measure voltages, not current, so you need a circuit that can switch between 5V (HIGH) and GND (LOW). If you don't have the resistor there, then when the switch is not pressed, then your digital pin is "floating", or isn't measuring any voltage. Once you press the switch though, it is connected to 5V, which should read you a "HIGH". The floating voltage is not what you want; it is somewhat random and can give you both HIGH and LOW. Thus, you need the digital pin to be connected to GND when the switch is NOT pressed.
If you put a wire between the digital pin and GND, that might work, but what happens when you press the switch? Now you basically have a wire straight from 5V to GND, which is a short circuit. So instead, you use a resistor instead, as that limits the current when the switch is pressed, but still allows you to see GND when the switch is not pressed.

nitroignika
Member
Posts: 6
Joined: August 10th, 2016, 10:34 am
State: -

### Re: What are the use of certain resistors in an Ardiuno Circuit

killer225whale wrote:The resistor in series with the LED is usually called a "current-limiting resistor". In an LED, the current through that LED is roughly an exponential function of the voltage across the LED (once you pass the threshold voltage that turns on the LED.) So you might have a red LED with a threshold voltage of roughly 1.8V. Once you exceed 1.8V, the current will increase fairly quickly. Of course, this means that the power going through the LED will increase by quite a bit as well, and if too much power goes through the LED it will overheat and burn out. Usually LEDs have a max current rating; (10-20mA are pretty common for the cheap common LEDs.) You want to prevent the current from exceeding that, so you put a resistor in series with it. (The Arduino UNO runs off 5V; if you stick 5V across the LED only, 5V is MUCH bigger than the 1.8V threshold of the LED, and it'll draw a lot of current and burn out.) https://www.sparkfun.com/tutorials/219

For the button sensor, I'm assuming that you mean that there is switch connecting the digital pin to 5V, and a resistor between the digital pin and GND. That resistor would be called a "pull-down resistor." There's the flipped version which is a "pull-up resistor": https://learn.sparkfun.com/tutorials/pull-up-resistors. The concept is fairly the same.
The Arduino can only measure voltages, not current, so you need a circuit that can switch between 5V (HIGH) and GND (LOW). If you don't have the resistor there, then when the switch is not pressed, then your digital pin is "floating", or isn't measuring any voltage. Once you press the switch though, it is connected to 5V, which should read you a "HIGH". The floating voltage is not what you want; it is somewhat random and can give you both HIGH and LOW. Thus, you need the digital pin to be connected to GND when the switch is NOT pressed.
If you put a wire between the digital pin and GND, that might work, but what happens when you press the switch? Now you basically have a wire straight from 5V to GND, which is a short circuit. So instead, you use a resistor instead, as that limits the current when the switch is pressed, but still allows you to see GND when the switch is not pressed.

Alright, this clears up everything I didn't understand! Thanks a lot!
~nitroignika
~:33
~ABRHS 2020