Monday, November 30, 2009

Prototype 9 - Portable Speaking Wall

After an evening of prototyping, we have some refinements to the prototype.

Here it is installed again:



Improvements:
Circuitry Enclosure

We cleaned up a lot of the wiring, and got the Arduino and other components into our plastic project enclosure.

Foil Stickers

We made foil 'play' and 'record' stickers out of contact (shelf-liner) paper and our trusted friend, aluminum foil (the contact paper costs about $4.50 per roll).

Speaker Enclosure

Like the Arduino, the speaker/mic got its own box - made out of foam core - for a much cleaner look.

Power Supply

Everything runs on 2 9V batteries so it's very portable.



And here it is in use... what a flirt!



Still to do:

Stickers/foil refinement

We need to find something that's a little stickier. We're thinking the vinyl graphics that the print shop offers will be a good place to start. We also need to work on our graphics. While we're running foil behind the sticker, it might as well also replace the wiring so that can be flat too.

Conductive paint test

We still want to see how this works with conductive paint. This is related to the next point...

System Integration/Armature Fabrication

We're thinking that whether we install this in a public place for a while, or just for our presentation, we'll make a roughly 2'x3' (or slightly bigger) panel that can hang on a wall, and provide a flush smooth surface so all you see are the graphics and the little microphone/speaker.

Amplification/Component Separation

We will try a quick feasibility check to see what it would take to amplify the range of the microphone and speaker, especially if there could be a cheap and simple swap-out for our current recording module.

Wednesday, November 25, 2009

Wall as a Boombox

We were able to get both the record and play functions of the RadioShack recording module to work, controlled by the Arduino board. We have two foil sensors - a 'play' and 'record' button - which we will refine further in the final installation, either with conductive paint or foil stickers. The Arduino board is portable and could be installed briefly with the stickers or paint - when it's removed, and the paint or stickers could potentially remain, leaving a trace of the interaction.

The speaker is used as the microphone also, and it's very quiet. We're considering whether we want to upgrade and/or separate these components.

We simplified our code a lot this week:
#include
CapSense cs_4_2 = CapSense(4,2); // PLAY FOIL CONNECTED TO PINS 4 and 2, 2 is sensor pin
CapSense cs_5_3 = CapSense(5,3); // REC FOIL CONNECTED TO PINS 5 and 3, 3 is sensor pin
int recPin = 12;
int playPin = 13;

long start, recLength = 1000;
float threshold = 0.35;
float playTotal, recTotal;


void setup()
{
// cs_4_2.set_CS_AutocaL_Millis(0xFFFFFFFF); // turn off autocalibrate on channel 1 - just as an example
Serial.begin(9600);
pinMode(recPin, OUTPUT);
pinMode(playPin, OUTPUT);
}

void loop()
{
// GET RAW SENSOR DATA; TUNE POTENTIOMETER/RESISTOR FOR 0-60 RANGE:
start = millis();
playTotal = (float)cs_4_2.capSense(30) / (float)60; // PLAY FOIL
recTotal = (float)cs_5_3.capSense(30) / (float)60; // REC FOIL


// DEBUG SCREEN
Serial.print("PLY: ");
Serial.print("\t");
Serial.print(playTotal);
Serial.print("REC: ");
Serial.print("\t");
Serial.println(recTotal);

// IF WITHIN THRESHOLD
if(playTotal >= threshold || recTotal >= threshold) {
// IF PLAY, PLAY
if(playTotal > recTotal) {
play(recLength);
}
// OTHERWISE, RECORD
else {
recLength = record();
}
}
}

long record() {
long startTime = millis();
while (recTotal > threshold) {
digitalWrite(recPin,HIGH);
recTotal = (float)cs_5_3.capSense(30) / (float)60; // REC FOIL
}
long endTime = millis();
digitalWrite(recPin,LOW);
Serial.print("REC - Length:\t");
Serial.println(endTime-startTime);
return endTime - startTime;
}

void play(long howLong) {
Serial.print("PLAY - Length:\t");
Serial.println(howLong);
digitalWrite(playPin,HIGH);
delay(10);
digitalWrite(playPin,LOW);
delay(howLong);
}

So, there is a 'record' foil and a 'play' foil. When you put your hand within the 'threshold' distance from the record foil, it starts recording and counts how long you kept your hand there. When you put your hand near (within the same threshold) the 'play' foil, it plays (and ignores input for the length of the recording).



Here it is in action. It's quiet, but it works!




Next steps:
Pick a site on campus, probably in Avery Hall
Build/Refine a housing for the Arduino board, including power (9V battery or wall-plug)
Design and test the stickers/conductive paint
Look into the speaker sensitivity/microphone power issue

Sunday, November 22, 2009

Prototype 6.1 - Recording Module Hack



We can now control the 'play' function of the RadioShack recording module. There was a simple piezo-type switch on the board, so we just traced the foil circuitry back to a point where we could solder two leads. We now have a switch that we can control with a relay from the Arduino. We tested that wiring using a simple on/off program before soldering. There's also a 'record' switch that is set up in a similar way, so we may wire into that too.

The green wires at the bottom of the photo are our new leads:


Possible input/output logic could be:
Put your hand 24-12" away, we record you.
Move your hand <12" away, we play back what we recorded.

This could be a self-contained device, run off of 9V batteries and mounted to the wall, but it could also be put on the street or in an unexpected location.

Thursday, November 19, 2009

Prototype 6 with Potentiometer and Sound Output

We made two big improvements to the prototype...

1. We added a potentiometer as a variable resistor. This allows us to 'tune' the range of input values.

You can see in the video that we want to set the resistance so that when no one (or hand) is around, the circuit is completely off, and when we put our hand close but not touching it is fully on. This potentiometer is rated 10 kOhms, with a variation +/- 20%.

2. Sound as output. The first component we tried was a simple buzzer.

We're using a simple on/off pin of the Arduino, so at this point much of our previous work with getting a range of inputs is now moot. In this version of the prototype, we just chose a threshold to turn the buzzer on.

3. More fun sound!

We picked up this little recording module for about $10 at RadioShack. It is a self-contained unit with enough memory to record up to 20s of sound, a thin little speaker, a 'record' button (it uses the speaker as a microphone too) and a 'play' button, all powered by a 9V battery. Of course our hope is to hack the trigger switch so that we can us it as output for our Arduino. Stay tuned!

Tuesday, November 17, 2009

Planning

We met with David today to discuss progress and next steps... through to final steps.

Prototyping to explore:
Input
Potentiometer as variable-resistor
Foil stickers and conductive paint as alternatives to metal architectural elements
Output
Multiple LEDs
Multiple Flexinol
Sound - changing frequency/volume by proximity/location

Scenarios/contexts to explore:
Gallery
We think that by using a combination of conductive paint and the existing metals in a space we could make an engaging installation. This would be well-suited to a circulation space in Avery.
Cafe
We're thinking of the situation at Hungarian Pastry Shop near Columbia where each table has its own little lamp. What if you got to your table and waved your hand at the wall to turn on the lamp for 5 minutes? You could also adjust the brightness by putting your hand closer or further. This is potentially very functional, but imagine how hilarious it would be if we put the metal sensors over the tables instead of next to them... people waving their hands about every 5 minutes. Fun.
NYC Construction Scaffolding
The urban context is very interesting for us. The temporary scaffolding that goes over sidewalks in New York when there is building construction are very interesting temporary spaces. They provide light at night, shade in the day and some shelter, so they are at times places where people linger, but much of the time uncomfortable places that people rush through. We're interested in using the various metal parts as conductive sensors. One scenario would be to attach to a few of the columns as sensors, and as people get very close to them, a sound is played. Each column would have its own pitch (although probably too sophisticated for us, you could imagine this as speech, a song...) and you could control the volume by your proximity to the column.
In the next week or two we'll be testing our prototypes in and around Columbia, so watch for us, and don't be surprised if the architecture around you starts to play with you!

Too Funny Conductive Paint

On the topic of conductive paint...


The girls (and floor, as if you were looking THERE) are painted with skin-safe conductive paint called Bare Conductive. Very fun.

Monday, November 16, 2009

Prototype 5 - 2 Sensors, 2 Outputs

Improvements this week:
  • 2 separate foil capacitance sensors
  • 2 variable-brightness LED responses
  • Better processing logic to normalize the currently sensed value
The setup:


Each sensor is connected to 2 pins on the Arduino board. Our CapSense functions set one pin high and measure the delay between the signal and sensor pin.

Rather than blinking (based on a 'delay' variable which actually slowed our sensing too!) the LEDs now respond in brightness (voltage, power) by using the PWM pins on the Arduino. This allows for a continuous loop without a delay.

We also found this DigitalSmooth library on the Arduino website, which we modified to get the maximum value of the most recent group of samples. That gives us much more flexibility in the metallic 'sensor' - we can normalize the range to a percentage of the (recent) maximum. This change in logic makes the system much more resilient, and able to get a useful range of values from a wide variety of physical sensors.

Here's our code this week:

/*
* CapitiveSense Library Demo Sketch
* Paul Badger 2008
*/

#include
CapSense cs_4_2 = CapSense(4,2); // 10M resistor between pins 4 & 2, pin 2 is sensor pin, add a wire and or foil if desired
CapSense cs_5_3 = CapSense(5,3); // 10M resistor between pins 4 & 6, pin 6 is sensor pin, add a wire and or foil

/* digitalSmooth
Paul Badger 2007
*/

#define filterSamples 13 // filterSamples should be an odd number, no smaller than 3
int sensSmoothArray1 [filterSamples]; // array for holding raw sensor values for sensor1
int sensSmoothArray2 [filterSamples]; // array for holding raw sensor values for sensor2

long start;
long total1, maxData1; // variables for sensor1 data
long total2, maxData2; // variables for sensor2 data
float normalTotal1, normalTotal2;


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

void loop()
{
// GET THE CAPACITANCE VALUE
start = millis();
total1 = cs_4_2.capSense(30);
total2 = cs_5_3.capSense(30);

// FIND THE MAX OF THE PAST FEW SAMPLES
maxData1 = getMax(total1, sensSmoothArray1); // every sensor you use with digitalSmooth needs its own array
maxData2 = getMax(total2, sensSmoothArray2); // every sensor you use with digitalSmooth needs its own array

// NORMALIZE CURRENT SAMPLES TO RECENT MAX (GET PERCENTAGE VALUE)
normalTotal1 = (float)total1 / (float)maxData1;
normalTotal2 = (float)total2 / (float)maxData2;

// DEBUG print sensor output 1
Serial.print("4_2: ");
Serial.print(total1);
Serial.print("\t");
Serial.print(maxData1);
Serial.print("\t");
Serial.println(normalTotal1);

// DEBUG print sensor output 2
Serial.print("5_3: ");
Serial.print(total2);
Serial.print("\t");
Serial.print(maxData2);
Serial.print("\t");
Serial.println(normalTotal2);


// WRITE 0-255 TO DIGITAL PIN FOR LED OUTPUT

analogWrite(9, (normalTotal1 * 255));
analogWrite(10, (normalTotal2 * 255));
// delay(1000);
}

// GETMAX FUNCTION

long getMax(int rawIn, int *sensSmoothArray){ // "int *sensSmoothArray" passes an array to the function - the asterisk indicates the array name is a pointer
int j, k, temp, top, bottom;
long total;
static int i;
static int sorted[filterSamples];
boolean done;

i = (i + 1) % filterSamples; // increment counter and roll over if necc. - % (modulo operator) rolls over variable
sensSmoothArray[i] = rawIn; // input new data into the oldest slot

for (j=0; j< (filterSamples - 1); j++){ if (sorted[j] > sorted[j + 1]){ // numbers are out of order - swap
temp = sorted[j + 1];
sorted [j+1] = sorted[j] ;
sorted [j] = temp;
done = 0;
}
}
}

top = 0;
for ( j = 0; j <> top ) {
top = sorted[j];
}
}
return top;
}

Here's the prototype in action:

You can see the LEDs getting brighter as Yuval gets closer to stealing the cash. Unfortunately, it's still not enough of a deterrent! And that was my coffee money!



Color us cheap, but we still haven't bought any new aluminum foil... the two sensors are what we had, cut in half. We had to calibrate the resistor to get a good response - 10 kOhm gave us an unpredictable 'blinky' response, with 4.7 kOhm, we had to actually touch the metal to get a response, but with a 6.4 kOhm resistor, it starts reacting 1" away, and gives a smooth corresponding response - the closer your hand, the brighter the LED. A potentiometer (variable resistor) could also be a useful component/improvement.

For our own final prototype, we are thinking of using multiple sensors and multiple outputs, so this has been a solid step toward that wiring setup as well as handling the logic. It also makes the whole system more robust for a wide variety of situations. Stay tuned...

Tuesday, November 10, 2009

Prototype 4 for Mid-Review




We presented our project to an outside panel after the Living Architecture review. We got great feedback on both the technical implementation of our project, as well as the concept of DIY Interactive Architecture.

Our prototype for this week involved using common architectural elements as our capacitive 'sensors'. We managed to use part of a chair, and a door knob. We were hoping that we could use practically any metallic architectural element, but this proved difficult - it would seem that many of the metals around us have anti-conductive coatings on them. We might need our own metallic foil stickers (or similar) to give a predictable range of input values.

Major technical advancements:
- output using one of the pulse-width modulated pins on the Arduino allows us to vary the voltage (brightness of the LED) between 0-5 volts by passing it a value 0-255.
- lots of advice we're still sorting through on how to power larger output devices such as lamps.

Here are the prototypes:


Testing a door knob - thanks Melissa for holding the board!


Testing a metal chair.


Improved Flexinol response.

Thursday, November 5, 2009

Prototype 3 with Flexinol

We had a successful day of prototyping. We made a simple prototype by attaching the foil - parallel capacitor to the end of a long strip of chip board, and attached flexinol to the ends of the chip board. Here's the basic setup:

With the sensor as an integral part of the moving armature, the distinction between input and output blurs.. we were inspired by the 'Reef' installation at Storefront for Art and Architecture by Radical Craft. While that installation used separate motion sensors to trigger the response, we are interested in using a conductive armature or skin as a sensor itself.

The prototype in action:




As your hand gets within about 2 inches of the foil, the flexinol is activated and the piece moves to meet your hand. In an array, this type of functionality could create a wall surface that is sculpt-able by simply the wave of your hands... an architecture which tries to cuddle with you... which follows you around... lets in more light and air where there are people...

Things we tackled:
- On/off based on proximity to the foil.
- Flexinol on a relay from a 9V battery.
- Armature for the flexinol with a pretty good first response.

Issues & Next Steps:
- Predictability of the response coming from the parallel capacitor. Our first prototype got us consistent values ranging from 0 (hand 12" or more away from the foil) to 60 (hand within about 1" or touching the foil). Today, the results were much less predictable. We think that with careful grounding/insulation and the right metal this can be solved.
- Integration of the metallic 'sensor' part of the armature and the non-metallic part... The metal, for one thing, would probably be better on the back side of the non-metallic 'fin' so that there is an insulating buffer between the user's hand and the capacitive sensor. Maybe this could even be a simple coating?
- Careful grounding of the Arduino board, the foil, the flexinol and all the wiring. This is essential because they interfere with each other and we want to be very specific about those interactions.
- Possible different responses based on varying proximity to the sensor. This requires both consistent input (1st issue) and variable output, which may mean we investigate a servo or other more specific output. (Flexinol, for all its beautiful organic movement, is a binary actuator.)
- We have lots of ideas for architecturally 'programming' the system, but picking one will help us design future components.