Question about tutorial

For makers who have purchased an Adafruit Starter Pack, get help with the tutorials here!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
boeing_737
 
Posts: 4
Joined: Fri Mar 11, 2011 1:44 am

Question about tutorial

Post by boeing_737 »

Hi all,

I am a newbie to arduino (to electronics actually) and have been working through the adafruit tutorials. I am currently in Lesson 5 (http://www.ladyada.net/learn/arduino/lesson5.html) and am having trouble understanding this statement :
Whats this 100Ω resistor all about?
There's a 100Ω resistor we use to connect the input pin to either HIGH or LOW voltage. Why is it there? Well, lets say you accidentally set P2 to be an OUTPUT type pin, but then you connected it to 5V. If you write a LOW to the pin (0V) but its connected to HIGH (5V), you've basically caused a short circuit at that pin. This isn't very good for the pin and could damage it! The 100Ω resistor acts as a buffer, to protect the pin from short circuits.
Can someone please help with this?

Thanks a lot!,
yogesh

User avatar
adafruit_support_bill
 
Posts: 88037
Joined: Sat Feb 07, 2009 10:11 am

Re: Question about tutorial

Post by adafruit_support_bill »

The resistor is to limit the current to a safe level in case you accidently cause a short-circuit.

As the tutorial says, you can create a short circuit if you connect the pin directly to +5 and then write a LOW (0V) to it. This will cause a lot of current to flow through the pin and will damage the chip.

Having a resistor in the path limits the amount of current that can flow through the pin to a safe level.

boeing_737
 
Posts: 4
Joined: Fri Mar 11, 2011 1:44 am

Re: Question about tutorial

Post by boeing_737 »

Ah.. now i get it. If you make pin 2 an OUTPUT pin, that means you have control over what state (0v/5v) it can be set to. If you don't have a resistor, and set the pin 2 to LOW, then you've created a voltage difference of 5v which will then cause a large current in the wire. So you put the resistor in the way so that even if accidentally set the pin 2 to LOW, the large current does not reach the pin and so protects it.. is this right?

Thanks for the help!
-yogesh

User avatar
adafruit_support_bill
 
Posts: 88037
Joined: Sat Feb 07, 2009 10:11 am

Re: Question about tutorial

Post by adafruit_support_bill »

Yes :D

boeing_737
 
Posts: 4
Joined: Fri Mar 11, 2011 1:44 am

Re: Question about tutorial

Post by boeing_737 »

Thanks!
I have a slight confusion in the same tutorial with the concept of pull-down/pull-up resistors.
As far as I can understand,
- pull-down resistors give the pin a default value of 0, so that when the switch is pressed, the pin then reads 1.
- pull-up resistors give the pin a default value of 1, so that when the switch is pressed, the pin then reads 0.

Looking the partial arduino sketch in Fig 5.7, I could make out the following: +5v is the source and since the current flows from the positive to the negative/ground side, we can say the current starts from the +5v point and moves towards the 10k Ohm resistor, where there is a big voltage drop. Next, it comes to the intersection point before the RESET pin, where the current can either go towards the switch or flow to the RESET pin. If the switch is open it gives infinite resistance to the current and the current flows to the RESET pin, which then indicates 1. If the switch is closed, then if the switch presents a lesser resistance to current, the current flows through the switch to the ground, resulting in very little current flowing to the RESET pin, which then reads 0.

Is this interpretation correct? Also, what does a 1/0 at the pin mean? Is it indicative of the current that is flowing through it, or does it indicate something related to voltage, as is said in the tutorial?

Thanks a lot,
yogesh

User avatar
adafruit_support_bill
 
Posts: 88037
Joined: Sat Feb 07, 2009 10:11 am

Re: Question about tutorial

Post by adafruit_support_bill »

I think you understand the basic concept. :)
what does a 1/0 at the pin mean? Is it indicative of the current that is flowing through it, or does it indicate something related to voltage
It is voltage. When a pin is in INPUT mode, it has a "high impedence" equivalent to about a 100 megaohm resistor. In this state, very little current will actually flow through the pin.

boeing_737
 
Posts: 4
Joined: Fri Mar 11, 2011 1:44 am

Re: Question about tutorial

Post by boeing_737 »

Thanks for the reply. :)
Well, I am going through tutorial 6 now, and I am confused a bit. In tutorial 3 http://www.ladyada.net/learn/arduino/lesson3.html, we follow the following connection process : power -> resistor -> LED -> ground, while in tutorial 6 http://www.ladyada.net/learn/arduino/LEDs.html, we have : power -> LED -> resistor -> ground. Is the current flowing through the circuit is the same in each case? Which path would we choose when building a circuit? Are both paths equivalent as far as the voltages and currents the LED experiences?

Thanks,
yogesh

User avatar
adafruit_support_bill
 
Posts: 88037
Joined: Sat Feb 07, 2009 10:11 am

Re: Question about tutorial

Post by adafruit_support_bill »

Both paths are effectively equivalent. The same current will flow through the resistor & led in either case.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Starter Pack”