Making Things Interactive

May 12, 2008

BOOMBOXES

Filed under: Assignments,Final Project,Jesse Chorng,Paul Castellana — paulcastellana @ 2:44 pm

Boomboxes is an environment designed to promote social interaction through music. It consists of a stationary hub, and five wireless modular seating units that can be moved and stacked to best fit the given social situation. Users can connect their mp3 players to an input jack in the hub to play music through all of the modular units. Each unit has a radio, RBG and white lights, a seat button that detects when someone is sitting down, and all are networked together using Xbee radio transmitters. Although a faulty seat button caused malfunctioning during the final presentation, the particular program we’re providing code for here changes the lighting of the boxes based on the number of people sitting down, so that when music is playing and the boxes are activated, the lights are white until all five boxes are in use, at which point each box lights a different color. If at this point, everyone stands up within 15 seconds of each other the colored lights dances to the music.

Project Website which is currently under construction. For now, check it out here

Here’s our proposal: Boomboxes Proposal

Part’s List: Boomboxes Parts List

Code:

/*
Boomboxes - Social Interaction Through Music
Small Undergraduate Research Grant

Paul Castellana
Jesse Chorng

*/

//----------- STATES ------------//
const int sWaiting = 0; // The system is waiting for audio to be plugged in. Speakers/Lights are off
const int sActivate = 1; // The system detects audio being played. Speakers/Lights are on
const int sAttract = 2; // The system detects motion and inactive; lights turn to attract attention
const int sStandby = 3; // If everyone sitting and someone stands up, wait 30 secs to see if everyone stands up
const int sParty = 4; // If there's enough people around and people are moving, party time! Lights dance to music

int currentState = sWaiting;
int nextState = sActivate;

//----------- INPUTS ------------//
int audioIn = 1; // Audio signal in from stereo jack
int activateSwitch = 9; // Switch to activate Boomboxes
int pirSensor = 8; // PIR Motion swich, sends LOW when motion detected

int seat1 = 6; // Input Pin for Seat 1
int seat2 = 5; // Input Pin for Seat 2
int seat3 = 4; // Input Pin for Seat 3
int seat4 = 3; // Input Pin for Seat 4
int seat5 = 2; // Input Pin for Seat 5

//----------- OUTPUTS -----------//
int recModuleSwitch = 10; // Seat switch to know when someone is sitting
int radioSwitch = 7; // Activates radios in seats
int rgbLed = 12; // RGB LED
int whiteLed = 11; // White LED

//---------- VARIABLES ----------//
int motionCount = 0; // PIR Motion Count
int allSitting = 0; // All sitting true (1) or false (0)
int allStanding = 0; // All standing true (1) or false (0)
int audioVal;

//--------------------------- SETUP ---------------------------//
void setup() {

pinMode(audioIn, INPUT);
pinMode(activateSwitch, INPUT);
pinMode(pirSensor, INPUT);
pinMode(seat1, INPUT);
pinMode(seat2, INPUT);
pinMode(seat3, INPUT);
pinMode(seat4, INPUT);
pinMode(seat5, INPUT);

pinMode(recModuleSwitch, OUTPUT);
pinMode(radioSwitch, OUTPUT);
pinMode(rgbLed, OUTPUT);
pinMode(whiteLed, OUTPUT);

Serial.begin(9600);
}

//---------------------------- LOOP -----------------------------//
void loop() {

switch(currentState) {
case sWaiting: // Waiting to either activate or attract people
Serial.println("Waiting");

digitalWrite(radioSwitch, LOW); // Radios are off
digitalWrite(recModuleSwitch, LOW); // Don't play "Boomboxes" sample
digitalWrite(whiteLed, LOW); // No LED action
digitalWrite(rgbLed, LOW); // No color LED action

if (digitalRead(activateSwitch) == HIGH) { // Check switch to activate
currentState = sActivate;
}

motionCheck(); // Check for motion from PIR sensor
if(motionCount > 30) { // If there's enough motion, go into Attract state
currentState = sAttract;
}
break;

case sAttract:
Serial.println("Attract");

digitalWrite(radioSwitch, HIGH);
digitalWrite(recModuleSwitch, HIGH);
digitalWrite(whiteLed, LOW);

motionCount = 0;

for(int h=0; h < 10; h++) { // When in attract mode, flash lights for 15 secs digitalWrite(rgbLed, HIGH); delay(500); digitalWrite(rgbLed, LOW); delay(500); } if(digitalRead(activateSwitch) == HIGH) { currentState =sActivate; } else { currentState = sWaiting; } break; case sActivate: // Activated mode is simply white LEDs on Serial.println("Activated"); digitalWrite(radioSwitch, HIGH); digitalWrite(recModuleSwitch, LOW); digitalWrite(whiteLed, HIGH); digitalWrite(rgbLed, LOW); if (digitalRead(activateSwitch) == LOW) { currentState = sWaiting; } allSittingCheck(); // If all 5 seats are occupied, go to if(allSitting == 1) { // Standby mode before Party state currentState = sStandby; } break; case sStandby: Serial.println("Standby to Party"); digitalWrite(radioSwitch, HIGH); digitalWrite(recModuleSwitch, LOW); digitalWrite(whiteLed, LOW); digitalWrite(rgbLed, HIGH); allSittingCheck(); if (allSitting == 0) { // If everyone is sitting there is for(int f=0; f<15; f++) { // 15 secs to go into Party State digitalWrite(whiteLed, HIGH); delay(500); digitalWrite(whiteLed, LOW); allStandingCheck(); if(allStanding == 1) { f = 15; currentState = sParty; } delay(500); } allSittingCheck(); if(allSitting == 0) { currentState = sActivate; } } if (digitalRead(activateSwitch) == LOW) { currentState = sWaiting; } break; case sParty: Serial.println("Party!"); digitalWrite(radioSwitch, HIGH); digitalWrite(recModuleSwitch, LOW); digitalWrite(whiteLed, LOW); audioVal = analogRead(audioIn); if (audioVal <= 14) { // Flash lights to music digitalWrite(rgbLed, LOW); } else { digitalWrite(rgbLed, HIGH); } allStandingCheck(); if (allStanding == 0) { currentState = sActivate; } if (digitalRead(activateSwitch) == LOW) { currentState = sWaiting; } break; default: Serial.println("ERROR: default state"); currentState = sWaiting; nextState = sActivate; break; } } //------------------- PIR SENSOR MOTION CHECK -------------------// void motionCheck() { for (int j=0; j < 5; j++) { if (digitalRead(pirSensor) == LOW) { motionCount++; delay(500); } } } //----------------- EVERYONE SITTING DOWN CHECK -----------------// void allSittingCheck() { if (digitalRead(seat1) == HIGH and digitalRead(seat2) == HIGH and digitalRead(seat3) == HIGH and digitalRead(seat4) == HIGH and digitalRead(seat5) == HIGH) { allSitting = 1; } else { allSitting = 0; } } //------------------- EVERYONE STANDING STANDING ----------------// void allStandingCheck() { if (digitalRead(seat1) == LOW and digitalRead(seat2) == LOW and digitalRead(seat3) == LOW and digitalRead(seat4) == LOW and digitalRead(seat5) == LOW) { allStanding = 1; Serial.println("All Standing"); } else { allStanding = 0; } } [/sourcecode]

Overall, we were very satisfied with how the project turned out. It was well received at the Meeting of the Minds, and we even won a prize from the STUDIO for Creative Inquiry. We plan on continuing to develop Boomboxes as concept, further improving the design and functionality of the space. The next public forum in which we are hoping to present the project is the Outdoor Lounge Exhibition of Artscape 2008, in Baltimore, MD, which we are currently on the waitlist for.

May 5, 2008

Boomboxes: Update

Filed under: Final Project,Jesse Chorng,Paul Castellana — Jesse @ 4:36 am

Paul and I have been working around the clock to get our project ready for both Meeting of the Minds and MTI’s final show. For everyone who has been asking about the project, we wanted to post an update to show the class our progress. Here are some pictures of the construction process thats lasted the past few weeks.

More pics can be found on the project’s website here. The site itself is a work in progress- none of the buttons on the left actually work. But check out the blog. And although there are no pics of it, we’ve been working hard on the electronics side of it all as well. If you’re interested stay tuned to the Boomboxes blog/site as we’ll be posting up tutorials, diagrams, schematics, and pics throughout this week. Besides the XBee Radios, everything else is wired up and ready for the final show.

May 1, 2008

Class Review

Filed under: Assignments,Final Writing Assignment,Jesse Chorng — Jesse @ 12:47 pm

Coming into the class, I definitely didn’t know what to expect. As a third year Tepper/H&SS student, I have only taken a small number of classes that didn’t compose of 200 students, numerous teaching assistants, and weekly recitations. The closeness of this particular group was refreshing and it was great getting to know everyone and their interests. It’s been especially helpful to have students actually remember my project and give feedback as well. Besides the skills and general knowledge I gained, I think that the group aspect of the course was the most meaningful.

Making Things Interactive was the first time that I experienced a course full of students from different backgrounds ready to help one another. That combined with the expertise of both Mark and Jet created an environment that I think has great potential to produce interesting and innovative work. If I could make a suggestion, it’d be that there were more small group projects or workshops. Even with Mark and Jet taking time outside of class, promoting students to help one another even more would have a lot of benefits. Many of us had very rudimentary questions that I think sometimes may actually be better solved by another student who was on a similar level and communicated in a shared vocabulary. The one or two times that I was able to speak face-to-face with another student about my project in class really gave me fresh perspectives about how to solve some issues or improve the project overall.

That being said, missing the final demo is one of my biggest regrets this semester. I wanted to take this opportunity to apologize to everyone for missing out.  I should’ve known better and understood that, like us, everyone spent countless hours working on their final projects. I, and I think I can speak for Paul too, greatly appreciate everyone who’s asked us about The Boomboxes anyway and continue to help us solve things out. It took missing that demo to really understand how great it is to be a part of a group like this. 

In the end, I think that for me the class experience outweighed the content. Obviously interactive technology will become ubiquitous if it hasn’t already in a matter of years, so working with the actual tools will only help all of us in our career paths. But again, I basically expected as much when I chose to take the course. What I didn’t expect and what I would like to pass on to other students outside of CFA is that MTI has a unique make up of technical knowledge, logic, artistic expression, etc to really challenge students to think outside the box and work collaboratively.

 

March 28, 2008

Update: Boomboxes State Machine

Filed under: 8: State Machine,Assignments,Jesse Chorng — Jesse @ 12:10 am
Tags:

I had some trouble with getting my state machine to work in class. I got home, went straight to Radio Shack and got headphone cable Y-adapter so I could hook up speakers to hear what’s actually being played. I don’t know what exactly went wrong in class but I suspect that the Shuffle’s output might have been different and wasn’t enough to cross the threshold from ‘Listening’ to ‘Audio Detected’

I got it to work simply by rechecking connections and being able to judge what state it should be in with the help of speakers. It goes from ‘listening’ (red LED), to ‘audio detected’ (blue LED), then to ‘party’ mode (dancing LED bar) via potentiometer,  back to ‘audio detected’, then to ‘party’, and once the music is paused back to ‘listening’  

March 27, 2008

Boomboxes: State Machine

Filed under: 8: State Machine,Assignments,Jesse Chorng — Jesse @ 5:24 am
Tags:

For assignment 8b, I created a state machine that I will work on for the next two weeks to improve for the final project. In this one, there are three states: Listening, Audio Detected, and Party (or dancing lights).  Using a stereo input, the Arduino waits for an incoming signal. Once an audio source is connected and playing music, the Arduino detects it and changes states. Here’s the code:
/*
Boomboxes – Social Interaction Through Music
Small Undergraduate Research Grant

Jesse Chorng

*/

const int sListening = 0; // The system is waiting for audio to be plugged in. Speakers/Lights are off
const int sAudioDetected = 1; // The system detects audio being played. Speakers/Lights are on
const int sParty = 3; // If there’s enough people around, party time! Lights dance to music

int currentState = sListening;
int nextState = sAudioDetected;

int audioPin = 1; // Audio signal in from stereo jack
int partySwitch = 2; // Push button to activate ‘party’ state

int listeningLed = 9; // LED to signal ‘listening’ state
int detectedLed = 10; // LED to signal audio signal detected; ‘detected’ state
int partyLed = 12; // LEDs start to pulse with music, ‘party’ state. IC3915 activated

int audioLevel = 0; // Incoming audio level

void setup() {

pinMode(audioPin, INPUT);
pinMode(partySwitch, INPUT);
pinMode(listeningLed, OUTPUT);
pinMode(detectedLed, OUTPUT);
pinMode(partyLed, OUTPUT);
Serial.begin(9600);

}

void loop() {

//digitalWrite(partyLed, HIGH);
//AudioLevelCheck();
//Serial.println(audioLevel);

switch(currentState) {
case sListening: // Listening State
digitalWrite(listeningLed, HIGH); // Listening LED on
digitalWrite(detectedLed, LOW);
digitalWrite(partyLed, LOW);
AudioLevelCheck(); // Check incoming audio level
if (audioLevel > 1) { // If there is incoming audio, move to ‘detected’ state
currentState = sAudioDetected;
}
break;

case sAudioDetected: // Audio Detected State
digitalWrite(detectedLed, HIGH); // Audio Detected LED on
digitalWrite(listeningLed, LOW);
digitalWrite(partyLed, LOW);
AudioLevelCheck(); // Check incoming audio level
if (audioLevel = 500) { // If push button pressed, go to ‘party’ state
currentState = sParty;
}
break;

case sParty: // Party State
digitalWrite(partyLed, HIGH); // Party LEDs (motion) on
digitalWrite(listeningLed, LOW);
digitalWrite(detectedLed, LOW);
AudioLevelCheck();
if (audioLevel < 1) { // Return to 'listening' state if no audio currentState = sListening; } if (analogRead(partySwitch) <= 500) { // Return to 'detected' state if no pushbutton currentState = sAudioDetected; } break; default: // Default Case aka Error Case Serial.println("ERROR: default state"); currentState = sListening; // Reset back to 'listening' state nextState = sAudioDetected; break; } } void AudioLevelCheck() { // Checks incoming Audio Level by taking int count = 0; // 5 input values in 1 second intervals for (int i = 0; i < 5; i++) { // then takes the average. count += analogRead(audioPin); delay(1000); } audioLevel = count / 5; // Audio Level stores the average } [/sourcecode]  For the final, I hope to replace the pushbutton with sensors that will detect activity. The Arduino will then sense how many people are using Boomboxes and interact by dancing lights when more people are around and/or moving. 

March 19, 2008

Boomboxes: State Diagram

Filed under: 8: State Machine,Assignments,Jesse Chorng — Jesse @ 10:10 pm
Tags:

For my mp3 space, lighting will be a very important part of allowing and encouraging users to interact with the space and each other. For part A of this assignment, I want to make some LEDs dance to the music (using the LM3915 chip I learned about from the midterm) if there are 2 users.                                State Diagram

March 9, 2008

Midterm: Visual LED Sound Meter

Filed under: 7: Mid-Term Project,Jesse Chorng — Jesse @ 10:37 pm

As you recall from my midterm proposal, the goal of my project was to add functionality to an existing SURG grant. I wanted to focus on three things that would make Boomboxes (see here to refresh your memory) more conducive to social interaction. By utilizing the Arduino, I wanted to add visual, audio, and communication to the mp3 space so that it could be more than just a set of speakers and really encourage social activities. The most successful part of my midterm was the completion of a visual representation of the music. Looking back, it was much easier than I had made it out to be. But in order to do this, it required that I learn a lot about integrated circuits, particularly the LM3915 dot/bar display driver and the LM741 op amp chips. I had planed to use the LM741 op amp to boost the line in audio signal but found out later that it wasn’t really necessary (after hours of trying to wire it all out)  There are various schematics available online about how to use the LM3915 to drive 10 LEDs to act as a 30 db volume meter.

I ended up using one different from the schematic I originally drew for the proposal seen below.

For the audio input, I was trying to get PodGizmo’s iPod breakout board to function using other people’s work on getting functionality through the iPod dock connector. The pinout is exceptionally useful and allowed me to see what each of the 30 connectors in the iPod dock does. However, there is limited work still underway to try and figure out how exactly the iPod dock connector functions and a lot of it still remains a mystery.  I was unable to grab audio from the iPod dock connector for an unknown reason and had to use a 1/8″ stereo headphone cable instead. I suspect that pin 21 in the iPod dock has something to do with setting the iPod in the proper mode. When not in proper state, the iPod continued to output music only thru the headphone jack and not the dock connector. I will continue to work with it and update this post as soon as I get a better understanding of the iPod Accessory Protocol. 

Here is a short video of my meter in action: 

The Arduino code I used was very very basic because working with ICs became my main focus. On the Arduino side all I wanted it to do was detect when music was being played and at what level. Since the music outputs a 0 – 1.5V signal, all I did was read that and print it out on the display.

/* iPod Analog Read*/

int ipodPin = 2;       // sets analog input pin from iPod audio out
int val = 0;            // variable to store the value coming from audio out

void setup(){
     Serial.begin (9600);
}

void loop(){
     val = analogRead(ipodPin); 
     Serial.print(' The iPod input is: ');
     Serial.print(val);
     Serial.println( V);
} 

February 28, 2008

Midterm Proposal: BOOMBOXES

Filed under: 7: Mid-Term Project,Jesse Chorng — Jesse @ 10:19 pm

PROPOSAL: 

Currently, I am working on a SURG grant involving music and social interaction. Before taking the class, the project only consisted of an outdoor seating space with built in speakers to plug an mp3 player into. To better understand, here’s the SURG Proposal pdf. 

The space will be composed of several benches varying in size that users can move and manipulate according to their needs. In the Google SketchUp pic below, you can get a rough idea about how the space will function.

Boomboxes SketchUp

Although the picture doesn’t show it, there will be cables running from all the individual benches into a main station (the tallest block in the pic). The main station is where the user can dock their iPod and make their song selection. There will be a mini stereo plug for non-iPod users as well, although information gathered from here will be more limited but more on that later.After choosing the song, the user will then see the bench begin react to the music. Individual benches will have strips of LEDs horizontally going up the side of the bench, much like an equalizer bar.  Each individual bench will display the levels and ‘dance’ along with the music and thus encouraging others to as well.  Meanwhile, the Arduino will gather additional information from the iPod and upload the Artist and Track titles. As a researcher, I can then easily see what is being played and during what time of day anywhere I have access to the internet.  The benches will become a social gathering area and an interactive installation by giving a space where students can interact with each other and music. They will even be able to remotely interact with the bench by checking the online status of what’s going on through something like Twitter

MIDTERM PROPOSAL: 

My plan for next Thursday is to get the Arduino talking to an iPod, as well as getting it online. Using the Ethernet Shield sold by Ladyada, I will connect the Arduino through an ethernet cable and Twitter some actions coming from the iPod.  If all goes well, by next week, I will be able to send simple commands to an iPod through programming, have the Arduino Twitter something like “The iPod is playing music” or “The iPod just changed tracks”  As a bonus, I hope to use the LM3915 IC to get the level meter and 10 LED indicator to function as well.

MIDTERM SCHEMATIC.

The CODE SKETCH will be something like this:
If voltage of Analog Input 1 is above 1, then song is playing.
If song is playing, Twitter “A song is playing”
Wait until song is changed.
When track changes, Twitter “The song has changed”
When music stops and voltage is 0, nothing is connected.
If nothing connected, Twitter “Nothing connected”

This seems a bit simple, but I think the coding and adapting the awesomely cool Botanicalls Twitter code will be a large part of the project and a huge step towards the final project. The level indicator does not interface with the Arduino but it will be going all the while.

February 12, 2008

Arduino + Servo + DC Motor

Filed under: 5: Making Motion,Jesse Chorng — Jesse @ 12:47 pm

Nothing crazy going on here. Just a pulsing status LED along with a DC motor speeding all the way up and all the way down. It is powered by the 9V batter clip the starter kit came with. The servo, powered by 5V from the board, is only moving between two positions.  You don’t see much in the video but you can hear the motors changing along with the LED. 

/*
 *  Arduino Motor Control
 */

int count = 5;                      
int statusPin = 11;                  
int servoPin = 10;               
int motorPin = 9;                  

void setup()                      
{
  pinMode(statusPin, OUTPUT);        
  pinMode(servoPin, OUTPUT);      
  pinMode(motorPin, OUTPUT);       
}

void loop()                       
{
  for (count = 5 ; count <= 255 ; count += 5)   // Count by 5 to gradually increase steps
  {
        analogWrite(statusPin, count);             
        analogWrite(servoPin, 180);           
        analogWrite(motorPin, count);             
        delay(50);                             
  }
  for (count = 255 ; count >= 5 ; count -= 5)   // Count down by 5 to gradually decrease steps
  {   
        analogWrite(statusPin, count);            
        analogWrite(servoPin, 60);           
        analogWrite(motorPin, count);             
        delay(50); 
  }
}

January 30, 2008

Tutorials: RGB Mood Light

Filed under: 3: LadyAda Tutorials,Jesse Chorng — Jesse @ 3:13 am

The pulsing LEDs started giving me a headache while I was learning the tutorials. I then started thinking about how I could write something smoother and thus be gentler on my nogin. After looking around and finding something on MAKE (always do), I was able to see how they created gradual increases/decreases in light.  Moreover, I spent much more time than I had expected to finding stuff and fixing code, which I guess was the point of the tutorials and getting to know the Arduino.  Here’s a video of it in action:

 

int count = 0;                    // Sets up a counter for loops
int intredPin = 11;                   // Red LED connected to digital pin 11
int greenPin = 10;                    // Green LED connected to digital pin 10
int bluePin = 9;                      // Blue LED connected to digital pin 9

void setup()
{
   pinMode(redPin, OUTPUT);
   pinMode(greenPin, OUTPUT);
   pinMode(bluePin, OUTPUT);
}

void loop()
{    
   for (count = 0 ; count <= 255 ; count -= 5)    // Count up by 5 to gradually increase steps
   {
   analogWrite(redPin, count);                    // Gradually increases
   digitalWrite(greenPin, HIGH);                  // On
   digitalWrite(bluePin, LOW);                    // Off
   delay(50);
   }    

   for (count = 255 ; count >= 0 ; count -= 5)    // Continues pattern over and over
   {
   digitalWrite(redPin, HIGH );                   // Remains on
   analogWrite(greenPin, count);                  // Gradually decreases
   digitalWrite(bluePin, LOW);                    // Remains off
   delay(50);
   }
 
   for (count = 0 ; count <= 255 ; count -= 5)    
   {
   digitalWrite(redPin, HIGH);                    
   digitalWrite(greenPin, LOW);
   analogWrite(bluePin, count);
   delay(50);
   }    

   for (count = 255 ; count >= 0 ; count -= 5)
   {
   analogWrite(redPin, count);
   digitalWrite(greenPin, LOW);
   digitalWrite(bluePin, HIGH);
   delay(50);
   }
   
   for (count = 0 ; count <= 255 ; count -= 5)
   {
   digitalWrite(redPin, LOW);
   analogWrite(greenPin, count);
   digitalWrite(bluePin, HIGH);
   delay(50);
   }    

   for (count = 255 ; count >= 0 ; count -= 5)
   {
   digitalWrite(redPin, LOW);
   digitalWrite(greenPin, HIGH);
   analogWrite(bluePin, count);
   delay(50);
   }
}
Next Page »

Create a free website or blog at WordPress.com.