I recently got my hands on an Arduino Pro Micro board and jumped straight into building.
I wanted to make a simple button box for "Sim racing".
I have 4 rows and 5 columns in the box hooked up to the board, but I seem to have messed it up with the matrix:
I attached an image of the wiring. Could you guys help me what to do to fix it?
Well everything seems to be wired in parallel… Can you please provide us maybe a rough draft of what you have in mind?
Might I suggest using 4 PISO (Parallel In, Shift Out) shift registers like the SN74HC595. You can daisy chain them together to give you a 2x 16 bit value that only uses 3 arduino pins each. Or one big 32bit value.
You could even separate the buttons and the switches to their own register and read them that way.
Oh, sorry, I forgot to mention that. I was planning to make a Buttonbox following amstudio, but I do not want rotatory buttons like in the tutorial. For what I want to achieve, I want to make this button box usable, with a bit of research I saw that I can make it like this but eventually it turned out not working as intended.
It seems like brushing up on electronic circuit fundamentals would help.
A practical resource is "Electronics Cookbook: Practical Electronic Recipes
with Arduino and Raspberry Pi" by Simon Monk. It offers clear, hands-on
tutorials for beginners and hobbyists.
I agree with others, you have not wired these buttons & switches as a matrix. They are physically arranged as a matrix of 3x7 but not wired as a matrix.
A matrix has rows and columns, and the wiring should have wires for rows and wires for columns, which your wiring does not appear to have. As someone mentioned, many seem to be simply wired in parallel, which will make it possible to detect when any button is pressed but impossible to identify which button was pressed.
I see 5 different types of switches/buttons. Please post links to the specs of each type so the forum can advise you how to wire each type.
If any of these switches are not monetary, like toggle switches for example, you will need some diodes in the matrix to prevent detecting phantom presses.
I suggest that is not necessary because the Pro Micro has enough pins to wire this matrix without extra circuitry. @benceglg is clearly a beginner and not ready for the added complexity.
To which I am compelled to (re?) iterate: each switch will have a place in the matrix, with one pole connected to a row, and its other pole connected to a column.
A single switch is read by looking at the row and column where it "lives" on the matrix. either by software you write, or quite easier by using a matrix switch library
In case it isn't obvious, the physical arrangement of the switches doesn't need to match the matrix you'd see in the schematic. It can be convenient to do, but if you want to run wires all over the place, the switches can be anywhere.
@benceglg - sry, but I laughed out loud when I saw your project. Were you following a schematic when you wired this up? If so, perhaps a side trip into learning how to read a schematic is in order.
If you were following a schematic, throw that schematic in the trash.
Yeah, after reading the comments I realised how bad I messed up.
In this setup I have 11 buttons, four 3 way switches they are toggle unfortunately (I didn’t realize it until later on) but I want it to act as a momentary switch, and for last I have three 2 way switches, which is also momentary.
Completely understandable why you laughed on it. This project is a half YouTube video and the rest is my imagination. (Also the first project where I have to solder) Now I realised that maybe a bit more research would helped me.
Also with the switch wiring, I heard that if I want the three way switches up and down state to be a different button I would have to wire it in a different column. Is that right?
If you have switches that are not momentary in nature, or you want to be able to detect multiple closed switches accurately, you will need to add diode isolation to you circuit.
This is prolly covered in any button box tutorial. It's just placing a diode in series with each switch path.
Your SPDT switches can live on the matrix; wire the common pole of the switch to a row (or column) and wire the two throws each to a unique column (or row).
As for having the wrong kind of switch, sometimes software can come to the rescue but it would probably be best to find switches that operate as you would like them to.
As I think of it, what you might want to do is not going to satisfy: a momentary pushbutton is easily coded as a push-on push-off switch. Going the other direction not so much.
Sorry for the late response, I actually did correct my wiring and everything works. Thanks for the help and all the tips I got. Also, thanks for your patience with me. Have a great day!
It would help others in the future if you showed your working code, and perhaps your working hardware schematic. Then click on the "solved" button, on the post that gave you the critical information that prompted you to find a solution.