Good morning, y'all and thank you so much for the help and guidance you guys gave me already.
Paul__B:
Very bad idea!
Particularly for the rotary encoders!
Software de-bounce is much more "solid", doing things that would take quite complex hardware.
Are your 19 pushbuttons wired in a matrix? That would be nine I/O pins (and a diode for each button) and software de-bounce will manage the entire matrix with a single piece of code (which is to say it will recognise one or more keypresses only when all buttons have ceased bouncing).
But you need to understand what proper software de-bouncing is. It is not merely waiting a certain time after a change is observed and seeing whether it is still the same.
Yes, I'm wiring the tact switches in a 4x5 matrix. I will dig more into software debounce then, when I was researching online everyone was advising to hardware debounce though.
johnerrington:
I have a page here that discusses debouncing in both hardware and software
Debouncing a LOT of inputs will be complicated either way.
I'd look at your requirements to see if its needed at all.
Eg you press a button and a process is activated. Does it matter if the switch bounces? If the same switch STOPS the process then of course it does, but a simple time out debounce would take care of that.
Please provide a link to the rotary encoders you are using. Bounce should not be an issue.
Yeah, it does look complicated lol. I'm not sure if it's "necessary", the intention is just to avoid ghosting and multiple clicks when a button is pressed just once.
This is the encoder I got:
https://www.amazon.com/Cylewet-Encoder-15×16-5-Arduino-CYT1062/dp/B06XQTHDRR/ref=sr_1_3?crid=2PP69R7EOURCC&dchild=1&keywords=ky-040+rotary+encoder&qid=1612111679&sprefix=ky-0%2Caps%2C191&sr=8-3
PerryBebbington:
I think you probably know the answer to that already, and I'm not going to say otherwise.
10k Ohms and 0μ1 should be fine.
However,
I agree with the other comments, using hardware debuncing is daft in my opinion.
Lots of people have written tutorials on this, here's mine:
Buttons and other electro-mechanical inputs (introduction) - General Electronics - Arduino Forum
Buttons and other electro-mechanical inputs (advanced) - General Electronics - Arduino Forum
Thank you so much for your insight, sir. I will consider those options!
CrossRoads:
How are the 19 switches wired up? I'd suggest a 4x5 matrix and use the Keypad.h library to read them.
Rotary Encoders need a pair of pins each, I've had good results with this Bourns filtering.
Yes, it's wired in a 4x5 matrix. Thanks for the sketch!
PerryBebbington:
CrossRoads,
You don't need to filter inputs from rotary encoders, you just need a state based way of reading them, debouncing is then inherent in the code.
This was written for a PIC and reads 4 encoders on the port specified as p (8 inputs). It has to be called once per millisecond to be reliable. Debounce is inherent in the way it works.
Very interesting! I will check on that!
I'm attaching below the sketch for my project. Two things about it:
-
I'm not sure sure if I wired everything correctly, since I based my project on other people's projects I found here / Google.
-
I'm having issues on where to place the capacitors for he matrix. Since all examples were for single switches, I'm not sure where they should be.
Thank you again for the time answering and helping me, you guys are awesome!