0
\$\begingroup\$

Can someone help me with this push button?

I want to connect to an Arduino, it works fine with a small one but with this big one it conducts when press and releasing.

Momentary pushbutton

The problem is that the push button conducts when pushed and released so 1 push = 2 times conducting. So the Arduino is receiving two signals and turns on and off. I used a debounceing hardware circuit.

\$\endgroup\$
12
  • 1
    \$\begingroup\$ Welcome to the site. Please realise this is not a free design house, homework-answering service or an on-line technical encyclopedia, copied out to you on demand. People will help you take the next step if your question shows you've done as much as you possibly could on your own - which yours doesn't, I'm afraid. Please edit your question and greatly improve it, showing your work and findings so far in considerable detail with any schematic. The better the quality of your question, the better the quality of the answers you will attract. Again, a warm welcome to the site. \$\endgroup\$
    – TonyM
    Commented Nov 22, 2018 at 21:05
  • \$\begingroup\$ Yeah okay sorry... this is my first question ever i delete the question \$\endgroup\$ Commented Nov 22, 2018 at 21:09
  • \$\begingroup\$ Don't delete it - improve it :-) Put some detail in there and get yourself an answer that'll help you. The goal of the site is to teach and help. \$\endgroup\$
    – TonyM
    Commented Nov 22, 2018 at 21:11
  • \$\begingroup\$ Okay i will delete it for now and make tomorrow a schematic and all information. The problem is that the push button conducts when pushed en released so 1 push= 2 times conducting. So the arduino is receiving 2 signals and turns on and off. I used a debounceing hardware circuit. \$\endgroup\$ Commented Nov 22, 2018 at 21:13
  • 1
    \$\begingroup\$ what is small one and big one ? ............... the comment about the 2 times conducting makes no sense ............. are you sure that the pushbutton does not latch? (press once to switch on, press again to switch off) \$\endgroup\$
    – jsotola
    Commented Nov 22, 2018 at 22:29

2 Answers 2

2
\$\begingroup\$

... but the problem is that i receive 2 HIGH signals when i push and release the button.

This is the part that should have been in your question. You are describing switch contact bounce. This is common on all micro-controller switch inputs. You have two choices to fix it.

enter image description here enter image description here

Figure 1. A switch contact bounce waveform. Source: Lab-book Pages.

  1. Add a small capacitor across the switch - 100 nF would do. This will hold the voltage for a little while after the switch makes or breaks - hopefully until the contact has stopped bouncing.
  2. Do the debouncing in your program. This means that you need to check that a change of state lasts a reasonable amount of time - maybe 50 ms to 100 ms before you read it as a valid state.

There are thousands of tutorials online on this subject so I won't write a new one here. See the link for one. You can edit your question to explain any further problems you have and someone will respond.

\$\endgroup\$
0
\$\begingroup\$

Without seeing the back, I'm going to assume it's a SPDT switch, with a common pin and a normally open and a normally closed pin. As well as two pins for the led cathode and anode.

The switch pins work just like any other momentary button. Just connect the common pin and the desired action. The small switch you described is a basic normally open push button, so use just the normally open pin of the switch, ignoring the other side (as in don't connect it at all).

\$\endgroup\$
2
  • \$\begingroup\$ Okay sorry i realize that i'm giving not enough info sorry for that. I learned that i need to describe more information... I connected it as you described but the problem is that i receive 2 HIGH signals when i push and release the button... \$\endgroup\$ Commented Nov 22, 2018 at 21:19
  • \$\begingroup\$ @Randy that's a different issue called bouncing. You either need a denounce circuit or you need to look for denounce code for your input code. \$\endgroup\$
    – Passerby
    Commented Nov 22, 2018 at 21:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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