Archive for January, 2011

Small-Scale MIDI for the Music Box

We’ve spent a bit of time working with the ATSAM2195 synthesiser chip on the Fluxamasynth board that we’re using for the Modular Music Box.

The ATSAM conforms to a bewildering selection of MIDI specifications: as well as responding to core MIDI messages, it supports General MIDI, The Roland MT-32 sound set, Roland’s GS MIDI extensions, a bunch of additional NRPN and SysEx controls and its own “DREAM” command set. There are at least three completely different ways to control the device’s master volume, and three more to control per-channel part volumes. Having skimmed the manual a few times, we embarked on a near total rewrite of the Fluxamasynth support library to layer out the various classes of parameter and SysEx change.

The ATSAM’s sound, and voice architecture, are pretty similar to the MT-32: there are some rather wimpy voice-specific low-pass resonant filters, rudimentary LFO and envelope controls, a dual effects processor, built-in parametric EQ and (apparently) sound spatialisation. The sound quality is probably not something you’d want to commit to an album (despite the fact that the MT-32 was a hot studio item in 1987), but it’s pretty impressive from something the size of a lentil.

Screenshot of Max for Live bridge

For testing, we have the Fluxamasynth – essentially the ATSAM chip on a bare-bones Arduino – connected via I2C to an Arduino Mega as “host”, with the Mega running a protocol layer for talking to a MacBook. The Mac side of the link is implemented in Python within MaxMSP, which means we’ve been able to drop the entire thing into Max for Live and play bits of Beethoven and Mozart from General MIDI files directly through to the ATSAM. The tracks sound… acceptable. (The onboard EQ will help a lot.)

Next task: code up some sequences that will work on the music box’s playback disc: 64 steps, 13 pitch rings. That’s not very much Mozart, so quite a bit of manual quantising will be necessary to shoe-horn pieces into a playable form which will last more than four or five seconds.

Modular Music Box – Synthesiser Control

We’re starting to make a serious push at the sound programming for the Modular Music Box.

The audio hardware is a Rev. 1 Fluxamasynth, a bare-bones Arduino board hosting an Atmel ATSAM2195 General MIDI chip with rudimentary onboard effects. The chip interfaces to the Arduino via the standard serial-port library, which makes communication between the board and a host computer a bit of a problem: loading up Arduino sketches works fine, but the serial link is then used for MIDI. (The example code even brings up the link at the MIDI speed of 31.25 Kbaud, which might just be an in-joke; I very much doubt that the synth chip is opto-isolated!)

While it’s probably possible to get USB serial and MIDI serial communications running independently, that seemed like too much fiddling around. Since the Music Box relies on I2C for communication between its components, it made sense to bring up an I2C link between the Fluxamasynth and an Arduino Mega which I happened to have lying around. This was pretty much just a case of loading the Fluxamasynth with a basic sketch which passes all I2C bytes verbatim to the synth chip (I2C is 8-bit clean, so no armouring or wrapping is needed). The Mega uses a modified version of the Fluxamasynth “library” – in reality just a collection of MIDI message formatters – to put completed MIDI messages onto the I2C bus rather than serial. The breadboarding looks rather like this:

Fluxamasynth and Arduino Mega

Yes, the power, ground and I2C lines to the Fluxamasynth are held in place by miniature G-clamps since I’m in no mood to try and solder up pin strips right now. (more…)

Modular Music Box – Notes to Mike Cook 2

So sticking with the winder as a starting point I’ve collected together some of the components and internal fixings…

I supply..

The acrylic top plate with 12 orange 3mm LEDs and a rotary encoder glued in and wired up (all but the encoder button are soldered) – the one quirk being that I got the blue and purple strands of the ribbon cable out of order… so with the panel face up and micro usb breakout board etching at the bottom the LED configuration is:

12 o’clock – white – anode – MAX7221 22 SegDP/white – common cathode – MAX7221 2 Dig0
1 o’clock – grey – anode – MAX7221 14 SegA/white – common cathode – MAX7221 2 Dig0
2 o’clock – blue – anode – MAX7221 16 SegB/white – common cathode – MAX7221 2 Dig0
3 o’clock – purple – anode – MAX7221 20 SegC/white – common cathode – MAX7221 2 Dig0
4 o’clock – green – anode – MAX7221 23 SegD/white – common cathode – MAX7221 2 Dig0
5 o’clock – yellow – anode – MAX7221 21 SegE/white – common cathode – MAX7221 2 Dig0
6 o’clock – orange – anode – MAX7221 15 SegF/white – common cathode – MAX7221 2 Dig0
7 o’clock – red – anode – MAX7221 17 SegG/white – common cathode – MAX7221 2 Dig0
8 o’clock – white extension – anode – MAX7221 22 SegDP/grey – common cathode – MAX7221 11 Dig1
9 o’clock – grey extension – anode – MAX7221 14 SegA/grey – common cathode – MAX7221 11 Dig1
10 o’clock – blue extension – anode – MAX7221 16 SegB/grey – common cathode – MAX7221 11 Dig1
11 o’clock – purple extension – anode – MAX7221 20 SegC/grey – common cathode – MAX7221 11 Dig1


Modular Music Box – Notes to Mike Cook 1

Just to recap – there are 5 units

  • rotary sequencer – Arduino Mega 2010 + Adafruit Motor shield – I2C master
  • sound module – Fluxamasynth rev1.0 – I2C slave (this to check)
  • winder – Arduino Duemilanove – I2C slave
  • ballerina praxinoscope – via Adafruit Motor shield
  • battery

I’ll start with the ‘Winder’

Three main elements here for integration into a protoshield to sit on a Arduino Duemilanove clone… :

  1. driving 12 orange 3mm LEDs – MV7744 – via a MAX7221 and the LedControl-library – or ideally a TLC5940 if you can get it to work with an I2C bus
  2. rotary encoder
  3. I2C


Modular Music Box – Arduino polyphonic audio 2

While the Auduino project provides plenty of code tweaks and hardware hacks to make an easy to use but versatile monophonic synth the Modular Music Box requires polyphony…

So I’ve been on a mission to try and find a suitable solution…


Modular Music Box – Hall Effect Sensors

I wanted to test the hall effect sensors I’d bought to see if they could be used for my idea of a rotary magnetic sequencer for the Modular Music Box.

There’s a link to the data sheet and a handy Hall_ Applications_Guide.PDF as well as some useful advice on the Sparkfun Hall Effect Sensor page and in the comments… and the Arduino:Playground provided a bit of code to test the sensor in action…

“You’ve got 3 pins from the front (the triangle edge). Left to right, power, ground, output.
Stick a 10k pull up between 5v and output. Then it’ll latch on/off depending on the poll you use.”


Modular Music Box – MAX7221

The ‘Winder’ in the MMB has a ‘clock face’ of 12 orange LEDs in a circle used to give visual feedback on which way and how much to wind the key… as well as display the ‘winding down’ of the mechanism.

While I could have managed this by using an LED per digital output on the Arduino Duemilanove clone – I thought I’d use it as an opportunity to work with and learn more about LED drivers.


Modular Music Box – Quadrature Rotary Encoder

The Rotary Encoder page at SparkFun has a datasheet, tutorials and additional info and advice in the comments:

  • though medecau’s QuadEncoder Arduino library doesn’t compile…
  • tronixstuff’s Chapter 11 section on the rotary encoder – and the code works well enough – though there’s a fair amount of ‘bouncing’…
  • but with a little additional research I managed to get the Reading rotary encoder on Arduino example code to work – and it does seem to provide the most consistent and ultimately useful response to encoder input for my needs.


Modular Music Box – Power Requirements

Although electronics is not really my strong point, I spent some time working through the spec sheets for all the various components in the Modular Music Box in an attempt to work out total power consumption – to give a better idea of the battery mAh rating we’d need and some idea of how long they’d last…

Things have changed since this early list and I’m sure I haven’t taken everything into account – the LVBoost now in the battery pack is probably only running at ~60% efficiency for a start – but here’s my initial working out for the record…

Modular Music Box – Powering Arduinos

While for testing purposes the Polymer Lithium Ion Battery – 2000mAh sku: PRT-08483 and LiPoly Charger – Single Cell 3.7-7V Input sku: PRT-00726 may do… further reading of Comments and datasheets suggests they may not be a final choice.


  • ~6hrs charging a 2000mAh battery at 280mA max
  • JST connectors can be *extremely* difficult to remove!


  • Battery includes built-in protection against over voltage, over current, and minimum voltage.
  • useful 3 connectors – one to battery, one to circuit, third for 5V that powers the charger – so can charge the battery and power device at the same time.
  • through holes in the PCB for remote LED

So looks like we’ll need something more like:

which seems a bit expensive all in… particularly since we’ll require two battery packs – one in use and one on charge… (more…)

Modular Music Box – Stepper Motors

While worth buying to test the Adafruit Motor/Stepper/Servo shield and get some hands-on experiments done I suspected the Solarbotics GM17 might not be the best motor for the job(s) in the Modular Music Box – requiring +9V, having little torque at low speed and being quite noisy – though it is quite compact and did just manage to fit centrally in the monome size casing alongside an Arduino Duemilanove clone…

Further research suggested that a stepper motor would be the best choice to drive the sequencer and animation turntables. In the interim I tested a stepper motor from Fab Lab Manchester – the six wire PF35T-48L4 – a 7V (though it will supposedly run as low as 5V) 20ohms UNIPOLAR, S/A 3.6deg stepper motor. The Stepper Motor How-tos helped me identify the yellow and orange as one pair, the black and brown as the other and the red and green wires as the center taps.


Modular Music Box – Arduino polyphonic audio 1

Before I emailed Pablo Gian Villamil and he sent me on a link to his class notes (yay!) for Generating polyphonic sound with Arduino I tried to work out his circuitry from his various blog posts and component listings…


Modular Music Box – ballerina automaton?

Really nice example of use of a contemporary praxinoscope…

Moray McLaren – We Got Time

Moray McLaren – We Got Time – Behind the Scenes

Modular Music Box – Adafruit motor/stepper/servo control

I bought a small 3-4.5V DC motor to start testing for the rotary magnetic sequencer I’m planning as part of the Modular Music Box for the Analogue is the new Digital exhibition as part of AND Festival…

Todbot’s Bionic Arduino: Introduction to Microcontrollers with Arduino: Class 3 has a section on Controlling a Motor using a 1N4001 ‘kickback’ diode and TIP120 transistor to “control speed of motor with analogWrite() just like controlling brightness of LED” which I still need to try out.

Then there’s a fairly thorough post at Lucky Larry’s ARDUINO, MAINLY ARDUINO PROJECTS, TUTORIALS… AND A FEW OTHER THINGS blog – Control a DC motor with Arduino and L293D chip… but (sigh)… I think I’ll just buy a shield kit.

Modular Music Box – Planning

First stage planning for fabrication, electrical components, Arduino code and general thoughts for the various modules of the Modular Music Box.

Rotary Magnetic Sequencer


  • walnut box – sides + base – (same dimensions as monome?)
  • subtle Art Nouvea/William Morris style laser etching embellishment?
  • top panel – Alupanel® aluminium composite (can this be cut on the Fablab laser cutter? – NO)/translucent acrylic
  • playback head – to hold 12 x hall effect sensors, 12 x 10k(?) resistors, 12 x 3mm orange LEDs, 12 x 150 Ohm resistors – double check resistor value for multiple LEDs in parallel – cabling
  • melody disks – 64 step – 12 x 3mm x 1mm disk magnets per step – 3 layers of 1mm clear acrylic – edge clips to fold three layers together? have Illustrator prototype template


Modular Music Box

We’ve been invited to contribute to the ‘Analogue is the new Digital’ exhibition as part of the AND Festival in Manchester in October ’10. It’s a modest fee of £400 and Nick and I are still deciding what work we could produce.

We’ve proposed a couple of ideas i response to the brief… attached as a PDF – analogue-digital


News – Latest…

After months of  quietude here at Monomatic development blog central, Lewis has finally found time to update and rationalise the WordPress backend, give the site a bit of a thematic facelift, categorise and tag the existing entries and post about recent Monomatic projects…

Development for  the Modular Music Box should really have been posted from May ’10… and for PEAL @ Kinetica Art Fair 10 from Jan ’10…

Better late than never…