Turn cheap keyboard to MIDI PIANO! (Add MIDI port)

Turn cheap keyboard to MIDI PIANO! (Add MIDI port)


Hey so today we are going to take this cheap
keyboard from ebay and turn it into a MIDI keyboard for under 10 bucks so you can do
some really cool stuff with it like this! So having a midi keyboard will let you control
digital audio workstations like Pro tools, Fl studio and ableton live As well as connect to a wide variety of expensive
MIDI gear which I would never get since I was too cheap to get a real midi keyboard
in the first place! Alright, so we’ll need an Arduino and I’m
going to be using the Arduino UNO. We’ll also need Serial to parallel shift registers Resistors 1 Proto board 1 Female MIDI port and 1 Male pin header And the tools we’ll need are breadboards,
breadboard jumpers, a multimeter will come in handy, and your soldering tools and wires Ok, so to make this piano prettier let’s crack
it open and snip that keyboard ribbon right off the
board like so First we’re going to have to figure out the
scan matrix of the keyboard. We take our meter and attach it to two pins
at a time and sweep the keyboard to find our keys. So for this keyboard, we have a 17 pin ribbon,
which I concluded to be a 6×11 scan matrix. We don’t have enough pins on our Arduino
so we will have to combine the 11 pins into 3 using 2 shift registers, which means our
total input pins is then reduced from 17 to 9. We’re going to first wire up our shift registers,
and I’ve written here where all the connections need to go. I’m going to start by wiring up the voltage
and ground pins like so. Afterwards, I’m going to bring one of the
data pins to the other side so it’s easier to work with Now we plug in our Clock, Latch, and Data
lines and plug it into the digital pins 8,9,10 of the Arduino. Then we wire up the voltage and ground from
the Arduino to the board, and we’re going to run this bit of test code. Taking our voltmeter to measure the output
of each of the data pins, we should 0 voltage for pins that we are shifting out a 0 and
positive voltage for the pins we are shifting out a 1. Once we have our first shift register working,
we’re going to daisy chain our second one. We’ll wire up the voltage and ground just
like the first one, then hook up the additional data pin of the
first chip to the Data pin of the second chip. Then we’ll also need to hook up Latch and
Clock pins of the two chips. Now we plug in our Clock, Latch, and Data
lines again same way as we did before, and make a small change in our arduino program
to accommodate for the second shift register. We should see the same alternating pattern
with our data pins from this program throughout all of our data pins. If you’re wondering which chip comes first,
then simply shift out 8-bits of 0’s and 8 bits of 1’s at a time and check which chip
is outputting the signal. Alright, now we hook up the power to our second
board. We’re going to extend the first 11 of our
data pins from the shift registers to the second board like so. Then we’re going to bring 6 lines into 6 digital
pins of the arduino. We’ll need to add a 10k ohm resistor to ground
for each of these lines so that we have a pull-down resistor configuration. This will guarantee that we have the signal
we want when the switches on the keyboard are open. One thing to note, if this direction of current
doesn’t work for your keyboard, we can switch over to a pull-up configuration by simply
doing the following: First we need to remove the voltage and GND
connection to the shift registers. Then we connect our 6 resistors to positive
voltage instead of ground. And we also want to keep the shift register
pins connected just the way they are. This will create the pull-up configuration
you see on the diagram on the right. Alright, moving on, I’ve got my keyboard ribbon
labelled and ready to go, and I’m just going to plug that into place. Now the last thing we’re going to add to our
board is the MIDI port. We’ll have to wire the serial output pin of
the port to the serial output of the arduino, which is pin 1 for the arduino UNO. Then we wire up the ground pin and voltage
pins like so. Alright so now, we grab the full code from
the description box below. We’ll just go through the things you might
need to make changes to to get it to work with your specific configuration. First thing at the top, you’ll want to change
NUM ROWS and COLS to match the number of rows and columns in your scan matrix. These are MIDI specific constants, and should
be left alone These row input pins should match your row
input pin numbers and any additional rows should be added to the bottom of the list. These pin numbers should match the pins connected
to the shift register. These tables keeps track of which keys are
pressed and what note they map to, so leave that alone. These are predefined bits used for the scanning
process, so leave that alone too. In the setup function, you want to make sure
that the first note is the first note for your keyboard. You can get the number that corresponds to
the note in the midi table I’ll link in the description. Again, if you have any additional rows, you’ll
need to add a line here as well. And the same thing here. In our scan column function, if you’re not
using 2 shift registers you need to change this function appropriately, but 2 shift registers
should work for most keyboards. Ok, now to test our keyboard, we’ll plug in
our MIDI port to the computer and fire up a MIDI monitor program like MIDI-OX. We’ll hit all the keys to make sure we have
everything wired up correctly. And if you don’t have a midi port, you can
get get one of these MIDI to USB adapters for a few bucks. Now that everything is working, we’re going
to transfer everything from our breadboard to the
proto board and solder in all the connections. When we’re done that, we’ll just take our
meter to check for any unwanted or loose connections. Now we’re going to plug in our wires into
the arduino just the way we had it before, and we’re going to use the male pin headers
here to lock them in place like so. I then traced over the shape of the MIDI port
and the USB ports onto the keyboard case and melted that away with a soldering iron. I added a few popsicle sticks to support the
arduino and hot glued it in place. And same thing with our proto board. And now we’re going to put it back together! So now the only thing left to do is to plug
this thing in and give it a test! And there you have it. How you can turn your
cheap keyboard into MIDI keyboard for 10 bucks. I hope you enjoyed this tutorial. Don’t forget
to like or subscribe. And I’ll see you next time!

100 thoughts to “Turn cheap keyboard to MIDI PIANO! (Add MIDI port)”

  1. Me finding this video: Oh neat! This is exactly what I need to play synthesia on my cheap keyboard.
    Me 1 minute in: Oh crap…

  2. me: sees thumbnail
    me: "well I have made robots before, this cant be too hard"

    15 seconds later:
    "excuse me but what the actual fuck"

  3. It's sad how many people are here in the comments complaining about how complicated this is. Electronics isn't hard to learn – I taught myself over the past couple of years by watching YouTube videos just like this one. Anyway, keep up the good work!

  4. You should just sell it as a kit and have this as the manual. It seems too hard to go after all these little things, so you could buy a bunch of them, attach as much of it as you can, and just ease the whole process up at a reasonable price. 650k people already read your manual, lol, I bet even iphone manuals haven't been 'read' as much as yours.

  5. You have the best intention to spread all the knowledges but darn it , It’s f__king complicated!! Thanks anyway.

  6. like when you do not know how to do half of the things in the video, or understand them … I better buy a midi keyboard already made…

  7. Plz help with this!!!!
    Can we make a musical Keyboard at home… That sounds as realistic as a 300$ professional keyboard…
    Without an Arduino or MIDI.. Even if we can't make it, Can someone explain the electronics behind the working of the ICs and Microprocessors used for that tone generation(with a sound quality much better than all toy keyboards😓) and all about that
    I didn't find any YouTube vedio explaining that…. With in depth analysis..

  8. I'm interested in going the other way – any tips or resources? I have a vintage keyboard that I want to control w/ my DAW and with my other keyboard. If it's a repeatable process I want to make a vintage keyboard rack/switcher with just the circuits, but if it's a big PITA then I guess I'll just buy synthesizers instead..

  9. maybe late, but you can flash the ATMega16u2 on the board to use MocoLufa firmware to emulate the Arduino as Midi device, you can use Atmel Flip to flash the firmware

  10. Hey Is possible instal one switch in the keyboard out? You'll have the Midi option and the keyboard song to

  11. cool thing. but I think it's cheaper to get a proper midi keyboard these days as they're super cheap ^^

  12. Uhhh…. No velocity control, no Aftertouch and no pitchbender. I guess a cheap 50-100$ midi Controller provides more functionally.

  13. Can I add a MIDI in too? Want to use it for my ArduinoBoy but not sure if it's only MIDI out that's available

  14. I built your project with Arduino Micro Pro with MIDI to USB library
    Arduino UNO can be used too with a small firmware modification, google is your friend (btw CH340 not working)
    Here is the code:
    Pull-up resistor version with MIDIUSB: https://mega.nz/#F!dFhnUaiR!RuQ-2_EC2RqP1L-z76VOmQ
    Pull-up resistor version with MIDIUSB: https://mega.nz/#F!MdwHECIT!ub1jADHBzsMLkJB_yL83UQ
    I've some issues like noteOn and noteOff reversed and get multiple key pressings so I messed up and made a UpsideDown version 🙂 works for me. (8×8 scan matrix and using 1 shift register)
    UpsideDown version with MIDIUSB: https://mega.nz/#F!EIo3BIbL!7uKjEQZEZe8M09FNRqm8yQ
    MIDIUSB library: https://www.arduinolibraries.info/libraries/midiusb

  15. Estoy super motivado con este proyecto… estoy fabricando mi propio piano midi con un teclado casio MA-120

  16. Ya acabo de terminar de hacer este proyecto en un pobre teclado yamaha psr-76 de 4 octavas, y sirvió a la perfección con problemas pero con empeño se pudo, en mi caso nesesité la forma pull-up, este teclado era de 15 pines y era 6 renglones x 9 columnas.
    ahora quisiera hacerlo en un controlador de 88 notas. Muy buen video, aunque se nesesitaba profundizar en algunas cosas

  17. hahahha Im a programmer and I need this but in our country but those tools are so hard to find. the MIDI female port alone is really hard to find here.
    (engineering is quite hard i tried it before and i didnt know exactly what i was doing)

  18. I just did this on an old rare Casiotone501 using a MEGA board had a rough time but succeeded

    https://www.youtube.com/watch?v=dVYd3l92cpQ&feature=youtu.be

  19. I got a set of organ pedals that needed a change to the arduino code, this is totally helping me make those work! Question: what would the code look like if I am only using one shift register? Do I need that IF-ELSE command at all?

  20. Hmm I was thinking of sampling every sound of the keyboard and emulate the midi on the computer, mapping each tone to a frequency (the piano can be on a square wave mode for even easier use).

  21. I had that exact keyboard and turned it into a playable art piece back in 2004. I have since lost it. Sad.

  22. The Arduino UNO doesn't support USB HID. How are you getting MIDI-OX to recognize the MCU as a MIDI device? Looks like you are outputting basic note information to the Serial port, but then how does that get to MIDI-OX? Seems like a middle step is needed there.

  23. Very cool done, but next time, just buy a Roland D10. they cost roughly the same, and are tank-like built with velocity response as well.

  24. how about the polyphony? is it better to use arduino mega than arduino uno + 2 mux? i wanna play bach's toccata and fugue or something similar so polyphony is my concern. thank you

  25. I just hope I learn this at school 🙁 but only boy allowed to learn this and girl need to learn business… Why?!!!!

  26. I really wish you would've assumed you were teaching someone with lesser experience, because I am someone of lesser experience.
    There is so much in this video that you don't explain, and I don't know. what. to do.

    Which is the left and which is the right shift register?

  27. What does it mean if my data is reverse from yours?
    (i.e.
    You have B01010101, and your Q0 = 0v and Q7 = 5v.
    I also have B01010101, but my Q0 = 5v and Q7 = 0v.)

    I am using the same polarity with my DMM as in the video, if that makes any difference.

  28. Old after these many years, but still nifty. There is no velocity or pressure sensitivity in these keyboards, right ? The scan matrix only detects a key press.

  29. Does this solution also let you trigger a keyboard to play its sounds? (midi IN)? I want to add a midi IN on my old keyboard, so I can program an external sequencer to play my old keyboard, because I love the sounds in that keyboard for my live performance project..

  30. Hi all, i stopped me at the midi female connector positioning. From the video i can't see so good how to posizion the 220ohm resistor(4.25 min), do you know how can i to do? Thanks,stefano

  31. My keyboard has two cables of 9 connections each, but only 8 of each cable works, the rest has no connections to any part, so I have 16 connections in total. 8 of these connections are input and another 8 are output. The problem is that the video shows you how to connect 6 to the arduino but I have two cables left without being able to connect.

    Could someone help me solve this problem?

  32. Hello. I have made you other solution, USB MIDI IN OUT with Arduino Leonardo, and it works great. Now I am thinking of adding MIDI out to some non-MIDI keyboard (namely Yamaha VSS-200). I am wondering, can we have directly USB solution to that, using Leonardo, not DIN serial out? Thank You

  33. I mean… Who is this video for? People who already could figure it out on their own but need some kind of guide to shorten the time?
    I don't think I'm too dumb because I've been working with electronics for quite some time- but if you could at least explain the "why" of each step pretty simply, that would help tons.
    Thanks for the video, but also– maybe like 200 people out of the 700,000 that watched it can actually accomplish this.
    Maybe I'm just not smart enough to be part of your audience- but as one who fixes TVs and computers for a living- owns a 3D printer with a networked Pi attached to it that I had to build flash my own firmware onto- it just seems odd that a tutorial this popular would be nonsense to me.
    Either you didn't explain much (expected everyone to know) or, I'm actually an code copying bottom feeding techno idiot who needs an exact step-by-step to do anything.
    I'm not sure which.

  34. Hey do you know how to add pitch bend and vibrato to that keyboard and how about adding 3 pedals sostenuto damper and una corda? Is that possible?

  35. (total beginner disclaimer)
    I just completed the project on my keyboard and I want to add a tip. You could remove the ribbon cable connector instead of cutting the cables and use male pin headers to plug it in the breadboards etc. I realized it after cutting mine so a heads up as it would seem to save a lot of fiddly work with stripping and managing the cables. Thanks for the tutorial it works great!!!
    edit: tip is good provided your cables are in order with your scan matrix and not all over the place

Leave a Reply

Your email address will not be published. Required fields are marked *