Studio Contrechoc

design & textile & technology entries

Monthly Archives: December 2010

Making a DIY remote control for a performance

We had to do an informative talk about the universe for children (and some adults). Presenting means performing, so pushing the buttons of a computer to get the next image is a bit boring. So the idea was to present with a wii remote control which is already more lively. Sometimes I use the steering wheel with the wii remote inside.

(Wii remote – glovepie – flash CS3)

But having the RF12 transceivers we can do better and have more fun. In principle from the experience of the Gossip project it is not too difficult to make your own remote control things.

We had lots of images from the planets, the milky way, the local group, colliding galaxies (simulations), clusters, bullet cluster, microwave background, red shift, right through to the first 10 to the minus 43 seconds after the Big Bang. Lots of discussions about the cosmic inflation, the funny way to explain why the univers is so dull, that is to say looks the same everywhere and why the universe does not show the most weird manifoldstructures but is just plain simple flat.

We did all kinds of excercizes with the LED’s given to the children, making nice long example distance relations of planets, stars to the milky way center, milky way to galaxies and finally the time scale to the Big Bang.

We needed a device with a few buttons and a transceiver, and a second device which is connected to the computer to steer the FLASH movie with the images and the movies. We could have made the box, but much more funny stuff is readaly available, like the toy piano:

contrechoc.com

So we used this toy piano I had bought a year ago instead of the rather cold looking wii remote. We added the atmega328 and the RF12 transceiver inside. First we tried to use the keys to trigger a signal, but the voltages on the key buttons where not right. In a direct connection to the atmega328 pins the sounds were blurred or not at all playing. So we decided to add four buttons on the piano itself. Then the matter is simply reading the digital HIGH’s and LOW’s.

Of course we don’t send abstract signals to the receiver, we use words. “Love” means go on, “friend” means go back, “perform”, show a movie, “attention” hide a movie….his playing around with more than just cold technical signals like 1,2,3,4, makes it again more interesting. We learnt from this that language is in a sense a remote control between humans!

contrechoc.com

The receiving device is a nice transparent shaker goblet, normally used to make drinks, the colored LED’s are programmed to blinks very fast when idle, and longer when receiving the signal from the electronic piano.
contrechoc.com

The shaker also was an alternative, first we used a scale model of an aeroplane, fitting the atmega and transceiver inside the body. But the cheap FTDI Serial to USB connection we used first only worked on Windows XP and not on MACOS (missing driver) and the flash movie we used to present the images didn’t showed the flv-video’s (caused by flash player 9). So we needed the normal Serial-USB, which works on XP and OS.

We used the words to get the signals across. So we have to manipulate strings in C. This is a bit strange coming from higher programming languages. In C a string is a char array. And the two ways to write these arrays are not straightforward: char sentWords[] and the pointer array char* sentWords[]. You have to be careful which one of these is used in the script and the RF12 lib functions.

But now, playing the animation of the milky way colliding with the Andromeda galaxy I can play along with the music in the toy piano!

Feature: on the windows XP side the connection atmega328 – USB – Serial – Socket Flash was no problem, but on the MACOS side there was a problem, the word sent was split between two data packets coming in, the solution we found was to put two datapackets together using a timer:

var myTimer:Timer=new Timer(200, 2); //repeat this 2 times, this was enough
myTimer.addEventListener(“timer”, repeatSocketRead);

function repeatSocketRead(event:TimerEvent) {
try {
myTextField.text+=arduinoSocket.readUTFBytes(arduinoSocket.bytesAvailable);
} catch (e:EOFError) {
trace(e);//this is to catch an end of file error
}
startAnalyzing();//here we search the incoming string for a word we can use
}

Advertisements

Electret sound 2

Experimenting around with the electret we made a contraption which worked well for 5V. For lower voltages it is less sensitive. Important is the arduino-atmega script. The rate of sampling and taking a productive average.

The following is a combination of the MIT hello world schematics and the LED organ, because neither of the two was giving the result we were looking for, a very sensitive sound sensor. (Of course this depends on sound levels, silence etc….)

contrechoc.com

Then using flash and the serial connection (socket) with serproxy as the diplomat between arduino and flash.

Reading the values in the Serial Window of the Arduino software is not very clear seen the speed with which the data are coming in and the noise over the signal. In the flash script also you must take care of the speed of the data coming in through the socket. Propably on every machine different.

See the signal in flash, the spike is the sound of my voice, you can also see the noise:

contrechoc.com

This is the script we used for the arduino, already trying to get a clean value using two runs of analogRead’s and taking an average.

arduino mic script.txt

Then there is the flash cs3 script (here also given in a text file). Also in this script we have to be careful with the signal, the socket connection looses data frequently producing zero’s or nonsense, you have to filter this out.

flash cs3 script.txt

All of this was done in a room, outside the values must be adjusted, and with wind it will be difficlut to extract the right signal. Alos in a room where there is a lot of noise, talking for instance, the sound sensor will not be very reliable.