Go Down

Topic: Doubt on Simple Arduino Circuit (Read 837 times) previous topic - next topic

Subin Sebastian

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.


James C4S

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/
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com


JimboZA

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 )
Roy from ITCrowd: Have you tried turning it off an on again?
I'm on LinkedIn: http://www.linkedin.com/in/jimbrownza

Grumpy_Mike

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.

Subin Sebastian

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.

Grumpy_Mike

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.

JimboZA

Yeah a couple of hundred ohms should do the trick.... but the Arduino would have a built-in led on 13 anyway, no?
Roy from ITCrowd: Have you tried turning it off an on again?
I'm on LinkedIn: http://www.linkedin.com/in/jimbrownza

Subin Sebastian

#8
Jul 09, 2012, 07:16 pm Last Edit: Jul 23, 2012, 05:10 pm by subinsebastien Reason: 1
Okey Mike.
@Jimbo, Yeah it does have one LED on the board for 13. However I was following the circuit from that book.

Go Up
 

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.
Name:
Email:

shortcuts: alt+s submit/post or alt+p preview