Background info

At our workplace, the group leader was leaving to meet new challenges in a different country. We wanted to give him something as a farewell gift to show that we really appreaciated his work for the group. Basically meaning that it would need to be something personal, but somehow related to the work. After some brainstorming Mr K.K. came up with the idea of making a sculpture based on the mascot of the overall research goal: Iiro who listens to music and produces notes of it. Here is the "photo" of him that we used as out starting point:
Original photo
The original author of the picture is the recipient of the gift, Mr. A.K. Somewhat challenging starting point, but we decided to proceed.

Because the real Iiro should be transcribing music, we wanted that the sculpture would also do something along the same lines. Even though our group has done quite much work on the transcription problem, the methods are not exactly production grade yet. Meaning that they would require some serious hardware to run on. Some brainstorming and we decided to include just "some DSP capable board to do something".

Fabrication

First action point was then to decide the size. In the discussions the total height ranged from about 10cm to almost a meter. Then we decided that 10cm would be definitely too small and the higher end of the scale would mean seriour problems in transportation in the move. So the goal was set to "about half a meter".

The brain, hardware

After some digging for an easy and cheap DSP board that could be obtained quickly the result was that there's no such thing. Then I noticed some discussions of a cheap microcontroller board called Arduino. Open HW/SW platform with active user base and seems to have some power. A couple of days later I had one plugged to my computer and in a less than a minute the "hello world" LED was blinking. Everything seemed to go smoothly.

The first thing was to get some kind of an audio input to the system. The board had multiple analogue input ports, but the easy-to-use routines for accessing them were really slow. Too slow for even crappy AD conversion. Not to mention the varying delays between the reads. Using the information from here I realised how it had to be done: analogue low pass filter to prevent aliasing, DC isolation, moving the signal DC-level to 2.5V with a voltage divider (the AD converter on ATmega328 has a range from 0 to +5V), and then connect that to the AD input. As it's been a while since I learned about analog filters and the component supply at Pile'O'Past'N'FutureProjects was limited, I implemented a cascade of four first-order RC low-pass filters with cutoff at about 4kHz. The rest is in the sofware.

The output side of the system is even simpler: just connect 3 bright LEDs to the PWM outputs of the board with appropriate resistors for current limitation. Why three? Well, somewhere along the way the plan became to consist of a three-channel light organ. And since the whosen colours were red, green, and blue, there was some hopes of obtaining also the mixture colours.

The whole electronic schematic is really simple, as can be seen here:
Electronic schemas
Probably it contains lots of stupid decisions, but it seems to do what it was expected to do. After all, the real "intelligence" is in the software.

The brain, software

The main problem is to sample the input pin at a constant rate that is still large enough to provide enough bandwidth. Here, enough was set to about 4kHz mandating the sampling rate to be at least 8kHz. The analogRead() function is way too slow for this purpose. So, I decided to follow the instructions from the page that provided also the input instructions. Effectively I will hijack the Timer2 of the processor to my own purposes. This means that the PWM pins 3 and 11 can't be used in their original intention. This is not a problem as I needed only three outputs and there are plenty. In practice the timer overflows at the rate of 7.8125kHz. When that happens the value at the AD buffer is read and copied to a global variable and a flag is set. Then the conversion is started again (it takes a while, but it'll be ready for the next sample). The main loop waits until the flag is set and then processes the sample. After the iteration is finished the flag is cleared and waiting for the next sample starts.

The processing has the following features:

Nothing fancy, but at least it is doing something by reacting to the input.

The Processing project for the software is here. Because I used examples of other people to make the code, I want to provide it to others, too. If you find it useful, please send me a note. It would be nice to hear of possible development steps.

The body

The main part of the body was built from a brass pipe. First a heat-proof line was put inside the tube, then the main twists were formed around a spray can. Then 90 degree angles were formed by heating the pipe with a torch. After it looked ok, one end of the line was tied to a bunch of four wires and they were pulled through the pipe. At least that was the plan. Naturally the line broke just before the second angle and some planning was required. Skipping the less funtional ideas, the pipe was finally cut just above the second angle. The wires were there and could be pulled really through the pipe. Then an additional angle piece was made from a pipe with slightly larger diameter so that it fit over the original pipe.

The enclosure of the brains is a small wooden chest from a hobby shop. The surface is burnt to get a nicer look on it. A female RCA connector was embedded to the back wall, as well as the power switch. The body tube was inserted through a hole on the top. A small block of wood with an angled hole was needed to act as the base for the tube while allowing the wires to enter the box.

The head is made of a clear plastic ball split in half. The inside was sanded so that it became lessa opaque and several layers of yellow paint were applied. I drilled a hole with the same diameter as the pipe to the ball to fit the head onthe neck. The fit was so tight that no extra aids were needed. Then the LEDs were added to the wires in the head. After a trial run I decided that a diffusor was needed so that the entire head would glow instead of only a bright spot. After adding that the head was done, and the hat was cut and glued from a sheet of thick paper.

The final piece were the legs. They were twisted from brass wire. The lowest point of the legs is anchored to the chest with wires coming through the lid. The top parts of the legs are just drawn close to the body pipe, and then lots of tin wire is wrapped around them all. Seems to work and not terribly ugly.

Result

The final result of the project can be seen below. The total height is 51cm, so the "about half a meter" was hit quite accurately (mostly by chance, to be honest). I have no video of the operation, but especially acoustic music seemed to produce visually pleasing results. And the coil shape turned out to allow the head to bob sideways if the thing is poked. That wasn't designed, but the effect is nice.

Real-life Iiro

Thanks

I want to thank Mr K.K. for the original idea, designing the filters, and for co-building the body. Also, many thanks to several sources of Arduino related information sources I forgot to note.


black dot

Valid HTML 4.01 Transitional paulus, 2010/01/27