FezCNC

it sure could.

To slow down the transitions you could always use a capacitor - forming a simple RC filter.

Another easy way to make sure it’s not the vibration is to disconnect the switches :slight_smile:

@ Brett, so that would be just a 47uf capacitor across the switch and GND right?

That is way too big. You need 100nF or there about. Are you sure you enabled the pullup on the pin?

You might be better off to add a 10K pullup resistor beterrn every switch pin and 3V3.

@ Errorl, yes I’m sure I enabled the pull up. 100nF or a 10K pull up?

Both… :slight_smile:

The pullup helps immunity against noise.

The 100nf helps block noise.

For my own electronic learning: Would a larger capacitor (like the 47uF mentioned) cause problems? Or is it just overkill for this application?

The capacitor and pullup resistor forms a RC filter. The time constant is proportional to the capacitor size and proportional to the resistor size.

This just means that the RC filter adds a delay to the circuit, the larger the capacitor, the longer the delay, the larger the resistor the larger the delay.

For a 47uf capacitor you will have to make the resistor REALLY small, 10 to 100 ohms, to get a decent response time.

If I did the math correctly then a 10k resistor and a 100nf resistor filters the same as a 21 ohm resistor and a 47uf capacitor. The problem is that the 21 ohm resistor will draw 157mA when the switch is closed, which is a problem.

Edit:
Looked at the formulas again, R is proportional, not inverse proportional…

2 Likes

Thanks for the info!!

Do you have a good link explaining the maths behind this?

Ohm’s Law

@ Architect -

I believe he is asking about RC timing calculations.

http://www.bowdenshobbycircuits.info/rc.htm

Correct

Thanks Architect & Mike!

Never hurts to have handy Ohm’s Law calculator close :wink:

Wikipedia also has a big writeup

BTW, the time constant is R * C.

So we’re basically building it like shown in the drawing?

EDIT: Oops, changed the diagram to have the cap in parallel

Not quite. Will do drawing now…

This must be repeated for every switch…

@ Errol, what does a 100nF cap look like? I’m at a loss; it’s been a very long time :frowning:

@ kurtnelle - From the picture you got some caps and diodes. But the cap you are looking for should say 104 on it. I would say the ones you have on the right side in the picture.

I’ve found 2 thanks Michael (I also found the packaging there were in) This means I only have 2. I have 103s though.

Those are 10nF