Pages: [1]   Go Down
Author Topic: Doubt on Simple Arduino Circuit  (Read 631 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Guys,

I'm a newbie and just got started with Arduino. I have been playing around with the book Getting Started With Arduino and felt so interesting. Though I got stumbled upon an example from that book. The circuit for the particular example is shown below.



I built this circuit and it worked perfect. Though, I was curious to know what does that resistor and the wire to ground do. So I tried removing them both and I found the circuit is working fine without those two. One behavior I observed is that, I can lit the LED by touching pin 7 with my finger, if those are not present. Can someone explain me why this is all about?

Thanks in Advance.

Logged

Austin, TX
Offline Offline
Faraday Member
**
Karma: 64
Posts: 6055
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The resistor is configured as a "pull-down resistor."

Though, I was curious to know what does that resistor and the wire to ground do.
If they aren't there then what is the pin connected to when the button isn't pushed?  Nothing.  What is the digital value of nothing?  When pins are not connected to anything, they are in a "floating" state.  They actually pick up noise from the environment that will flip their value at random.

Pull-Up and Pull-Down resistors force the pin to a specific value when nothing is connected to them.

One behavior I observed is that, I can lit the LED by touching pin 7 with my finger, if those are not present.
Your body is a great antenna for this electrical noise.

Watch this videos on this page to see what it looks like when a pin is floating and when it is pulled-up (the opposite of pulled-down).
http://www.cmiyc.com/tutorials/arduino-pull-ups/
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks a lot James.
Logged

Offline Offline
Faraday Member
**
Karma: 60
Posts: 3242
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You could take the switch to ground without the resistor though.... but look at the circuit and you'll see that without that resistor, you're actually taking the positive input from the other side of the switch straight to ground as a short circuit with no load.  And that's the same as sticking the wire from the Arduino's 5V output directly into the Ground hole next to it, which will fry the thing.

(IMO, pull-up and pull-down resistors are inaptly named. It's not the resistor that's doing the pulling up or down, since you could do that with a wire and no resistor. But without the resistor it will go BOOM  smiley-mad )
Logged

Retired from Arduino.
PMs are set to ignore all.

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 514
Posts: 31541
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

That drawing shows an LED connected directly between the output pin and ground. Do not do this it will damage your arduuino. About 6 years ago pin 13 had a built in series resistor making this arrangement OK, but now it is gone. However, a lot of tutorials still contain this stupid mistake.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Jimbo, Got the point.
Thanks Mike, With a 10K resistor the LED seems to be too dim, may be I should try with other values as well.
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 514
Posts: 31541
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
With a 10K resistor the LED seems to be too dim,
It will, you need something like a 220 ohm resistor. Or 220R as they say.
Logged

Offline Offline
Faraday Member
**
Karma: 60
Posts: 3242
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah a couple of hundred ohms should do the trick.... but the Arduino would have a built-in led on 13 anyway, no?
Logged

Retired from Arduino.
PMs are set to ignore all.

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Okey Mike.
@Jimbo, Yeah it does have one LED on the board for 13. However I was following the circuit from that book.
« Last Edit: July 23, 2012, 10:10:52 am by subinsebastien » Logged

Pages: [1]   Go Up
Jump to: