3D printed single octave MIDI keyboard with full color LED feedback.
This single octave MIDI keyboard is part of the LEET synth project. Before continuing with the details below, it’s a good idea to read the main post first (if you haven’t already):
This post describes how the keyboard works, how it was developed, what you need in order to build your own, and a step by step building instruction.
Description of the LEET keyboard
Component cost is around $6 on eBay (October 2020, depending on shipping and supplier).
- 1x 3D printed core 3DPCB. Uses 34g PLA filament ($0.7).
- 1x Arduino pro micro, or compatible clone (5V version. ATmega32U4) – (~$4)
- 15x 6x6mm 4pin through hole tact switches – preferably with low activation force (50g / 0.5N) – ($0.2)
- WS2812 LED-strip with 13 LEDs (60 LEDs/m. I used IP60, white FPC) – ($1.1)
- 1x 25cm RK wire (containing 24 strands of 0.3mm copper wires) – ($0.1)
- 3D printer (FFF/FDM with PLA filament)
- Solder station with a narrow tip
- Basic tools: needle- and cutting pliers, knife, hot-glue
- Computer to run Arduino IDE and upload firmware (using a Micro USB cable)
The keyboard was the first device I developed in my LEET synth project. I wanted to build a minimalistic MIDI keyboard that could be connected to a computer or mobile phone to make up a basic synth. There are tons of professional keyboards available, but they are quite bulky and expensive compared to what I had in mind. There are some DIY MIDI keyboards online, but the ones I found were either too basic (proto or perfboard without any case) or overly complicated and bulky, with different parts requiring complicated assembly. As always, if you can’t find what you are looking for – build it!
Since I wanted to have LEDs for feedback, I decided to use WS2812b addressable LED-strips to provide full color feedback, minimum wiring and only a single I/O on the Arduino. I selected a LED-strip with 60 LEDs/m since the distance between each LED roughly matches a piano.
Each switch on the keyboard goes to a dedicated I/O of the Arduino pro micro. This way, there is no risk of key ghosting, and no need for decoder ICs or diodes; simplifying design, cost, program and assembly. Two extra switches are used to select octave, and a third switch is used to select MIDI channel. I did not include pitch bend and volume potentiometers, but it should be quite easy to add, since two I/Os are unused (but switch pinout to ensure that potentiometers are connected to AD inputs).
The keyboard is quite compact and robust. I initially made it thinner, but it looked fragile and unbalanced, so I increased the thickness to 8mm. To keep the design clean, I kept all wires on the backside, but exposed the components on the front. They could of course be covered by a front, but I like the techy appearance and having a single 3D printed part that integrates the whole product.
Embedded code for the Arduino pro-micro.
The program of the keyboard is straight forward thanks to the use of MIDIUSB and NeoPixelBrightnessBus libraries. The main loop reads the switches, sends corresponding MIDI commands and listens to incoming MIDI for the LED feedback. If the incoming MIDI package correlates to the selected channel, the corresponding LED is enabled and the color of the LED is derived from the pitch of the note. The global constant ‘echoLED’ controls if the LEDs are lit up on keypresses and incoming MIDI (if true) or only MIDI (if false). When adjusting octave or MIDI channel; the number of lit LEDs indicate the selection and then fades rather quickly. Since the keyboard only has 13 LEDs – channels 14-16 are not shown, but can be selected. To make setup easy – a change of MIDI channel is stored in EEPROM and thus remembered the next time the keyboard is powered up.
Step by step building instructions
This instruction describes the assembly process step by step on a level suitable for most people. Building the keyboard is quite easy thanks to the wire channels in the 3DPCB which indicate how the components shall be connected.
Download the latest version of the 3D model here (the .stl file is suited for 3D printing.)
Print the core using a fff/fdm 3D printer. I recommend beginning with the smaller leet_test part to verify that your printer is calibrated before starting the 3-4 hour print.
I used the following settings:
- 3D printer: Prusa i3 MK3S with 0.4mm nozzle
- Material: PLA
- Nozzle temperature: 210deg C
- Layer height: 0.2mm
- Infill: 20%
- Support: None
The printing time is 3-4 hours with default speed. Once the print is done, you can trim any defects with a fine sandpaper if needed.
2. Arduino program
While printing you can download, set up and program the microcontroller:
- Install the Arduino IDE and download the latest LEET keyboard firmware here.
- Download and install MIDIUSB and NeoPixelBrightnessBus libraries.
- Connect the keyboard to your computer with a micro USB cable.
- Select Arduino pro micro as board, and select corresponding com port (if the Arduino is not appearing with a com port, try another cable, since some charging cables lack data wires and won’t work).
- Compile and upload the code.
Strip 25cm of RK wire (the multi stranded cable used for internal wiring in electrical 230V cabinets) to get the 24 pcs of 0.3mm copper strands inside.
Secure the Arduino pro micro (without pin headers) in place with a dab of hot melt adhesive (glue gun) on the backside. Ensure that the holes are aligned.
Insert the switches and fold the pins on the backside to lock them in place. I recommend a small flat screwdriver.
6. LED strip 1:
Cut a section of LED strip with 7 LEDs.
- Remove the protective liner and the double sided adhesive that covers the three connections on each end on the backside of the section of the LED strip.
- Solder two strands of wire to “DIN” and “GND” on the exposed pads of the backside (note that one end of the LED strip is “DIN” and the other is “DO”).
- Solder three strands of wire to the other side (DO, 5V & GND).
- Thread the 5 wires through the 3DPCB, remove the liner and press the LED strip in place.
- Thread the DIN wire through the wire channel to the microcontroller, ensure it’s tight and solder it in place on the front side. Cut away excess wire close to the solder.
- Thread the neighboring GND through the channel, stretch, solder it to the Arduino board and trim.
- Thread the three remaining wires on the other end through their channels to each dedicated opening.
7. LED strip 2:
- Cut a section of LED strip with 6 LEDs.
- Remove the protective liner and the double sided adhesive that covers the three connections on the “DIN” side.
- Solder three strands of wire to “DIN”, “GND” & “5V” to the exposed pads on the backside.
- Thread the 3 wires through the 3DPCB, remove the liner and press the LED-strip in place.
- Thread the 5V wire through the channel, stretch and solder it with the wire from the other LED strip in the dedicated opening. Trim the wire from the other LED strip.
- Continue to thread it to the microcontroller, stretch it and solder in place.
- Thread the DIN wire through the wire channel to the opening where it meets the “DO” wire from the other LED strip. Ensure both wires are tight, solder them together and trim the ends.
- Thread the GND wire and solder it together with the other GND wire at the dedicated opening. Trim the wire from the other LED strip and continue to thread the wire through its channel to each of the 12 switches. Tighten it and solder the wire to each switch (24 pins) along the way.
8. Connect the switches
Solder a wire to both available pins of a switch. Insert it in its wire channel, thread it through the Arduino, add some tension, solder it and cut the remains.
Repeat for all 15 switches. Don’t forget to take a break every now and then to stay focused.
Check the solder joints, ensure that the wire is secured and tight within its channel and that everything is flush against the backside. If anything is loose, protrudes, looks funny or sharp – re-solder until it’s perfect.
Good job – Give yourself a well-deserved high five.
10. Power up and play
Connect the keyboard to a computer or a mobile phone with a USB micro cable. The startup animation should turn on every LED and the device should appear as MIDI in your DAW. Insert a coin and start playing!
Download project files
All files required for this project are available at this GitHub repository:
This project is open source under MIT License
(Attribution is optional, but appreciated /Johan von Konow ;)