Button with 4 contacts

Hey,

I started my first project with an Arduino, and I am now translating this into KiCad, so far does everything work as expected except the button stuff.

I have a “normal” Push button on my setup and when I click it my Arduino reads the push and compares is with the current state and toggles the state.

I have connected the button as this

Pin 1 → Signal to Arduino
Pin 2 → 10 kOhm Resistor
Pin 3 → 5V
Pin 4 → nothing or 10 kOhm Resistor.

In the scematics I selected SW-Push_Dual and as Footprint the only thing i could find that matches
Button_Switch_THT:SW_PUSH_6mm_H7.3mm.

But when I import my netlist to the PCB sections it tells me that Pin 3 and 4 do not have any connections.

Fehler: SW2 Pad 4 nicht gefunden in Button_Switch_THT:SW_PUSH_6mm_H7.3mm.
Fehler: SW2 Pad 3 nicht gefunden in Button_Switch_THT:SW_PUSH_6mm_H7.3mm.

Any Ideas on how I can fix this?

Thx in advance.

could this work?

and can i assign this footprint to it?

I think could work, but I don’t know Arduino needs.
What elements you select (with what footprint), and how you use them are rather not KiCad related question.
In your first post there is nothing I could follow your thinking.
In text you write that Pin2 → 10k and than you give a picture with Pin 2 having nothing to do with 10k.

I could tell you the answer but, I encourage you to get out a Multimeter and see what pins are connected to what when you push the button. This is a Most Basic/Fundamental task you should know.

EDIT: And, you should know that Arduino (and others) have 10k-ohm built-in and you can simply make the correct call to use it (and, thus avoid adding 10 resistors).
There are many sites, including Arduino that illustrate this. Here’s the first link that comes up when googled about 10k pullup / pulldown (quite apart from the physical aspect of the Button Switch.

hey thx,
yeah i know that 1 and 2 are connected and 3 and 4 and by pressing all four get connected together.

i wonder why none of the video on yt tell about the integrated pullup resistor.

i did my circuit with standard pulldown what is not integrated in your article. so are there any advantages or disadvantages to you pullup instead of pulldown besides the high and low parts?, because next time i‘ll use the internal pullup method instead and switch the high and low readings in the code.

I like to hide two of the pins on the symbol to keep the schematic tidy:

Hi,
Your first drawing gets a high signal to whatever Pin ‘Button_2’ is connected to but in a rather convoluted manner and it also leaves button_2 pin ‘Floating’ which is a bad practice really. your second drawing is much better and will work fine as you are now aware of software PULLUP/PULLDOWN so it’s your choice. As for pull up or pull down it really depends on the application, but personally I like a state where a pin is held at ground and then pulled high briefly to indicate a button push to the MCU again your application may differ and your switch footprint is ok too…hope this helps :smiley:
:mouse:

It depends on the chip details. In old school bipolar TTL, pullup was preferred because bipolar TTL is a current sinking technology. Now with MOS parts, it’s indifferent to pullup or pulldown as there is minuscule current involved. I still prefer pullup though, because it means that one side of the switch is grounded, and there is usually lots of ground fill available. Also if the switch is external, you are not sending the supply rail off the board where it could be shorted to ground accidentally.

However with pullup, it means that with normal logic, closing the switch creates a logic 0, so any firmware has to treat 0 as switch closed.

1 Like

Yes, and No. Pull-Up or Pull-Down is, for the most part a choice and, can depend on other factors. The standard Arduino approach when using a Resistor is to attach the Button Sw to Resistor and the Resistor is attached to GND. Activating the SW will pull the Circuit Down to GND.

But, there is no need to use the resistors, not even on a Teensy. Here’s a Teensy based Astronomy gizmo I designed a few months ago…

You could Google something like ‘Arduino pullup or pulldown’ and get something like this.
It will answer your question re Advantage…

Snippet of Code and Schematic

EDIT: And, before you ask… You may notice my code uses ‘Main’ and not the typical Arduino ‘Setup’. Using ‘C’ style coding of Main and While will eliminate the burden of much of Arduino’s overhead code, thus, a lighter-weight file. It will improve speed and performance. And, can still use many of the Arduino built-in code calls, such as INPUT_PULLUP.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.