Magic Balloons

At Tinker, we’ve been working on some blue glowing balloon clusters for an upcoming event. They consist of a blue LED and an ATTiny13 microcontroller and they pulse with a slow, compelling sine wave. Selecting the timing of the sine wave was an important consideration, but it was necessary to make a choice about the frequency of the wave oscillation before programming the ATTiny microprocessors and inserting them into the balloons. I wrote this little sketch in Processing to get an idea of what a cluster of glowing balloons would look like and used the same sine wave lookup table we generated for the ATTinys.

The code below produces this.

// A program to simulate balloons with LEDs inside.
// Uses a sine wave lookup table rather than
// a sin wave generated by a function.
// Brock Craft, 9 Aug 2008
// at tinker.it

int num= 60; // number of ‘balloons’
Led[] led;

void setup(){

size(300,300);
noStroke();
smooth();
colorMode(HSB);
led=new Led[num];
for (int i=0;i<num;i++){
led[i]=new Led (int(random(width)),int(random(height)),int(random(255)));
}

}

void draw(){
background(53);
for (int i=0;i<num;i++){
led[i].render();
}
}

void mousePressed(){
for (int i=0;i<num;i++){
led[i].x=int(random(width));
led[i].y=int(random(width));
}
}

class Led{

int i;
int x;
int y;
int col;

// mapping the colour intensity to a sinewave that’s in a lookup table below
int map[]={
0,0,0,0,1,1,1,2,2,3,4,5,6,6,8,9,10,11,12,14,15,17,18,20,22,23,25,27,29,
31,33,35,38,40,42,45,47,49,52,54,57,60,62,65,68,71,73,76,79,82,85,88,91,
94,97,100,103,106,109,113,116,119,122,125,128,131,135,138,141,144,147,
150,153,156,159,162,165,168,171,174,177,180,183,186,189,191,194,197,199,
202,204,207,209,212,214,216,218,221,223,225,227,229,231,232,234,236,238,
239,241,242,243,245,246,247,248,249,250,251,252,252,253,253,254,254,255,
255,255,255,255,255,255,255,254,254,253,253,252,252,251,250,249,248,247,
246,245,243,242,241,239,238,236,234,232,231,229,227,225,223,221,218,216,
214,212,209,207,204,202,199,197,194,191,189,186,183,180,177,174,171,168,
165,162,159,156,153,150,147,144,141,138,135,131,128,125,122,119,116,113,
109,106,103,100,97,94,91,88,85,82,79,76,73,71,68,65,62,60,57,54,52,49,
47,45,42,40,38,35,33,31,29,27,25,23,22,20,18,17,15,14,12,11,10,9,8,6,6,
5,4,3,2,2,1,1,1,0,0,0,0
};

Led (int myx, int myy, int mycol){

x=myx;
y=myy;
col=mycol;
i=int(random(255));
}

void render(){
i++;
if (i>=map.length){
i=0;
}
fill(180,map[i],175);
noStroke();
ellipse(x,y,30,30);
}

}

Blue LED Balloon in the dev center

2 Responses to “Magic Balloons”

  1. magnum Says:

    very informative,excellent article.

  2. Shrympo Says:

    Please post the .mov file!

Leave a Reply