Keyboard to MIDI

Hello,
Im new to arduino and i would like to know is there way to connect pckeyboard (usb type) to arduino and then translate key strokes as midi cc, to show that device as midi device on pc (usb conncetion as midi send preferd)? Or is there any other way?

Thanks for answers in advance.

To read the USB keyboard you'll need USB host capability. I know the Arduino Zero and Due have built in USB host capability. Maybe some of the other Arduino SAMD boards do as well. The classic AVR-based Arduino boards do not have built in USB host capabilities. If you want to use one of those boards with a USB keyboard you'd need to use a USB host shield. If you can find an old PS/2 keyboards, you can read one of those directly with any Arduino board, no fancy USB host capabilities needed.

To do USB MIDI you'll need a board with native USB like the Leonardo, Micro, Pro Micro, Due, or any of the SAMD boards. It is possible to do this with one of the AVR boards that don't have native USB if they use the ATmega16U2 for their USB to TTL serial chip (not the unofficial boards with the CH340) but that's pretty advanced and I don't think it's worth the effort.

You can also do serial MIDI with any Arduino board.

Thanks for answer. So what would you recomand for like 10x10 buttons + led or just buttons?

So what would you recomand for like 10x10 buttons + led

Well these are my projects for a 64 button system, with RGB
http://www.thebox.myzen.co.uk/Hardware/Hexome.html

or with a single colour:-
http://www.thebox.myzen.co.uk/Hardware/Econo_Monome.html

You could always extend them to the size you want. But note this number of buttons is a lot of work.

Or you could buy one of these.Adafruit HELLA UNTZtrument! Open-Source 16x8 Grid Controller Kit [White LEDs] : ID 1999 : $199.99 : Adafruit Industries, Unique & fun DIY electronics and kits

Thanks Mike for you answer.

I wonder if i order 8xAdafruit Trellis Monochrome Driver PCB can i solder few wires to button connection points and control them using cherry mx switches or they can be activated just with that silicone buttons ?

What are "cherry mx switches"?

This site Overview | Introducing Adafruit Trellis | Adafruit Learning System says

Each tile has an I2C-controlled LED sequencer and keypad reader already on it. The chip can control all 16 LEDs individually, turning them on or off. It cannot do grayscale or dimming. The same chip also reads any keypresses made with the rubber keypad.

Those are mechanical switches used in pro gamer keyboards.

can i solder few wires to button connection points and control them using cherry mx switches

You can but I am not sure they will mechanically fit. But if you solder wires on them and mount them separately I can't foresee any trouble. I think you could even wire them in parallel so either button would have the same effect.

These keyboard switches really have to be mounted on a PCB. I'd recommend just designing your own PCB. You can get it manufactured in China for a couple of dollars.
Use Eagle CAD (free for personal use) or an open-source alternative.

Arrange your switches in a scan matrix as follows:


Add rows and columns to fit your design, but keep in mind that this layout is the most efficient (i.e. more switches per IO pin) if the number of rows is close to the number of columns (in other words, don't design a 2×50 matrix, but use a 10×10 matrix instead).
The diodes are needed if you want to be able to press multiple buttons at the same time.

For a 10×10 matrix, you need 20 IO pins (10 Input/Outputs or 10 open-drain Outputs, and 10 Inputs + pull-up or 10 Inputs).

An Arduino Micro would be perfect, because it has exactly 20 IO pins, and supports MIDI over USB natively. On top of that, you can easily mount it to your custom PCB using just two rows of female headers.
If you need more IO, you'll have to use a different board, a Teensy, for example, or you could use IO expanders (shift registers, I2C solutions, etc.).

Pieter

Hello Mrunje96,

You can try to use this tutorial https://www.instructables.com/id/Arcade-Button-MIDI-Controller/, Ive made this and its working like a charm. I think you will find all you need in that tutorial.

If i use multiplexers, how fast reading will be? Lets say i use 2x16multiplex with digital pin 2-3-4-5 connecter to S0,S1,S2,S3 for both of them, 32 buttons connected to mux and output of mux connected to digital pin 6 and 7 of arudino micro or leonardo. I will use it for light desingning program so sometimes i need fast clicking to be responsive.

If i use multiplexers, how fast reading will be?

Virtually the same as without multiplexing. The only overhead is in setting up the channel, and done correctly this is an insignificant time compared with the time taken for the A/D to work.