David prof 090519

invention

Arduino MIDI Interface for littleBits Korg Synth Kit

by djpeterso23662

Published on July 8, 2014

This project demonstrates use of the Arduino at Heart Bit as a MIDI controller for the littleBits Korg Synth Kit.  This project's Arduino sketch outputs a clock signal to the Micro Sequencer, MIDI channel 1 to an Oscillator on D5, and MIDI channel 2 to an Oscillator on D9.  This configuration enables the Synth Kit to respond to MIDI software, such as in iPhone app, or to a MIDI controller keyboard. 

Credits: Toby Cole http://www.instructables.com/id/USB-MIDI-Littlebits-synth/ and Ralf Kistner https://github.com/rkistner/arcore

SOUNDS

How To Make It

STEP 1

The goal of this project is to connect the littleBits Korg Synth Kit to a MIDI software controller or MIDI controller keyboard. The Bits setup and the MIDI setup is very basic to keep troubleshooting as simple as possible. I hope that you will extend this basic setup with more Bits and do amazing things with it. The littleBitsSimpleMidi3.ino sketch is written to be easily modified as well. I will describe using an iPhone to run MIDI software, but you can use anything you want.

STEP 2

PC software setup. Download the Arduino software from http://arduino.cc/en/Main/Software. To build this project you need version 1.5.4 or higher of Arduino. As of this writing, you have a choice of downloading either Arduino 1.0.5 or Arduino 1.5.6-r2 BETA. The 1.0.5 version WILL NOT WORK, but the 1.5.6-r2 BETA will. On Windows the BETA version paused a long time reading my large Documents folder, but was otherwise okay.

STEP 3

More PC software! Download Ralf Kistner's arcore from https://github.com/rkistner/arcore. Arcore adds support for MIDI-USB on the Arduino Leonardo to the Arduino IDE.  Unzip the downloaded file and place the arcore folder in the Arduino IDE's hardware folder. For example, on Windows I have arduino.exe located in C:\arduino-1.5.6-r2. I put the arcore folder in C:\arduino-1.5.6-r2\hardware. Check your work: if you have a sam folder in C:\arduino-1.5.6-r2\hardware\arcore\sam, you did it correctly. If you got the arcore folder in the right place, when you run the Arduino program, you will see "Arduino Leonardo (arcore)" on the Tools - Board menu. Select the board "Arduino Leonardo (arcore, iPad compatible)".

STEP 4

Load the littleBitsSimpleMidi3.ino from this project page into the Arduino IDE and click Verify to make sure that everything is set up correctly. Whew! Good job!

STEP 5

Notice in littleBitsSimpleMidi3.ino that the lines "#define CLOCK_PIN 1", "#define NOTE_PIN1 5", and "#define NOTE_PIN2 9" tell Arduino that we will use the Micro Sequencer on D1, an Oscillator on D5, and an Oscillator on D9. You can change these lines to support different hardware configurations.  The littleBits Arduino at Heart is set up to run digital output on D1, so we will put the Micro Sequencer here.  You could also run digital on D5 and D9, if you set the switches to PCM.  The littleBits Arduino at Heart is setup to run analog output on D5 and D9 so we can put Oscillator bits here without adding extra electronics.  If you want to run analog on D1 or other Arduino pins, you will need to add electronics as shown on  http://www.instructables.com/id/USB-MIDI-Littlebits-synth/

STEP 6

Notice in littleBitsSimpleMidi3.ino that the lines "const byte MIDI_CHANNEL1 = 0x00;" and "const byte MIDI_CHANNEL2 = 0x01;" tell Arduino to respond to MIDI channels 0 and 1 (shown on some MIDI programs as channels 1 and 2). You can change these to use any channels you want, 0-15.  For example, 0x03 would be MIDI channel 3. 

STEP 7

Programming the Arduino. Connect the P1 Power on the W6 Arduino a0 connector. Connect the Arduino at Heart Bit to your Mac or PC's USB port and power up the Arduino. You do not need any other bits at this point. If all goes well, you can identify your Arduino on the Tools - Port menu, then click Upload to transfer the littleBitsSimpleMidi3.ino sketch to the Arduino. After a successful upload power off the Arduino and unhook it from your PC/Mac.

STEP 8

Troubleshooting the Arduino USB connection. If you cannot upload to the Arduino, it is probably because the Arduino IDE did not see the Arduino on a serial port. Check the littleBits Arduino forum for more ideas on this. I found that my problems were either with the USB cable on the Arduino end of the cable, or with the 9 volt battery being fresh enough. I noticed that the upload would fail, or the Arduino would run but not completely restart when powered up if the battery was low.

STEP 9

Set up the Synth Modules. (See the main image for this project above.) Assemble your littleBits modules as follows:

P1 Power on W6 Arduino a0.
IMPORTANT: W6 Arduino D5 switch set to ANALOG. W6 Arduino D9 switch set to ANALOG.
I36 Micro Sequencer on W6 Arduino D1, with Sequencer switch set to STEP.
I31 Oscillator on W6 Arduino D5.
I31 Oscillator on W6 Arduino D9.
I37 Mix inputs on both I31 Oscillator bits.
O24 Synth Speaker on I37 Mix.

STEP 10

iPhone set up. I will describe using an iPhone to control the littleBits Synth, but any USB MIDI device could be used. Load up the Little MIDI Machine app, by Synthetic Bits LLC, on your iPhone or iPad. Little MIDI Machine is free, supports clock-out and two MIDI channels, has good documentation, runs on both iPhone and iPad, and has excellent MIDI code, so it is ideal for testing the littleBits Synth. (I am going to assume you read the manual or are familar with the app to keep this short.) In the Little MIDI Machine app, create two sequences (one on the brown sequencer and one on the green sequencer). In the Setup (gears icon) screen set the brown sequence to channel 1 and the green sequence to channel 2. Test run the sequences, then turn off sound in Little MIDI Machine.

STEP 11

Connecting the iPhone to the Arduino. If your iPhone or iPad has a 30-pin connector, connect the Apple Camera Connection Kit USB adapter to your device, then connect the Arduino (powered off) to the USB interface on the adapter. If your iPhone or iPad has a lightning connector, connect the Apple Lightning to USB Camera Adapter, then connect the Arduino (powered off) to the USB interface on the adapter.

STEP 12

Power up! Turn on the Arduino. The iPhone or iPad will display a message saying it cannot connect to the Arduino Leonardo. However, it actually does work. The message, however untruthful, is useful because it tells you the iPhone has seen the Arduino. In Little MIDI Machine setup (gears icon), tap the MIDI reset button, wait a couple seconds, then select Clock Out, Seq A Out, and Seq B Out for the Arduino Leonardo. This choice sometimes does not take, so go back into setup and make sure it was saved.

STEP 13

Play! Press the play button in Little MIDI Machine. Your Arduino should flash some orange lights and your sequences should play on the two oscillators. The clock-out signal is routed to the Micro Sequencer Bit, keeping it in time with the other two sequences. Congratulations, you did it!

STEP 14

Troubleshooting the MIDI connection. No music? There are a lot of things that could be problems. Can you hear sounds from the oscillators and mix without the Arduino?  Make sure both of the Mix knobs are fully on. Can you successfully use Little MIDI Machine on its own? It will really help if you are comfortable with the app. Keep checking that it has not lost the connection. Repeat step 12 if Little MIDI Machine loses the connection, or if you jostle the bits causing the Arduino to lose power and restart. Every time power is interrupted to the Arduino the iPhone will lose its configuration and will need to be set up again.  Recheck your connections and try stopping and starting the app with its play control.

STEP 15

Take it to the next level. Once you have the basic Bits configuration running, you can add filters and envelopes to make your music more interesting. If you have another I37 Mix you can put an Oscillator, Filter, or Random on the Micro Sequencer. If you don't, try connecting the Micro Sequencer to an Envelope on one of the oscillators. If you have an IK Multimedia iRIG or other connector, you can connect your littleBits synth to your iPhone or iPad and add virtual instruments to your song. Experiment and have fun!

STEP 16

Other MIDI controllers. You can try a large number of iPhone or iPad apps that support MIDI with your littleBits synth. N-Keyboards by n-Track (USD $2.99), and Mode Machines MIDI Keyboard by Mode Machines (free) are iPhone and iPad apps with two keyboards that can specify which keyboard sends to which MIDI channel. Don't forget to tune your Oscillator bits if you use them with a keyboard! An iPhone tuner app such as UltraTuner can make this a snap. If you want to use a USB MIDI controller with you littleBits synth, you will probably want to use a USB hub. Connect your Arduino to the USB hub, connect your USB MIDI keyboard to the hub, and connect your iPhone or iPad to the hub via the Camera Connection Kit adapter. You need to use an app on your iPhone or iPad to tell the MIDI keyboard about the Arduino Leonardo. I tested this with MidiBridge by Audeonic Apps and it worked great. Midiflow by Johannes Doerr will also probably do the job. You can also connect your littlebits synth to MIDI applications on your Mac or PC, or to apps on your Android device.

Related Projects

Bits on a string part 5

Episode 5 of the continuing story of the Dulcimer powered by Littlebits.See episode 1 for the making of the 3-string dulcimer that...

Hacking Arduino Sketches

Arduino is a powerful microcontroller, but learning to breadboard and write code simultaneously can be complicated for a begi...

Political Funnies Something Thousand. TM #animatronicschallenge

This is a machine made with Littlebits to have as many presidential candidates as you like to say a funny quote. I made a stage ou...