Updates on trying to create an interactive modular music box [previous post]. A physical version of this interaction --
with 8 spinning shafts that different patterned discs can be placed on, generating different sounds. The discs represent a binary encoding of different rhythms, and each shaft has its own sound associated with it.
Constructed a first prototype with a stepper and single spinning spindle. Mounted the stepper with velcro, just to test with, and get a sense for the ease (or lack of) of replacing a disc while the spindle is spinning. It proved not to be that easy – the disc needs to be a little raised. I also realized how important tension on the stepper is – without securing everything firmly, the belt would skip over the motor.
My initial plans for this was to use a light sensor to detect the on/off pattern of the disc – but while playing around with it it occured to me that the presence of a hand removing and placing the disc would intefere a great deal with the light readings, and so started doing some research on alternative short-range distant sensors. I found this optical sensor (QRD1114) that senses reflectance at a 1cm range which seemed ideal, and cost only $1.
The velcro fixing of the stepper was a temporary measure – for the next prototype I added another layer of material to mount the stepper securely. I prototyped this with cardboard first to figure out where to place the motor to get adequate tension – though in the long run this is probably not the best idea, and creating a mechanism that would allow me to add and remove tension on the belt would be better – even if I could plan for exact placement for adequate tension, getting the timing belt in place would be a struggle... ie to have it loose enough to take off an on, but yet tense enough to make all the pulleys move.
I hooked up an 8ohm speaker to the arduino to see if the sensor worked well, and if the whole concept of this binary encoding of sound made sense. The speaker sounds terrible and I was using arduino's tone function for testing, but it works. I did notice the motor has a bit of a stutter – something to be looked into – not sure if its to do with inadequate power / too much friction / something with the motor itself / the code..
To help with the mechanism for removing and placing discs, I tried 3d printing a tapering octagonal part (with a lot of help from a friend), with a small lip to ensure the disc was slightly raised and one could grab hold of it easily. The idea with the peg was to have the disc lock in place so it would maintain time with the other discs, and by having a square or octagonal peg, the encoded rhythm of the disc could be offset by a fixed measure. I chose an octagonal instead of a square to increase the number of ways the disc could lock in place, potentially making it easier to take on and off.
For this next iteration, I moved on to using a raspberry pi, while I waited for the rest of my parts to arrive. I wanted the whole unit to be independent, running without my computer, and so the pi seemed to be the best option. Instead of using a stepper library, I found a tutorial for activating each coil of the stepper in the right sequence, and I used an analog-to-digital convertor to get the analog input from the sensor into the pi.
The next challenge was to figure out a way to get sound generated on a pi programatically. I needed the sound to be polyphonic, with as little latency as possible, and ideally a synthesized sound that could run for as long as I liked. I wanted to try finding something that worked in python, so I didn't have to have a complicated channel of communication (going to the browser for example). I found a few possible tools I could use with python - Pyo, sonic pi with python-sonic, and whole listing of other possible tools. I tested on my computer first, simulating the sensor on/off status with the keyboard :
While this worked, getting the library installed and working on the pi proved to be a nightmare. Before I could get started, my SD card overheated, forcing me to redo all the setup I had done on the pi just to get it back to the state it was in. It turns out installing sound tools on the command line on the pi can be pretty complicated – I struggled for a while before asking for help / getting some input. I was suggested a few different options – using sound files, and a simpler tool that would let me pause/play files; using pure data; or openframeworks. For some reason I had forgotten about the GUI on the pi, and how much easier that could make things. I also realized that I was focussing on the wrong things at this stage – it made more sense to get the whole mechanism working with my laptop, and then optimize later.
I also got some input from Hayley on the stepper – it seems steppers have a sweet spot in terms of how many steps to take at a time, and how much to pause between activations of each coil.
Once all the parts arrived I prototyped the whole mechanism with cardboard. It took a while to get the measurements right and figure out how to lay out all the components, to create the illustrator file for laser cutting.
The cardboard prototype turned out to be a bit of a fail – it affords a different tolerance from wood, and my bushings kept falling out. I ran out of cardboard too, so it didn't make sense to redo this – decided to try with ply instead to have something more rigid.
Moved on to 1/8" ply wood. The ply was a bit warped, and the weight of the parts made it sag, which made it hard for the motor pulley to catch the belt – I tried moving it by hand and it wouldn't maintain contact with the belt. I was limited by the length of the threaded portion of my standoffs, so ordered new standoffs with a threaded rod to maintain some flexibility with the eventual thickness of the material.
In the meantime, I worked on the arduino and sensors, sending serial data to Processing. I used the Minim library to generate sounds, and used 3 sensors to ensure I could get polyphonic sounds.
The other problem with the previous prototype was the location of the idle pulley – I had placed it right next to the motor, and so pulling the idle pulley back reduced the contact the belt had with the motor. I laid it out again with the idler exactly opposite the motor pulley, but the sag and warp of the wood still proved to be problematic. With some helping hands I tried holding the wood up and increasing the tension on the idler to see if I could get all the pulleys to move, moving the motor by hand – this seemed to work, but still very janky and unreliable. I also bought thick acrylic to get past the warp problem, but not so confident about the current layout – and so holding off on cutting the acrylic just yet.
I got some input from friends with mechanical engineering backgrounds, and learnt about the concept of 'angle of wrap' – there's an ideal maximum angle at which the belt should wrap around the pulley to ensure it catches, and it seems with the current layout I'm getting at best a 144 degree angle, when it should ideally be less. I tried removing the two shafts closest to the motor to reduce the angle of wrap on the motor pulley, though with the current configuration that leaves too much slack. I also learnt that the number of teeth and the spacing on the belt and pulley makes a big difference – if I were to use a configuration with the teeth set closer, there would be a better chance of maintaining contact.
For next steps, I'm contemplating a few different options:
- laying out all the pulleys in a line so the belt makes contact on both sides of each pulley – though I would need to ensure the perfect amount of tension, as a bit of slack would translate to no contact at all
- instead of creating tension by pulling outwards, use the idler to push the belt inwards, and some well lubricated wheel/shaft that would allow the back of the belt to move smoothly
- reducing the number of spinning shafts to reduce the angle of wrap on each one
I was pretty confused about the best way to proceed. I wanted the final version to be in acrylic, but wasn't convinced the existing configuration would work, and given how expensive the acrylic was, I didn't want to use it for a casual test. I spoke to Danny, who was very helpful and suggested thinking about it much like a code problem that required slow and careful debugging – not changing too many variables at once. The main issue was the lack of stability – the was too think and warped and the standoffs were also very thing and sparsely placed at just the four corners. Further, it seemed like some of the shaft collars were screwed too tightly against the bushings, creating too much friction for the shafts to move freely.
So I set about testing with thicker ply, along with beefier standoffs, using 10 instead of 4 – trying to fix the stability problem so I could more clearly observe what other issues there might be.
prototype 8 // 'final' version
This seemed like a good point to move on to acrylic. For the idler pulley, instead of making several adjustment holes for the fixing screws, I made a single set based on the location identified from the previous prototype, realizing that if I needed to change this a little, I could always change the location of the bushing+shaft in relation to the screws.
I set about to cutting the acrylic and soldering all my connections – 8 sensors x 4 connectors + 8 LEDs x 2 connectors – 2 ends to solders for each, totaling in 96 connections. It took a while.
Assembling with reflective black acrylic was far more challenging than wood — the gaps between the layers were just about right for my hand to fit in and I had to bend my head to look through — the reflections made it rather confusing.
I also struggled with the standoffs — I thought threaded standoffs would be good for adding more stability, but it was a struggle to reach in and screw the correct standoff — the movement would cause the rod to move as well, sometimes unscrewing it from an existing standoff part. Next time unthreaded would definitely be the way to go.
I made the mistake of being too confident about this new material — I put in all the wires and fully assembled everything before testing the mechanism, and when I did test it, it failed… not even a tiny bit of movement.
I realized there was far too much tension, and I'd have to remove the wiring to debug it. I also removed the idler pulley as it seemed like there wasn’t much of a need for it – there was already enough tension. This still didn’t help. I then tried working without the top layer, but this still didn't help. It allowed me to observe better though – the timing belt kept skipping. Thanks to invaluable help from Amitabh, we were able to diagnose the problem – there wasn't enough contact with the pulley and the belt. While the ply wood I used earlier had some springiness and give to it, the acrylic was extremely rigid, and hence my measurements did not translate so well. The shafts were leaning in a bit as they had been placed too far out, which cause the pulleys to be at an angle, only partly making contact with the belt. Since it was too late (and expensive) to recut the acrylic, a hack/jugaad solution was found — dowels fitted into the standoffs with a bit of tape and lots of vaseline. They applied enough pressure while keeping some amount of springiness to help the belt make contact.
When I put the top layer back on however things stopped working again. I realized that the shafts were leaning so much that they were resting on the bushing and the friction was just too much, and so I removed the bushings from the top layer, which did work.
As for the pegs, it seemed that 8-sided pegs was too much — there wasn’t enough surface area on any side to ensure the discs stayed in that orientation, and so went for a 4-sided peg instead. It took a bit of trial-and-error (and a lot of help from Nick) to get the dimensions just right, so the discs fit snuggly but were easy to take off and put on as well.
While creating the discs, I incorporated a suggestion from Luming to create discs with different amounts of divisions, allowing for the creation of different time signatures, and patterns that would phase in and out of each other. Some had 32 divisions, some 24 and some 20.
I experimented with different synth sounds that Tone.js provided by default, but they didn't seem to sound the same as the digital version – they mushed together to a single un-ending note. I realized this was because of the baud rate I was using – the signal needed to travel faster. I also tried playing around with different sounds, such as samples of animal sounds, and recordings I made. [ video to be uploaded soon ]
I presented this at the winter showcase with 2 sets of headphones so 2 people could play together. It was great to observe how people interacted with it, and provided many useful ideas for improvement. Some people immediately understood how it worked, and got right into it — they would use trial and error to pick the kind of sounds they were looking for, and developed some non-verbal communication between them as they tried creating and evolving the sounds, which was nice to see.
There were others who weren’t quite clear on how the device worked – I hadn't realized that there was a puzzle-ish nature to the device until it was pointed out to me. Since the sensors were so hidden it wasn’t apparent that the disc was being ‘read’ (much like a CD). I made the mistake of not putting the LED right where the sensor was (and instead on the opposite side), so the indicator/visual-feedback was not intuitive. I think this could be improved by creating a small led strip that resembled a switch that was getting turned on and off, and have it be right on the edge of the disc, so it appears to make contact with the light. It was also suggested to make an etching of a disc on the acrylic to indicate the method of interaction.
If people started interacting with it when there were already discs placed, they were less likely to figure it out – it helped starting from scratch and letting the sound build up. I think if the sounds were more distinct it would help even more. The single octave of synthesized sound often blurred into each other. I did play the animal sounds for some people, which they enjoyed. I also tried working with samples from midi instruments, but there was far too much of a crackle as the sounds came on and off (something to look more into in general). I also realized much later that the shafts initial position needed to be calibrated such that the square pegs were all in the same orientation relative to the sensor – one or two people (presumably musicians) did point out that the timing was slightly off.
The mechanism also got moody by the second day, so it would be ideal to recut the acrylic with measurements more suited for the material to make a more robust setup. I'd also like to set up a perfboard to get around the wire madness.
It would also be nice to add a video feature in the future, as well as some controls – for example, for the motor speed, or controls to change the sounds scape (I was doing this through my computer, the controls weren't provided to the user for this)