Gogo_box

March 21st, 2008 Georgia.Voudouri@iaac.net Posted in _Georgia Voudouri | No Comments »

The main aim of the boxes’ behavior is to create light and sound effects, being generally always in the same position. Human touch causes rotation which actually leaves them quite static as they are always returning to their initial position after turning 45 degrees clockwise and back. So their movement is actually aiming to initiate the touch sensor of the ones nearby. After that they make a sound which is producing again rotation of a full turn and light at the end. Finally they are reacting to that light by giving sound, producing a continuous loop between light and sound.

one_box.video

3boxes.video

AddThis Social Bookmark Button

activity

March 9th, 2008 erik.thorson@iaac.net Posted in _Erik Thorson, Uncategorized | No Comments »

The goal of my box was to create an activity in which the boxes would respond to the light of one another when activated by sound. When one claps the boxes that receive the signal blink then send the message of the light to the other boxes near to it creating a type of wave effect.

AddThis Social Bookmark Button

Javier’s Box

March 4th, 2008 javier.raya@iaac.net Posted in _Javier Olmeda Raya | No Comments »

This is my Internet 0 Seminar’s distributed computing project. We were exploring how to program a micro-controller to react to 3 stimuli: light, sound, and touch. To do that we had to learn how to script in Arduino and then upload the the program to the micro-controller, which is inside the box, and was assembed with all the components by the students.

CLICK THE IMAGE TO SEE THE VIDEO

javi-i0-still.png

This other video shows how different boxes react simultaneously.

3boxes.png

Here is my script:

#include <WProgram.h>

void setup();
void loop();
int main();

// declare your custom functions
void playNote(byte note, byte duration);
void playRandomNote();
void setLampOn();
void setLampOff();
void rotateClockwise(int steps);
void rotateAntiClockwise(int steps);
void readLightSensor();
void readSoundSensor();
void readTouchSensor();

// set variables

int soundSensorVcc = 0;
int lightSensorPin = 1;
int soundSensorPin = 3;
int touchSensorPin = 2;
int lampPin = 3;
int speakerPin = 4;
int lightSensor;
int soundSensor;
int touchSensor;
int val;
int state;
int mode;

byte names[] ={
‘c’, ‘d’, ‘e’, ‘f’, ‘g’, ‘a’, ‘b’, ‘C’};
int tones[] = {
1915, 1700, 1519, 1432, 1275, 1136, 1014, 956};

int motorPins[] = {
7, 8, 9, 10};
int count = 0;
int count2 = 0;
int motorSpeed = 2;

//declare your custom variables here
int rotation = 0;

// functions executed only once after start up go here

void setup() {
for (count = 0; count < 4; count++) {
pinMode(motorPins[count], OUTPUT);
}
pinMode (soundSensorVcc,OUTPUT);
pinMode(speakerPin, OUTPUT);
pinMode (lampPin,OUTPUT);
digitalWrite(soundSensorVcc,HIGH);
mode = 1;

for (count = 1; count < 3; count++) {
}
}

// functions executed forever in a loop go here

void loop() {
// read all sensors
readLightSensor();
readSoundSensor();
readTouchSensor();
// check mode
switch (mode) {

case 1:

if (touchSensor){
playRandomNote();
rotateClockwise(10);
delay(200);
playRandomNote();
rotateAntiClockwise(10);
delay(400);
playRandomNote();
rotateClockwise(10);
delay(600);
rotateAntiClockwise(10);
delay(1000);
}

if (soundSensor){
setLampOn(1000);
delay(500);
setLampOff(1000);
delay(500);
playNote(’a',1000);
setLampOn(1000);
delay(100);
setLampOff(500);
delay(100);
playNote(’d',1000);
rotateAntiClockwise (50);
}

if (lightSensor){
rotateClockwise(5);
setLampOn();
delay(200);
setLampOff();
delay(200);
rotateAntiClockwise(10);
playRandomNote();
rotateClockwise(5);
setLampOn();
delay(200);
rotateAntiClockwise(100);

}

//////////////////////////////////////////////////////////////

// custom functions should go here

void readLightSensor() {
val = analogRead(lightSensorPin);
if (val < 600) {
lightSensor = HIGH;
}
else {
lightSensor = LOW;
}
}

void readSoundSensor() {
// val = analogRead(soundSensorPin); // discard first reading
val = analogRead(soundSensorPin);
if (val < 80) {
soundSensor = HIGH;
}
else {
soundSensor = LOW;
}
}

void readTouchSensor() {
val = analogRead(touchSensorPin);
if (val > 20) {
touchSensor = HIGH;
}
else {
touchSensor = LOW;
}
}

void rotateClockwise(int steps) {
for (int i=0;i<steps;i++) {
if ((count2 == 0) || (count2 == 1)) {
count2 = 16;
}
count2>>=1;
for (count = 3; count >= 0; count–) {
digitalWrite(motorPins[count], count2>>count&0×01);
}
delay(motorSpeed);
}
}

void rotateAntiClockwise(int steps) {
for (int i=0;i<steps;i++) {
if ((count2 == 0) || (count2 == 1)) {
count2 = 16;
}
count2>>=1;
for (count = 3; count >= 0; count–) {
digitalWrite(motorPins[3 - count], count2>>count&0×01);
}
delay(motorSpeed);
}
}

void playNote (byte note, byte duration) {
for (count=0;count<=8;count++) { // look for the note
if (names[count] == note) { // ahh, found it
for( int i=0; i<50; i++ ) { // play it for 50 cycles
digitalWrite(speakerPin, HIGH);
delayMicroseconds(tones[count]);
digitalWrite(speakerPin, LOW);
delayMicroseconds(tones[count]);
}
}
}
}

void playRandomNote (byte duration) {
count = random(7);
for( int i=0; i<20; i++ ) { // play it for 50 cycles
digitalWrite(speakerPin, HIGH);
delayMicroseconds(tones[count]/10);
digitalWrite(speakerPin, LOW);
delayMicroseconds(tones[count]/10);
}
}

void setLampOn (byte duration) {

digitalWrite(lampPin,HIGH);

}

void setLampOff (byte duration) {
digitalWrite(lampPin,LOW);
}

int main() {
init();
setup();
for (;;)
loop();
return 0;
}

AddThis Social Bookmark Button

the communicative lighthouse: IN ACTION

February 29th, 2008 evita.vlachopoulou@iaac.net Posted in _Evita Vlachopoulou | No Comments »

upload the script here

  

 untitled-1.jpg

The pleasant unexpected behavior that occurred is that the light-houses actually turn off and on one another with their shadows, and their reaction to light changes is immediate and sensitive. The unpleasant is that the sound produced is not efficient to create between the modules the expected blinking effect.

From an energy point of view the system is very demanding, as the batteries get “flatten” easily and the motors worn themselfs out.

Check the individual behavior and collective behavior in the following videos

AddThis Social Bookmark Button

The Box_

February 27th, 2008 bianny.poueriet@iaac.net Posted in _Bianny Poueriet | No Comments »

p1020233.JPG

CLICK IN THE IMAGE TO SEE THE VIDEO

AddThis Social Bookmark Button

The Box

February 27th, 2008 higinio.llames@iaac.net Posted in _Higinio Llames | No Comments »

pc01.jpg

This is my video of the interactive box made for the seminar of Internet 0 at Iaac. You can watch it at YouTube here.

AddThis Social Bookmark Button

February 27th, 2008 alessio.carta@iaac.net Posted in _Alessio Carta | No Comments »

#include <WProgram.h>

void setup();
void loop();
int main();

// declare your custom functions here
void playNote(byte note, long duration);
void playRandomNote(long duration);
void setLampOn();
void setLampOff();
void rotateClockwise(int steps);
void rotateAntiClockwise(int steps);
void wait(long waitTime);

void readLightSensor();
void readSoundSensor();
void readTouchSensor();

// set variables, do not change

int soundSensorVcc = 0;
int lightSensorPin = 1;
int soundSensorPin = 3;
int touchSensorPin = 2;
int lampPin = 3;
int speakerPin = 4;
int lightSensor;
int soundSensor;
int touchSensor;
int val;
int state;
int mode;
byte names[] ={
  ‘c’, ‘d’, ‘e’, ‘f’, ‘g’, ‘a’, ‘b’, ‘C’}; 
int tones[] = {
  1915, 1700, 1519, 1432, 1275, 1136, 1014, 956};

int motorPins[] = {
  7, 8, 9, 10};
int count = 0;
int count2 = 0;
int motorSpeed = 60;
//declare your custom variables here
int rotation = 0;
bool direction;
int position=1;
unsigned long lastBlink;
bool lampState = HIGH;
// functions executed only once after start up go here

void setup() {
  for (count = 0; count < 4; count++) {
    pinMode(motorPins[count], OUTPUT);
  }
  pinMode (soundSensorVcc,OUTPUT);
  pinMode(speakerPin, OUTPUT);
  pinMode (lampPin,OUTPUT);
  playRandomNote(100);
  digitalWrite(soundSensorVcc,HIGH);
    mode = 1;
 
  /* START UP */
  setLampOn();delay(100);
}

// functions executed forever in a loop go here

void loop() {
// read all sensors
  readLightSensor();
  readSoundSensor();
  readTouchSensor();

  /* LOOP */

   if(touchSensor==HIGH){
           rotateClockwise(100);
 
       for (int i=0;i<4;i++)  {
         setLampOn();
     
     delay(500);
      setLampOff();
      delay(500);
  }
  }
    if(soundSensor==HIGH){    
      playNote(’c',1000);
      playNote(’e',2000);
      playNote(’g',3000);
      rotateAntiClockwise(50);
      
     for (int i=0;i<2;i++) {
         setLampOn();
         delay(500);
      setLampOff();
      delay(500);
      
     
     
     
    }
    }
   
       if(lightSensor==HIGH){
      rotateClockwise(75);
 
     
       for (int i=0;i<3;i++)  {
         setLampOn();
        delay(500);
      setLampOff();
      delay(500);
      }
      }
}

// custom functions should go here

void wait(long waitTime) {
  for (long waitCycles=0;waitCycles < waitTime;waitCycles++) {
    readLightSensor();
  readSoundSensor();
  readTouchSensor();
    if(touchSensor==HIGH){
      setLampOff();delay(10);
    }
    if(soundSensor==HIGH){
     rotateClockwise(100);
    }
  }
}
 
void readLightSensor() {
  val = analogRead(lightSensorPin);
  if (val < 600) {
    lightSensor = HIGH;
  }
  else {
    lightSensor = LOW;
  }
}
void readSoundSensor() {
 // val = analogRead(soundSensorPin); // discard first reading
  val = analogRead(soundSensorPin);
  if (val < 80) {
    soundSensor = HIGH;
  }
  else {
    soundSensor = LOW;
  }
}

void readTouchSensor() {
  val = analogRead(touchSensorPin);
  if (val > 10) {
    touchSensor = HIGH;
  }
  else {
    touchSensor = LOW;
  }
}

void rotateClockwise(int steps) {
  for (int i=0;i<steps;i++) {
    if ((count2 == 0) || (count2 == 1)) {
      count2 = 16;
    }
    count2>>=1;
    for (count = 3; count >= 0; count–) {
      digitalWrite(motorPins[count], count2>>count&0×01);
    }
    delay(motorSpeed);
  }
}
void rotateAntiClockwise(int steps) {
  for (int i=0;i<steps;i++) {
    if ((count2 == 0) || (count2 == 1)) {
      count2 = 16;
    }
    count2>>=1;
    for (count = 3; count >= 0; count–) {
      digitalWrite(motorPins[3 - count], count2>>count&0×01);
    }
    delay(motorSpeed);
  }
}

void playNote (byte note,long duration) {
  for (count=0;count<=8;count++) {  // look for the note
    if (names[count] == note) {  // ahh, found it
      for( int i=0; i<duration; i++ ) {   // play it for 50 cycles
        digitalWrite(speakerPin, HIGH);
        delayMicroseconds(tones[count]/10);
        digitalWrite(speakerPin, LOW);
        delayMicroseconds(tones[count]/10);
      }
    }
  }
}

void playRandomNote (long duration) {
  count = random(7);
  for( int i=0; i<duration; i++ ) {   // play it for 50 cycles
    digitalWrite(speakerPin, HIGH);
    delayMicroseconds(tones[count]/10);
    digitalWrite(speakerPin, LOW);
    delayMicroseconds(tones[count]/10);
  }
}

void setLampOn () {
  digitalWrite(lampPin,HIGH);
}

void setLampOff () {
    digitalWrite(lampPin,LOW);
}
 // do not modify the main function
 
int main() {       
  init();
  setup();
  for (;;)
    loop();
  return 0;
}

AddThis Social Bookmark Button

My Box….

February 27th, 2008 alessio.carta@iaac.net Posted in _Alessio Carta | No Comments »

Next on you tube…

dsc06016.JPG

AddThis Social Bookmark Button

domino box

February 27th, 2008 vagia.pantou@iaac.net Posted in _Vagia Pantou | No Comments »

the main purpose of the boxes behavior is to create a series of reactions between the cubes. each box rotates 90 degrees once a sensor is activated so as to face the surfaces of the cubes beside it. when the sound sensor is activated the cube after the clockwise rotation produces light, the light itself activates the sound production from the cube beside. a system of reactions is produced by the cubes, which once it is interrupted by the human action it changes rotating direction and produces light so as to activate a different series of sequencies.

here is the script uploaded to the circuit:

#include <WProgram.h>

 

void setup();

void loop();

int main();

 

// declare your custom functions here

void playNote(byte note, byte duration);

void playRandomNote(byte duration);

void setLampOn();

void setLampOff();

void rotateClockwise(int steps);

void rotateAntiClockwise(int steps);

 

 

void readLightSensor();

void readSoundSensor();

void readTouchSensor();

 

// set variables, do not change

 

int soundSensorVcc = 0;

int lightSensorPin = 1;

int soundSensorPin = 3;

int touchSensorPin = 2;

int lampPin = 3;

int speakerPin = 4;

int lightSensor;

int soundSensor;

int touchSensor;

int val;

int state;

int mode;

 

 

byte names[] ={

  ‘c’, ‘d’, ‘e’, ‘f’, ‘g’, ‘a’, ‘b’, ‘C’}; 

int tones[] = {

  1915, 1700, 1519, 1432, 1275, 1136, 1014, 956};

 

int motorPins[] = {

  7, 8, 9, 10};

int count = 0;

int count2 = 0;

int motorSpeed = 60;

 

 

//declare your custom variables here

int rotation = 0;

bool direction;

int position=1;

 

// functions executed only once after start up go here

 

void setup() {

  for (count = 0; count < 4; count++) {

    pinMode(motorPins[count], OUTPUT);

  }

  pinMode (soundSensorVcc,OUTPUT);

  pinMode(speakerPin, OUTPUT);

  pinMode (lampPin,OUTPUT);

  playRandomNote(100);

  digitalWrite(soundSensorVcc,HIGH);

    mode = 1;

 

  /* START UP */

 

direction = 1;

 for (int i=0;i<25;i++) {

rotateClockwise(1);delay(10);setLampOn();delay(500);setLampOff();

  }

}

 

// functions executed forever in a loop go here

 

void loop() {

// read all sensors

  readLightSensor();

  readSoundSensor();

  readTouchSensor();

  // check mode

  switch (mode) {

  case 1:

 

 /* LOOP */

 

 

 

  if (soundSensor) {rotateClockwise(25);delay(10);setLampOn();delay(500);setLampOff();}

  if (touchSensor) {rotateAntiClockwise(25);delay(10);setLampOn();delay(500);setLampOff();}

  if (lightSensor) {rotateClockwise(25);delay(10);playNote(’a',100);delay(300);playNote(’c',100);delay(300);playNote(’g',100);}

 

 

 

 

  case 2:

    break;

  }

}

 

// custom functions should go here

 

void readLightSensor() {

  val = analogRead(lightSensorPin);

  if (val < 950) {

    lightSensor = HIGH;

  }

  else {

    lightSensor = LOW;

  }

}

 

 

void readSoundSensor() {

 // val = analogRead(soundSensorPin); // discard first reading

  val = analogRead(soundSensorPin);

  if (val < 83) {

    soundSensor = HIGH;

  }

  else {

    soundSensor = LOW;

  }

}

 

void readTouchSensor() {

  val = analogRead(touchSensorPin);

  if (val > 10) {

    touchSensor = HIGH;

  }

  else {

    touchSensor = LOW;

  }

}

 

void rotateClockwise(int steps) {

  for (int i=0;i<steps;i++) {

    if ((count2 == 0) || (count2 == 1)) {

      count2 = 16;

    }

    count2>>=1;

    for (count = 3; count >= 0; count–) {

      digitalWrite(motorPins[count], count2>>count&0×01);

    }

    delay(motorSpeed);

  }

}

 

 

void rotateAntiClockwise(int steps) {

  for (int i=0;i<steps;i++) {

    if ((count2 == 0) || (count2 == 1)) {

      count2 = 16;

    }

    count2>>=1;

    for (count = 3; count >= 0; count–) {

      digitalWrite(motorPins[3 - count], count2>>count&0×01);

    }

    delay(motorSpeed);

  }

}

 

void playNote (byte note,byte duration) {

  for (count=0;count<=8;count++) {  // look for the note

    if (names[count] == note) {  // ahh, found it

      for( int i=0; i<50; i++ ) {   // play it for 50 cycles

        digitalWrite(speakerPin, HIGH);

        delayMicroseconds(tones[count]);

        digitalWrite(speakerPin, LOW);

        delayMicroseconds(tones[count]);

      }

    }

  }

}

 

void playRandomNote (byte duration) {

  count = random(7);

  for( int i=0; i<50; i++ ) {   // play it for 50 cycles

    digitalWrite(speakerPin, HIGH);

    delayMicroseconds(tones[count]);

    digitalWrite(speakerPin, LOW);

    delayMicroseconds(tones[count]);

  }

}

 

void setLampOn () {

  digitalWrite(lampPin,HIGH);

//  analogWrite(lampPin,255);

}

 

void setLampOff () {

    digitalWrite(lampPin,LOW);

 // digitalWrite(lampPin,LOW);

}

 

 

 // do not modify the main function

 

int main() {       

  init();

  setup();

  for (;;)

    loop();

  return 0;

}

AddThis Social Bookmark Button

Box Script

February 27th, 2008 marcelo.riva@iaac.net Posted in _Marcelo de la Riva | No Comments »

#include <WProgram.h>

void setup();
void loop();
int main();

// declare your custom functions here
void playNote(byte note, byte duration);
void playRandomNote(byte duration);
void setLampOn();
void setLampOff();
void rotateClockwise(int steps);
void rotateAntiClockwise(int steps);
void readLightSensor();
void readSoundSensor();
void readTouchSensor();

// set variables, do not change

int soundSensorVcc = 0;
int lightSensorPin = 1;
int soundSensorPin = 3;
int touchSensorPin = 2;
int lampPin = 3;
int speakerPin = 4;
int lightSensor;
int soundSensor;
int touchSensor;
int val;
int state;
int mode;

byte names[] ={
‘c’, ‘d’, ‘e’, ‘f’, ‘g’, ‘a’, ‘b’, ‘C’};
int tones[] = {
1915, 1700, 1519, 1432, 1275, 1136, 1014, 956};

int motorPins[] = {
7, 8, 9, 10};
int count = 0;
int count2 = 0;
int motorSpeed = 40;

//declare your custom variables here
int rotation = 0;

// functions executed only once after start up go here

void setup() {
for (count = 0; count < 4; count++) {
pinMode(motorPins[count], OUTPUT);
}
pinMode (soundSensorVcc,OUTPUT);
pinMode(speakerPin, OUTPUT);
pinMode (lampPin,OUTPUT);
playRandomNote(100);
digitalWrite(soundSensorVcc,HIGH);
mode = 1;
//////////////////////////////////////////////////////////////
for (count = 1; count < 3; count++) {
setLampOn();
delay(100);
setLampOff();
}
//////////////////////////////////////////////////////////////
}

// functions executed forever in a loop go here

void loop() {
// read all sensors
readLightSensor();
readSoundSensor();
readTouchSensor();
// check mode
switch (mode) {
//////////////////////////////////////////////////////////////
case 1:

if (touchSensor==HIGH){
playRandomNote(50);
rotateClockwise(25);
}

if (soundSensor==HIGH){
setLampOn();
delay(500);
setLampOff();
playRandomNote(500);
rotateClockwise(25);
}

if (lightSensor==HIGH){
rotateAntiClockwise(25);
playRandomNote(100);
}

//////////////////////////////////////////////////////////////
}
}

// custom functions should go here

void readLightSensor() {
val = analogRead(lightSensorPin);
if (val < 900) {
lightSensor = HIGH;
}
else {
lightSensor = LOW;
}
}

void readSoundSensor() {
// val = analogRead(soundSensorPin); // discard first reading
val = analogRead(soundSensorPin);
if (val < 50) {
soundSensor = HIGH;
}
else {
soundSensor = LOW;
}
}

void readTouchSensor() {
val = analogRead(touchSensorPin);
if (val > 9) {
touchSensor = HIGH;
}
else {
touchSensor = LOW;
}
}

void rotateClockwise(int steps) {
for (int i=0;i<steps;i++) {
if ((count2 == 0) || (count2 == 1)) {
count2 = 16;
}
count2>>=1;
for (count = 3; count >= 0; count–) {
digitalWrite(motorPins[count], count2>>count&0×01);
}
delay(motorSpeed);
}
}

void rotateAntiClockwise(int steps) {
for (int i=0;i<steps;i++) {
if ((count2 == 0) || (count2 == 1)) {
count2 = 16;
}
count2>>=1;
for (count = 3; count >= 0; count–) {
digitalWrite(motorPins[3 - count], count2>>count&0×01);
}
delay(motorSpeed);
}
}

void playNote (byte note,byte duration) {
for (count=0;count<=8;count++) {  // look for the note
if (names[count] == note) {  // ahh, found it
for( int i=0; i<50; i++ ) {   // play it for 50 cycles
digitalWrite(speakerPin, HIGH);
delayMicroseconds(tones[count]/10);
digitalWrite(speakerPin, LOW);
delayMicroseconds(tones[count]/10);
}
}
}
}

void playRandomNote (byte duration) {
count = random(7);
for( int i=0; i<50; i++ ) {   // play it for 50 cycles
digitalWrite(speakerPin, HIGH);
delayMicroseconds(tones[count]/10);
digitalWrite(speakerPin, LOW);
delayMicroseconds(tones[count]/10);
}
}

void setLampOn () {
digitalWrite(lampPin,HIGH);
}

void setLampOff () {
digitalWrite(lampPin,LOW);
}

// do not modify the main function

int main() {
init();
setup();
for (;;)
loop();
return 0;
}

AddThis Social Bookmark Button