4

I have a Korg NanoKey which I'd like to use to control a simple synthesizer I've designed on the Arduino platform. (I have an Arduino Uno.) Basically, I don't care about MIDI, I just want to read what note the keyboard has pressed down, but if MIDI is the only way I can do that, then it's okay with me. So my big question is, how do I do this? I haven't been able to find anyone else on the Internet who has already done this.

But more specifically, I see two challenges: First, I'd like to plug my NanoKey directly into the Arduino's USB port, but then I'm wondering if the Arduino would provide the necessary power to the NanoKey. Second, I'm not sure what protocol I would be reading. Can I just read MIDI signals as described in this tutorial?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Nels Beckman
  • 20,508
  • 3
  • 24
  • 28
  • Any progress? From what I found out so far is that the nanokey needs to be told by some USB host to "initialize" itself, otherwise it doesn't send any keyboard data. I would like to attempt to bypass the main nanokey circuit http://oi42.tinypic.com/nd4vpi.jpg completely and process the raw keyboard and buttons data myself. – Charon ME Jun 11 '13 at 09:23

4 Answers4

2

I don't want to curb your enthusiasm but what you're attempting might be a bit hard basket. A USB system consists of a host controller and one or more peripheral devices. It's the host that controls traffic flow to the devices which means that devices can't transmit data on the bus without an explicit request from the host controller.

I'm not familiar with either the nanoKey or the Arduino platform but I'd be fairly confident that the nanoKey is a USB "device", normally connected to a computer which would act as the host. So what you would need for this system to work is for the Arduino to act as the host when communicating with the nanoKey. The Arduino schematic shows that the Arduino Uno uses an ATmega8U2 for USB coms. Unfortunately the ATmega8U2 is a USB device, so you've got two peripheral devices but no host controller to facilitate the transfer of data between them. You'd be better off using a development board for a micro that provides either USB Host or USB On-the-Go.

  • Ah, I see. Okay, well that's a little disappointing but I understand. How difficult would it be to write a software USB Host? I think probably I'll just connect both devices to my computer and have the computer read from the keyboard and write to the Arduino. Thanks. – Nels Beckman Jul 09 '11 at 16:36
  • I got it working going through the laptop. I used Processing to read the midi commands and then write to serial. http://www.youtube.com/watch?v=vOkB_B_TNxY – Nels Beckman Jul 10 '11 at 01:04
  • Hehe cool. Now to compose the Super Mario Bros song :D. You won't be able to write a software USB host. The thing with that Arduino board is that your software isn't exposed to the USB. You can only pump out serial data on pin 1 feeding into the ATmega8U2 which handles the transmission via USB. But as the ATmega8U2 is a USB device what's probably happening is that your transmitted serial data is buffered in the ATmega8U2 until the virtual com port driver on the PC (USB host) polls the ATmega8U2 and requests it's buffered data. – Jonathan Thomson Jul 10 '11 at 05:03
  • I see that the Arduino has an SPI interface. You could potentially use a USB host controller with an SPI interface. Something like the [Maxim MAX3421E](http://www.maxim-ic.com/datasheet/index.mvp/id/3639). – Jonathan Thomson Jul 10 '11 at 05:09
2

I opened up a Korg Nano controller yesterday and was surprised to discover that there's an AVR mega32 inside. It would be a significant undertaking, but with a bit of work you could probably work out the schematic and reprogram it yourself using their programming header breakout. You might not end up with much more functionality than you've got this other way, but it would be very educational.

1

As mentioned in the other posts, you would need to use a separate chip to provide the USB Host interface. Here's a great guide to using the USB Host shield by Circuits@Home to interface with an Akai LPK25 (USB Midi Keyboard).

http://blog.makezine.com/2010/11/30/usbhacking/

The Arduino sketch is provided, so you should be able to try it out, however debugging the USB Host connection could get tricky real fast if it doesn't work out of the box.

Peter Gibson
  • 19,086
  • 7
  • 60
  • 64
1

I agree with the Jono - you are biting off a lot - it might even end up easiest to hook the keys up to the Arduino directly - tearing out the electronics and figuring out a way to multiplex the keys into a single channel without losing polyphony (resistor 'ladder' maybe). I any case, good luck. Amusingly, you'd making an analog keyboard to plug into a digital synthesizer.

Quick and Dirty Arduino MIDI Over USB demonstrates how to send/receive MIDI out over USB, but unfortunately, this probably isn't any help for what you are trying to do, since he's found a way to send and receive MIDI signals from a USB host, not act as a USB host himself - the opposite of your problem. However, I thought perhaps it would be of use, if you ever wanted to control your device from a computer.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Jon Biz
  • 1,003
  • 2
  • 8
  • 23