I'm just starting to discover Arduino. Currently, I've done 2 lessons from Arduino book and I have few questions about second circuit. schema of second circuit

  1. Why we need to add 10kOm resistors after wire to 2 pin?
  2. Why we need to add resistors after LED?
  3. And why 3, 5, 6, 9, 10, 11 pins with "wave" symbol?
  • 3
    I'm surprised: isn't all that explained in the book? If not, I would not recommend it! Short answers: pulldown resistor to avoid floating input;limit current flowing through the LED to avoid burning it; those are pins allowing PWM to simulate analog output, between 0 and 5V. – jfpoilpret Nov 22 '14 at 10:55

Why we need to add 10kOm resistors after wire to 2 pin?

Due to some weird electronic properties, the state of the input to the Arduino is "undefined" when there is nothing connected. When the button isn't pressed down, it is neither connected to 5V or GND; it is left floating. When floating, the input isn't reliable.

To make sure that the input always has some sort of signal, we connect it to ground. However, there is a problem with directly connecting the input to ground. When you would push the button, you would create a short circuit by allowing current to flow directly from 5V to GND without any current limiting.

The solution is to add a resistor to limit the current between 5V and GND. When the button isn't pushed, the input is grounded to allow it to read LOW. When the button is pushed, the 5V rushes in and, since the 5V doesn't use a resistor, "the 5V is stronger," making the input HIGH.

Why we need to add resistors after LED?

An overly simplified explanation: A LED will theoretically pull infinite power (as current) from your power source without a resistor. With too much power, the LED will be destroyed from heat.

Because the LED has some resistance, it will pull up to a finite amount of power, but that usually is much more than the LED can handle (and sometimes what the power supply can supply). We need a resistor there to ensure that the LED can only draw as much power as it can handle.

And why 3, 5, 6, 9, 10, 11 pins with "wave" symbol?

If you look at an Arduino board, it will say DIGITAL (PWM~). That (PWM~) means that any pins with the "~" symbol are PWM pins... pins that can turn on and off their output very fast, in this case to create an illusion that the LED is dimming because the state changes faster than the human eye can detect.

Arduino Uno http://arduino.cc/en/uploads/Main/ArduinoUnoFront240.jpg

More explanation for PWM here: Arduino docs, an answer [of mine]

| improve this answer | |
  • Can you please also explain why the resistor can be put after the LED and not before? Seems to me like full power should already have done through the LED at this point? – rejeep Jan 1 '16 at 15:27
  • @rejeep the resister after the LED is still preventing the electricity from flowing too fast throughout the circuit from the power source to the LED to the ground pin, no matter where it is in that circuit. – Anonymous Penguin Jan 1 '16 at 17:40
  • Not very intuitive IMO. For example water in a pipe would not behave the same way. Thanks! – rejeep Jan 1 '16 at 18:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.