Help.. Digitalread not stable from some buttons (with internal Pull-Up)

I'm using Teensy 3.6 on a custom PCB as a midi controller, using 8 CD74HC4067SM96 Multiplexers
Daisy chained (4 and 4), so 2 analog and 2 digital in each chain.
I have a about 26 tactile push buttons on the PCB, all working fine, I created JST connection on board to connect external arcade buttons.
When an arcade button is connected it's value from the MUX is floating, randomly or I'm my hand are near the button or near the wire without clicking it.
I'm using the Internal pull-up resistor, this specific multiplexer is connected as shown in the attached schematic. - I don't have any issue with other buttons on this PCB which are connected to the same multiplexer, only with external wired buttons.. If I'm disconnecting the Button JST connector from the PCB the values are never changed and stable.
It looks like some interference related to the wires, the wires are short and about 24AWG, I can't seem to find the problem and need this thing to be stable urgently.

As I used almost all pins on the Teensy, this multiplexer signal line (M6) is connected to pin 13 with internal pull-up resistor on the Teensy 3.6 (which has an internal led on this GPIO).

Each external button is connected to GND and to a MUX pin (with internal pull up as I said).

Any idea please ?


Try with stronger pullup resistors (~1K)

Hi, I will try...but what could cause the on board buttons to work correctly and the wired buttons to behave like this? does these short wires adds a significant resistance that can cause the digitalRead values to float ?

Weak pullups are weak. They won't be good enough against EMI from long wires coming in from distant switches. They are probably good enough for signals local the PCB hosting the microcontroller.

Its nothing to do with resistance, everything to do with stray capacitance, stray inductance, and capacitive or inductive coupling to nearby high speed signals or mains transients. A nearby logic signal can switch at speeds measured in kV/µs, and a few pF of stray capacitance is enough to pick this up.

Good layout will reduce the sensitivity of wiring to pickup (every signal should ideally be in a twisted pair with a ground wire).

Poor layout (ie spaghetti wiring) will easily pickup EMI like this, especially if large area ground loops are present.

Even 3pF has an impedance of a few k ohms at the clock speed of an Arduino Uno, so the stray impedances actually dominate at these frequencies.

The wires are short, about 30cm max...
Should I add an external pull up resistor between the switch signal and VCC? 10k should do ?

Use a strong pullup, 2k2 or so, to be sure.
30cm (if not a twisted pair) may act as a large magnetic loop antenna!)

I have a prototype of this product, all connected with wires (buttons, pots and everything).
Only the MUXes are on a small custom PCB with the microcontroller, never had a problem like this... but I understand what you mean.

So basically if I will design the big PCB again should I go for external pullup resistors even for the onboard push buttons ? should I be worried that the current onboard buttons can float as well ?

On board connections use the groundplane as return so no big loop areas to worry about - assuming the PCB layout isn't crazy crazy.

On the other hand, or is the same one? resistors are cheap and can provide a known consistent pullup force.

I know internal pullups work, but I've been using external resistors out of habit developed before internal were much available.


Tried with 2.2k and it is stable but if I’m touching the button conductor I get a change some floating values , is it normal or should I use other value for the resistor ?

Can you please post some images of your project so we can see your component layout?

Thanks.. Tom.. :smiley: :+1: :coffee: :australia:

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