A while ago, I ordered myself This so-called Launchpad Which, in my opinion, not only features a rather decent build quality, for only 70 euro but also offers a total of 64 square push-buttons And 16 round push-buttons By connecting it to a computer through it's micro-USB port, the push-buttons can, for one, light up but can also be used with music software Like, for example, FL Studio to play back certain tones This way you can, if you're talented enough, create music, which does not sound that nice in my case Because, hey, I'm an engineer And not a musician But, just search for "Launchpad" on youtube to see what kinds of amazing things you can do with it. Anyway, while playing around with the Launchpads I was starting to wonder, how exactly, the push-button matrix works. And what kind of data It sends over to the computer so in this episode of "DIY or Buy" I will not only show you how I mechanically and electrically built my own Launchpad in order to find out weather DIYing such a device is worth it But I will also talk a bit about a keyboard-matrix and MIDI, AKA: "Musical Instrument Digital Interface" Lets get started [Into Music plays] This video is sponsored by JLCPCB Where you can get 10 PCBs for only $2 With 24-Hours express turn-around Their focus is high-quality PCBs For a low price Which you can get delivered within a week The first thing to figure out When it comes to recreating Such a complex electrical device Is a plan Since i wanted to keep things simple I kicked out the round push-buttons, from my design And reduced the number of square push-buttons from 8x8 to 6x6 For the outer shell, i wanted to use regular PLA filament But, a semi-flexable filament called "Poly Flex", for the buttons Since it is more comfortable to push And also, more translucent for the LED lights And speaking of LEDs, I will be using "WS2812" LEDs Since they only require 1 data pin Besides 5 volts, and ground In order to control All 36 mandatory ones Which saves us, a few I/O pins of the Arduino Nano Microcontroller Most of the other Arduino pins will be connected To the keyboard matrix Which I will talk about in detail later For now, all I needed to know about the matrix that i will be using those Rather big, tactile switches Which come with a little plastic hat Here began, the most complicated part though Since we had to precisely measure all the components and create a mechanical blueprint there will be 2 Perf-Boards on the bottom That are mounted to the enclosures insides with screws on those Perf-Boards are all 36 tactile switches soldered on to whose hats are close to the upper 3D printed button mats 3D printed prisms will be positioned between the tactile switch rows On to which the LEDs will be mounted to illuminate each button at an angle Sounds complicated at first, but while looking back This design idea worked out pretty well Now with my blueprint in mind My assistant created a 3D model With one to 3D design for the main enclosure the lid, the six prisms, and the push-button mats So i started off by 3D printing the semi-flexible mats, whose first attempt was a big failure since the extrusion speeds was too high But after decreasing it to 39% for the second try The print turned out successful But was certainly not easy to remove from the build platorm All the remaining prints required less attention from me during printing Since they were created with easy to handle PLA filament Whose quality was pretty awesome to loo at after I removed all the support material but anyway, after cleaning-up the mat as well It was assembly time Which i started off by inserting the mat into the main enclosure next, i pushed all 6 prisms into the cavities inside the enclosure and moved on by cutting 36 individual "WS2812" LEDs from a long strip which I obviously tested before-hand Then I marked the start LED and the direction of each LED's data, on each prism Which resembles a snake pattern Afterwards I removed the prisms and used superglue to mount each LED with the correct orientation, in the designated space indicated by the bigger wiff of the prism as soon as all 36 LEDs were secured I pre-tinned their solder pads and used silvered copper-wire to connect the pads of the neighbouring LEDs Once that was done, I Positioned the prisms inside the enclosure once again, in order to determine the length of the connection wire between them which I then cut into the appropriate length needless to say, I then used this thin 0.75mm flexible wire to connect the Ground, 5 Volts, and data pads of the nabouring LED prisms Next I brought in the 2 Perf-Boards which featured dimensions of 10x20 centimetres according to the size of the enclosure, I scored them and snapped a piece of them off In the horizontal and vertical axis so that they fit perfectly inside the housing afterwards, I reinserted the prisms and did a bit of cable management, before I used superglue to permanently secure them in the cavities Through the help of the Perf-Boards, and a bit of ballast I let the glue dry and afterwards tested whether the LEDs still functioned correctly Which they did At this point, I positioned the tactile switches in one half of the button-map, Laid the Perf-Board on top, and marked the position of the switches I then pushed all the switches, into the marked spots added the plastic hats and positioned them in the enclosure, once again, with a bit of force And as you can see, the switches seemed to work correctly So I repeated pretty much the same procedure for the other half of the Launchpad As soon as I was sure that all switches worked correctly I permanently soldered them in-place And connected one side of all the switches in once column together With silvered copper-wire But, wait... Why am I doing this? Well, lets say we got 36 switches To check which one gets pushed, we could connect one side of each switch to a digital input-pin, with a pull-up resistor and all the other switch sides to ground if the switch is not pushed, we get five volts on the digital pin and, if it is pushed, we get zero volts Easy Only problem is that we would need 36 digital-inputs for that which we do not have The solution is to connect one side of the switch in all columns together And the other side of the switch in all rows together Now we can connect each column to an input with pull-up resistor And each row to another pin which means we only need 12 pins The procedure is simple as well We look at one column, and pull each row down to ground one after the other If at one row the input at the column gets pulled down to ground We know that this switch is activated After checking all rows, we then move on to the next column and repeat this process And since we go though the scanning process so fast We can pretty much capture any human button press I later also added diodes to the ground side of the switches to prevent ghosting But feel free to read the keyboard-matrix help article from Dave Dribin To get more information about that Anyway, like I just described I created all 6 column lines and then moved on to adding a diode to the other side of each tactile switch Once that was done, I reinserted the Perf-Board And created M5 and M4 Threads for the enclosures mounting screws Before I mark the mounting holes for the Perf-Boards Which I then created as well as a feed-through hole for the LED wires Afterwards, I created a few more cutouts In the Perf-Boards In order to properly secure them inside the enclosure with M4 and M3 bolts At this point, I once again used silver copper-wire To create all the row connections And finally, used a bit of 0.75mm flexible wire to connect the matrix columns and rows and the LED wires to the Arduino According to this scheme After then mounting the Arduino with a bit of glue I closed the Launchpad up with its lid and M5 screws Which means, it was time for programming To keep things simple, I utilized the keypad library as well as the fast LED library In the code, I simply defined Which pins are connected to the rows and columns And then used a switch statement To light up each LED according to its fitting button press After uploading the code, you can see That the Launchpad lights up Just like I intended it to do But, how can we connect it to our music software? Well, this software can only interact with MIDI controllers Which, coincidentally, our commercial Launchpad is The sent Musical Instrument Digital Interface data Consists of 3 bytes The first one states weather a note is on or off and which channel we use with "1001 0000" We say That the note is on, and we use the channel "0" The next bite defines which note number we want to play which can be 0 to 127 The last byte then defines the note velocity Which, once again, can be 0 to 127 You can also easily find a chart With all available MIDI commands, on the internet If you're interested Anyway, for my code, I added Three "Serial Write" commands to each button push for the three bytes and basically only change the note value for each button But, after uploading the code the software did not recognise our MIDI device yet For that, we firstly need to install the "LoopMIDI" software in order to create a proper MIDI port and afterwards, we need to start the Serial MIDI bridge software and start out data communication which, as you can see, seems to receive proper MIDI messages, if we push a button And just like that, we can select the "loopMIDI" port, in the FL Studio software map each button of our DIY Launchpad to an instrument and use it, just like a proper Launchpad now, of course, it does not feature as much buttons, and took a lot of work to create But I like the fact that I can use it easily for other electronic projects, as a controller That is why I declare that both DIY and Buy are this time the winner But, what do you think? Let me know your thoughts, in the comment section below As always, thanks for watching Stay creative And I will see you next time!
Not keyboard specific, but uses the same keyboard matrix. I did like the idea of using a perf board. It's too bad it's not easy to use perf boards with MX switches... It be so much work to drill out all the holes.