I am working on a project that is needing 46 keys from a computer keyboard wired to the Arduino. Some will be pushed simultaneously.I will then have the Arduino output to another component. I have read about using resistors to change the value of the switches so the Arduino recognizes them individually. I also know of wiring them in a matrix. I want to do this will as little components as possible as I want to use the keyboard case as the project case.
I am very new to Arduino and coding. I can learn the coding but I need help with wiring the switches.
Welcome to the Arduino forum.
I need to ask some questions about your project.
Where did you get a computer keyboard that has individual switches. I have not seen such a beast in at least 50 years.
Are you sure you want to do all the wiring, etc, since a perfectly good PS2 keyboard and available software will give you a real keyboard with all the capability you are asking for?
Paul
I will basically be piggy backing of the key board keys. I'm hoping the keyboard will still function as a normal keyboard while having select keys going to the Arduino while still working normally. From the Arduino it will then go to another board for other functionality. If I have to I will hand wire the keyboard instead using an already manufactured keyboard.
So in essence I want the keyboard to still function as a normal keyboard while sending signal to the arduino to then send a signal to another device. All self contained in the keyboard case no software on computer for the device controlled by the arduino
I am hoping this can be done without having to make my own pcb
You are going to have to tell us a whole lot more information about the keyboard you have. Do you have a schematic of your keyboard? What are you using the keyboard for right now? Have you removed the keyboard from the case so you have an Idea about it's construction?
Paul
I do not have a keyboard yet. I could just handwire a keyboard.
Lets just assume that I will hand wire the keyboard. Using an arduino as the communication between the keys and the computer. Can I then write some code for the arduino to use the same button input for both the actual function of the keyboard and send out a uart signal?
I know this does not answer any of the questions asked. I am still very early in the project and just trying to get some info before fully embarking on the project
Generally, that is a huge problem. Because, if the matrix has active signals on it already, applying additional signals will cause it to malfunction, and the active signals will interfere with the matrix scanning that you are trying to do.
If on the other hand you decide to build the entire circuit yourself, then as it was asked, why not just buy a keyboard?
...and.. what is "the project"?
Also, are you ready to jump right into some very complex, low level hardware interfacing code? I guess not, so what is your time frame for completion?
It will be a keyboard with speakers inside that are driven by Adafruit Audio FX Sound Board + 2x2W Amp. That will play a sound with each key press of the selected 46 keys. So the arduino will act as the HID and also send out a uart signal with the key presses to the audio board which will then play sound.
I dont have a set time frame
I will be using the Cherry mx red switches. They will be mounted to a switch plate with a small dab of hot glue to hold them. I will probably need about 20 or so wires connected to an arduino
I will not be using uart I will simply have a pin from the arduino trigger the sound board and play random sounds that are saved
Thanks for the explanation. Just in case it might be helpful to you, some Arduinos have hardware and software support for HID direct through the USB connection. Leonardo, Pro Micro and some third party boards also. There are links to the library on this site. What most people do to solve your problem, is pair it with some Keypad library.
Ok thank you for the help. I will read through some more articles. In your opinion what small for factor arduino could I use that will have enough pins for my purpose?
I will be doing research on which board will be good for my purpose
Assuming you don't need nanosecond response when you press a key, I was thinking about using 6 pieces of 8-channel multiplexer IC's
That would require 6 input pins and 3 output pins to address the multiplexer and tell it which input pin to read at that point.
So 9 pins in total to read up to 6*8=48 input pins .
Then you write a sketch that tells the 6 multiplexers to activate input pin one and you read all 6 of them. So now you know which of the first 6 keys are pressed. Then you change the multiplexer address pins to activate the second pins as inputs and read the next series of 6 keys....and you repeat this 6 more times.