Question about tutorial

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

Moderators: adafruit_support_bill, adafruit

Question about tutorial

Postby boeing_737 » Fri Mar 11, 2011 12:49 am

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
boeing_737
 
Posts: 4
Joined: Fri Mar 11, 2011 12:44 am

Re: Question about tutorial

Postby adafruit_support_bill » Fri Mar 11, 2011 6:25 am

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.
User avatar
adafruit_support_bill
 
Posts: 16617
Joined: Sat Feb 07, 2009 9:11 am

Re: Question about tutorial

Postby boeing_737 » Fri Mar 11, 2011 10:43 pm

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
boeing_737
 
Posts: 4
Joined: Fri Mar 11, 2011 12:44 am


Re: Question about tutorial

Postby boeing_737 » Sun Mar 13, 2011 7:09 am

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
boeing_737
 
Posts: 4
Joined: Fri Mar 11, 2011 12:44 am

Re: Question about tutorial

Postby adafruit_support_bill » Sun Mar 13, 2011 8:24 am

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.
User avatar
adafruit_support_bill
 
Posts: 16617
Joined: Sat Feb 07, 2009 9:11 am

Re: Question about tutorial

Postby boeing_737 » Tue Mar 22, 2011 12:14 am

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
boeing_737
 
Posts: 4
Joined: Fri Mar 11, 2011 12:44 am

Re: Question about tutorial

Postby adafruit_support_bill » Tue Mar 22, 2011 5:05 am

Both paths are effectively equivalent. The same current will flow through the resistor & led in either case.
User avatar
adafruit_support_bill
 
Posts: 16617
Joined: Sat Feb 07, 2009 9:11 am


Return to Arduino Starter Pack

Who is online

Users browsing this forum: No registered users and 2 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [114]

Raspberry Pi[82]
 
FLORA[24]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[12]
Arduino[60]
 
NETduino[14]
 
Android[6]
 
BeagleBone[23]
 
XBee[10]
More Dev Boards[30]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[39]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[9]


 
Breakout Boards[35]
LCDs & Displays[49]
Components & Parts[70]
Batteries & Power[54]
EL Wire/Tape/Panel[52]
LEDs[112]
 
Wireless[16]
Cables[66]
 
Lasers[6]
Sensors/Parts[147]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[70]
 
iDevices[13]
Tools[71]
 
Wearables[41]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[25]


 
Stickers[41]
 
Skill badges[55]
 
Books[26]
 
Circuit Playground[7]
 
Gift Certificates[4]