Page 1 of 1

ProjectTOON - Mechanical Keyboard/MIDI controller hybrid

Posted: 06 Feb 2016, 10:28
by MrNorse
Image

So a few years back I had my first encounter with DIY keyboards and hardware programming/design. It came about by salvaging they key matrix from an old Toshiba Rupo (jw95jp), with a grand vision of getting it working again and integrating a Raspberry Pi into the case to create an all-in-one computer. It took a long time to make but I succeeded, only to find that the keyboard itself was absolutely rubbish to type on.
Spoiler:
The Norseboard
Image
One thing I took away from the project was how exciting it was to work on practical hardware. I spent the next couple of years periodically jotting down notes of what I would add/change/remove if I was to make a new version. Over that time I became fascinated with the idea of integrating a synthesizer into the design and having selectable output modes. This lead to thoughts around the key layout for the music component, where I came up with a staggered black key design.
Image

The next challenge I faced was the key matrix. I originally feared I'd have to learn to design PCBs and go through the expensive trial and error prototyping to design a custom PCB. Then I discovered the Phantom PCB and within a week I had ordered one and began work.
Spoiler:
Image
There are some limitations to the Phantom PCB for what I wish to do. This stems from the idea of it working from a Teensy 2.0, which only has enough pins to support the key matrix alone. I've chosen to use a Teensy 3.1 which will provide the extra pins to add in a mode selector switch (in hindsight, dedicated keys could have worked) and 5-pin MIDI output.
Using a different microcontroller means header pins and hookup cables, which does mean the micro can be placed at the top end of the PCB, retaining a relatively low height for the overall case.
Spoiler:
Image
I looked into the option of modifying the TMK Keyboard firmware to support the features I wanted to add but realised quickly that I don't know how to add MIDI to in the raw C code and that there was limited support for the ARM based microcontrollers. So I went ahead and wrote the firmware I needed in Arduino C, loosely following structures I observed in the TMK firmware and following lessons I had learned in the first Norseboard project.

The current, unfinished code is available on my Github account at https://github.com/milesflavel/ProjectTOON
If you want to run the firmware, you will have to add a custom board configuration that supports both the USB HID and USB MIDI.

Since working on this project and researching everything about it, I discovered this forum and all the amazing work you put up here. It's inspired me to look forward at making a 60% in the near future.
I'll keep you all updated as this project progresses and if you have any pointers/suggestions I would love to hear them :)

Posted: 06 Feb 2016, 15:33
by Ray
Welcome to DT.
Looks pretty neat!
As someone who doesn't know much about keyboards (as in synthesizer), can you tell me what a (staggered) black key design is?

Posted: 06 Feb 2016, 15:43
by MrNorse
Thanks.
This staggered layout is just something I came up with. The typical layout of a piano is that the black keys (sharps/flats) are set between and slight back from the white keys. This is something I could have mimicked by keeping the black (or grey) keys on their own rows, but it means for every octave (8 white keys) I have two wasted alphanumeric keys. This layout I have just means I can have more notes available to play but in practice it might be much harder to play.

Posted: 06 Feb 2016, 16:04
by Matt_
Nice project, I'm curious to see how you will implement MIDI (there must be libraries and examples on pjrc's website).

Have you considered a chromatic layout, or scale modes as implemented on Push or the Launchpad? Those would be harder to code, but having someting as flexible as those controllers integrated into your standard keyboard would be interesting.

Posted: 07 Feb 2016, 08:16
by MrNorse
Matt_ wrote: Nice project, I'm curious to see how you will implement MIDI (there must be libraries and examples on pjrc's website).

Have you considered a chromatic layout, or scale modes as implemented on Push or the Launchpad? Those would be harder to code, but having someting as flexible as those controllers integrated into your standard keyboard would be interesting.
The MIDI elements aren't too difficult. Because I'm coding it from the Teensyduino end of town, there are functions available to output the USB MIDI (usbMIDI.sendNoteOn(MIDINOTE, VELOCITY, MIDICHANNEL)). I've not done any work with the 5-pin MIDI output before but Arduino has a library for that and I think it works similar to the USB MIDI.

I'll have to look into the chromatic layout because it's the first I've heard of it. I'm not exactly musically talented but it could be fun to implement. Something like that shouldn't be too hard either as I've created a rather user-friendly keymap and mode system (borrowing heavily from TMK's layer system) which you can check out on my Github.

Hopefully the hookup wires and stabilizer bars will arrive tomorrow and I can get a few more pictures up.

Posted: 09 Feb 2016, 16:27
by MrNorse
My ribbon cable jumpers arrived, so I spent the past couple of days wiring it up in a neat way and even had time to knock together a little switch to analog adapter for mode selection.
(Turns out it's hard to type on camera with a wobbly keyboard missing the spacebar)
I'm extremely happy with how the cables came out. They sit really quite flat and should easily fit into a small space at the top edge of the case.
Image
Image

To minimise the number of pins used (not that I am running out), I decided to have the mode selection switch control a resistor ladder and be read as an analog value. To achieve this I chucked a few resistors onto a piece of stripboard and added header pins. It makes me wonder if you could theoretically use a much smaller microcontroller for typical keyboards (not that you really want to because there are other limitations this would introduce).
Image
Image

Hopefully my stabilizers arrive real soon. They were one of the first few things I ordered and have surprisingly taken the longest.

What do you think about integrating another Raspberry Pi into this one? On one hand it would be cool to have an all in one computer, keyboard, synthesizer, but the flipside is that I would be less inclined to use it as a keyboard because it would mean a much larger case.

Posted: 14 Apr 2016, 12:03
by MrNorse
It's been some time but ProjectTOON is more-or-less functionally complete now. I decided to keep it rather simple by leaving out the Raspberry Pi, so the overall functionality is of a keyboard and MIDI controller requiring only a USB cable for keyboard/USB MIDI and a 5 pin MIDI cable for MIDI output mode.

I spent some time working on a rough mockup of the case. This is just thin aluminium, cut with a dremel and bent around some wooden blocks but I intend of having a similar sort of construction, with some nice wooden wedges capping the ends.
Here's how it currently looks:
Image
The intention is to have something that looks sort of like this:
Image