# Doubt on Simple Arduino Circuit

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?

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

subinsebastien:
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.

subinsebastien:
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/

Thanks a lot James.

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 :0 )

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.

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.

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.

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

Okey Mike.
@Jimbo, Yeah it does have one LED on the board for 13. However I was following the circuit from that book.