Introduction: USB MIDI Littlebits Synth!

Picture of USB MIDI Littlebits Synth!

My lovely wife bought me the littlebits synth kit for Christmas, and I spent several days annoying everyone with screechy sounds. After a while I wanted more control over it, to sync it with other things, or to play it from a proper keyboard.

This instructable will show you how to do all those things, check the video for an example.

Shopping List

You will need the following stuff -

Step 1: Make the Connector

Picture of Make the Connector

We're going to connect the littlebits to the Arduino via a breadboard. Currently there's no way to get or make your own 'bitsnap' connector, that's the three-pinned magnetic plastic thing on your littlebits. So instead of making our own, we'll use the 'split' module, which handily uses readily available connectors for it's wires. This means we don't need to make any permanent changes to the littlebits :)

Instead of cutting cables, or breaking apart the connectors, we can take advantage of the little white connector on the split module, replacing the input on that with our own from the Arduino. There's a couple of options here, you can either use the jumper-wires in the first picture (much easier, harder to find, a bit more expensive) or use the surface-mount connectors shown in the second picture (advanced, easer to find, cheaper).

Jumper wires

Simply strip the ends of the wires and either solder a short length of solid-core wire to each of the three ends. If you're relatively new to soldering you can find out how to do it on this instructable.

Now, take your split module and remove the two input ends, those are the ones that only have one set of wires going to them. Just pull the white plug out of it's plastic socket. It might need a bit of a wiggle but they're fairly easy.

Insert your plug (along with it's nicely soldered tails) into the socket on the input bit. You've now got a connector to plug your littlebits into your breadboard! Simple as that.

Surface-mount connectors

Now, this option may not be suitable for any beginner solderers out there, it involves some VERY small pins, that are very close together. With that in mind, here we go…

The eagle files and printable board for the little adapter board are up on the project's github -

https://github.com/tub/Littlebits-Arduino/tree/mas...

It was very nicely laid out and etched for me by Alex at my local hackspace (I was feeling lazy and he's easily persuaded). I won't go into the PCB making details in this instructable, but there's many other guides on how to make them, e.g

If you're using the PNG image of the board layout to etch, remember to set the print-size to 2400 DPI otherwise it'll print at the wrong size!

Since the boards are so small we etched eight of them in one go (photo #4), to get them apart I just scored them carefully with a craft knife a few times and snapped them (photo #5).

Soldering Tips

I managed to solder the surface mount connector by simply tinning each pin, along with the two anchoring tags at the front of the connector, then tinning the pads on the board (photo #6). All I had to do then was heat up each pad until the solder on them melted and stuck the component to the board. It wasn't as tricky as I thought it was going to be.

The three header pins go in the three holes towards the back of the board, these are soldered like a normal through-hole component, no special treatment. The finished boards can be seen in the last photo on this step.

Next, just unplug the wires from the input end of the split bit and plug them into your adapter boards. Now you've got a breadboard to littlebits adapter!

Step 2: PWM Filter Circuit

Picture of PWM Filter Circuit

The Arduino sketch we're going to use takes advantage of the analogWrite function, which uses pulse-width modulation to fake an analogue output. This means that instead of actually turning the voltage up and down, it switches it on and off very quicky. To fake low voltages, it leaves an output mostly off but turns it on for a reeeeeeally short amount of time, thousands of times a second. To fake higher voltages it turns the output on (which is 5v) most of the time, turning it off for a tiny amount of time, again, thousands of times a second. This is better summarised on the Secrets of Arduino PWM page.

Annoying this thousands of times a second is 490 Hz which is in the frequency range we can hear, so it turns up as a buzz on the littlebits speaker! You can hear this in the video attached to this step, it's supposed to just be a rising tone, but instead there's also the buzz. In order to get rid of this buzz we need to put the signal through a low-pass filter to smooth out the choppy waveform. We can achieve this using just a resistor and a capacitor.

The first picture shows an approximation of what I set up on my breadboard, except it's easier to follow (and says Arduino Uno, but ignore that bit).

It's worth pointing out that the colours on the littlebits wires are slightly confusing -

  • Red - Ground, 0v
  • Orange - Signal
  • White - 5v

Step 3: Arduino Software

Picture of Arduino Software

USB MIDI with arcore

In order to make the MIDI side of this project really easy, I've used a modified version of the Leonardo firmware called arcore. It adds USB MIDI support so you can just plug in the Arduino and it gets recognised as a MIDI interface in your sequencing software. Installation pretty simple, instructions are on the arcore project page.

Once it's installed and you've restarted the Arduino software, make sure you select the "Arduino Leonardo (arcore)" board from the Board menu as shown in the picture.

The sketch

The Arduino sketch, which is on my github project, does several things with the MIDI data it receives.

MIDI Clock

When the Arduino is sent a MIDI clock signal, it will pull pin 3 high, and output an inverted pulse for every beat. When a stop signal is sent, pin 3 will go back to 0v. This allows us to hook up a MIDI clock to trigger the micro-sequencer littlebit, and keep it in time.

MIDI Notes

If note data is sent to the Arduino, pin 5 is set to a voltage proportional to the note's frequency, which allows us to use MIDI notes as a control voltage. e.g. to control an oscillator's pitch. Pin 4 will get a pulse sent to it when a note-on is fired, this allows us to trigger envelopes or other bits when a note is pressed.

MIDI CC messages

Pin 6 will output a voltage proportional to any MIDI Control Change #1 messages received. This allows us to link controls within software or even knobs on MIDI controllers to littlebits.

Installing the sketch

Simply download the .ino file the project page and open it in the Arduino editor. Hit upload (remember to select the arcore board in the Boards menu).

Step 4: Go!

Picture of Go!

Now you're ready to experiment with your MIDI Littlebits.

There's a quick project to get you started in the picture attached to this step. It synchronises the micro sequencer bit with your MIDI clock. Make sure you have 5v and GND connected to the correct wires (check step 2 if you're not sure), and connect the middle wire to pin 3, the clock pulse pin. Then connect the micro sequencer to your Arduino-littlebit converter, then two oscillators, then the speaker.

In your MIDI sequencing software, make sure that the MIDI clock is being sent to the Arduino Leonardo MIDI device.

Comments

CarraN (author)2016-01-31

Hi Tubfun!

does the "hardware " folder have to go to the installed arduino program in windows folder or in the documents/aduino sketches one? It doesn't seem to apear neither...

I use 1.6.7 just in case

cheers

garethllewelyn (author)2015-01-04

Littlebits part: Proto W9 lets you connect directly to LittleBlts.Great 'bl

So how would I use the Proto bit in this set up?

tubfun (author)garethllewelyn2015-01-04

Ooh cool, hadn't seen that bit before!

liampower (author)2015-03-31

Hi, love this project, put this together, my problem is with the pwm filter circuit, I can't seem to find the proper ratio for the RC filter on the PWM output. Either I go too high with the capacitor and it takes too long for notes to drift up to stable, or I go too low in the cap value and hear the PWM frequency, I am currently using a 4.7k resistor with a 10uf cap, which values did you end up using?

ben.behseresht (author)liampower2015-04-14

Hey, based on the low pass filter post that the author mentioned earlier here: http://sensorium.github.io/Mozzi/learn/output/

I was able to figure out that the output frequency should be around 6000 [Hz] = (1/(2*pi*R*C)).

From this calculation, I ended up using a 0.1 uF capacitor and a 330 Ohm resistor which isn't perfect but makes it sound much better than what I had been using previously.

ninuxi (author)2015-03-02

Hi

my connector is reversed: red 5v, orange pin, white gnd

gpvillamil (author)2014-03-24

What are the values for the resistor and the capacitor?

tubfun (author)gpvillamil2014-03-30

I used 100uF capacitors and 120k resistors, however since I wrote this instructable up I've found some better example circuits on the Mozzi site which might be worth a read -

http://sensorium.github.io/Mozzi/learn/output/

KRA5H (author)2014-02-14

LittleBits comes with a Lego cross axle adapter to add motion to Lego projects

You can also connect Erector set gears to the littleBits motor axle as demonstrated here: https://www.instructables.com/id/littleBits-Sample-...

Has anyone figured out a way to connect K'nex gears to to the littleBits motor?

Thanks for finding the JST SH Jumper 3 Wire Assembly. It looks like a great solderless solution to connect up littleBits to a breadboard. I'm going to check with my local electronics store to see if they have them (don't want to wait for mail order, lol).

KRA5H (author)KRA5H2014-02-14

Correction: it looks like the JST SH Jumper 3 Wire Assembly has braided wire. I think there is still a solderless solution--there are single pin female header pin connectors that can be crimped on to the braided wire. I'll see if I can find these at the electronics shop.

KRA5H (author)KRA5H2014-02-14

Oh yeah..let me know which contests you've entered this Instructable so I can vote for it.

tubfun (author)KRA5H2014-02-15

It was only in the Littlebits contest, and voting's finished, so don't worry about it ;)

tubfun (author)KRA5H2014-02-15

I guess you could also get the jumper wire assembly then crimp pins onto the wire rather than soldering.

I would have most likely soldered a short length of solid core on the end as I've never got round to buying crimp-tools.

Cheers for the feedback! :)