Arduino Forum

Using Arduino => General Electronics => Topic started by: TheAliw1 on Sep 01, 2019, 10:40 pm

Title: Resistor needed?
Post by: TheAliw1 on Sep 01, 2019, 10:40 pm
Hi everyone,

I am new to electronics and just wanted to make sure that I use resistors for the buttons properly in the following schematic. It raised a couple questions for me:

(https://forum.arduino.cc/index.php?action=dlattach;topic=634247.0;attach=322849)



I did not notice any weird behaviour in this circuit and it has been working really well but I wanted to make sure I use the components in my project properly  :) 
Title: Re: Resistor needed?
Post by: larryd on Sep 01, 2019, 10:47 pm
Looks good as is.



Title: Re: Resistor needed?
Post by: TheAliw1 on Sep 01, 2019, 10:57 pm
Thanks for the quick reply larryd! :)
Title: Re: Resistor needed?
Post by: jremington on Sep 01, 2019, 11:01 pm
Quote
Do I need resistors for the buttons in this arduino project?
Yes, but you can use the resistors that are built in to the Arduino, using pinMode(pin, INPUT_PULLUP).

In that case you just wire the switch from the pin to GND.
Title: Re: Resistor needed?
Post by: SteveMann on Sep 01, 2019, 11:08 pm
Do I need resistors for the buttons in this arduino project?

Yes.  The resistors bias the pin to be normally low, and the button pulls the pin high.  10K is fine.  Without thr resistor there is no guarantee what the pin level would be when the button is not pressed.

If my buttons need a resistor in series, do the potentiometers in the same project need resistors as well?

No.  The pot is connected across Vcc and Ground, and the wiper goes to the Analog input.  You can safely put any voltage from ground to Vcc on the analog input.

------
As Jremington says above, it would simplify the circuit if you use the internal pullup resistors and wire the switch from the GPIO pin to ground.
Title: Re: Resistor needed?
Post by: larryd on Sep 01, 2019, 11:32 pm
3 different switch connections:

(https://forum.arduino.cc/index.php?action=dlattach;topic=493392.0;attach=221459)



Title: Re: Resistor needed?
Post by: gilshultz on Oct 30, 2019, 02:44 am
Just a few comments, the circuit looks great.  I have learned that unless the switch contacts are gold plated they will oxidize over time and eventually fail. Many years ago several switch manufacturers determined that switches not designed for electronic use must have at least 1mA through them to keep the contacts clean. I would suggest using 4.7K resistors for this reason.  If the switches are going to be on wires larger then bread board consider using 10K resistors at the input pin to the junction of the switch and its appropriate pull resistor.  Wires become antennas and can introduce some nasty transients depending on the environment.  This will keep 200V transients from exceeding the input diode protection of the arduino. For this reason I would suggest putting the current limiting resistors for the LEDs on the port pin side. There are a lot of ways of providing protection this is fast and cheep.
Good Luck, Have Fun!
Gil