Could someone verify if I’ve drawn this schematic incorrectly? I’m also sharing an image taken from the Arduino.cc site that shows how my button is wired (and working) on my breadboard. The button is wired to an Arduino, just as it is in the photo except for the pin on the Arduino (my schematic has it going to pin F1).
I’m seeing some strange behavior in the boards I had fabricated, and I suspect it has to do with the button circuit due to the behavior I am seeing. I thought this was simple enough, but I suspect I messed up with the pins…
Thank you in advance for taking a look and for any feedback!
The pull-down resistor should be on pin 2 of the switch, such that when the switch is open it creates the default switch state. The way it’s connected here the arduino pin is left floating, the resistor-to-ground is permanently connected to the positive supply, therefore not acting as a pull-down. Additionally it would slowly drain the battery this way.
That kind of tactile switch is normally drawn as a SPST switch symbol on the schematic, no need to show the 4 pins, but when it comes to selecting a footprint for it, you pick one that has pin 1 stacked with pin 2, and pin 3 stacked with pin 4, and the right thing will happen. Somebody else encountered the same issue before:
You’re sure you couldn’t redesign the software to expect the pin to be normally high, and wire the switch to ground, so that you can use INPUT_PULLUP mode on that pin, and save yourself a resistor?
This is right now. In this symbol for the switch, pin 1 & 2 are common, connected in the switch symbol. On the Fritzing version, both commoned legs are called pin 1 and the others (3&4 here in KiCad) are pin 2.
On the question of the different resistor symbol, ANSI style resistor symbols are available for KiCad but all the default ones are IEC standard. On this github submission to add the zigzag ANSI one as default it explains the justification why - IEC is the international convention.
As per another post, in Arduino the cleaner way to do this is to change the pin type to use INPUT_PULLUP (check this reference page for what this means) and reverse the logic in your code to expect a 0/false when the switch is pressed. That would mean you can do without the resistor entirely, as you’ll use one that’s built-in.