Skip to content

Sensors and Actuators

May 14, 2010

The class was divided in two–literally down the middle of the table: one half was assigned the task of creating a sensor network and the other an actuation device to be triggered by the sensors.

This exercise was as much a meditation on the limitations of group work as it was a physical computing project.  Working collaboratively can produce surprising results.  One person can have an idea that left alone may wither on the vine, but in a group might take on a life of its own, developing into something quite unexpected.  This doesn’t always happen, though, and it might be interesting to try to understand why.

Inspiration cannot be legislated.  Groups like people have personalities and personality dynamics.  An idea might grow and develop with one group but lay fallow with another.  If there are people who are consistent in their lack of participation, they can bring down the energy of the group as people perceive it as disrespect, and grow tired of carrying others’ water.  Size matters.  Large groups given enough time develop a political structure, but over the short term can behave more like headless animals.  Timing also matters.  This is probably an arguable point, but for me there is certainly a corollary between inspiration and a tight schedule.  A large group means that more can be done in a given amount of time, but without direction, it also means that each member has more time on their hands and very likely less inspiration.

All that being said, some were a pleasure to collaborate with, and came up with some very simple and beautiful ideas.  Asli suggested we sense footsteps around the floor, and the actuator group represented it with a wooden footbridge.

For sensors, we chose piezos, and Asli, Adi and I began by trying to map the sensitivity of piezo film.  This is very sensitive to direct tapping and bending, but not to vibration transmitted through adjacent surfaces.  Shahar Zaks suggested we try other piezos because he had found them to be incredibly sensitive.  Paul Rothman leant me one typically used for a drum pad, and it worked well:

It was even more sensitive when flipped over:

Note the pull-down resistor to eliminate noise and the Zener Diode to prevent the piezo from frying the Arduino.  This is critical as the piezo can produce large voltage spikes.  A capacitor would help with smoothing, and this was added in the final setup.

The Arduino Code
The Arduino code is pretty basic, and is modified from the Analog Input code for reading a potentiometer (the original code can be found at http://itp.nyu.edu/physcomp/Labs/AnalogIn):

int piezoPin = 0;    // Analog input pin that the piezo is attached to
int piezoValue = 0;   // value read from the piezo

void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
}

void loop() {
piezoValue = analogRead(piezoPin); // read the piezo value
Serial.print(piezoValue/4);      // print the piezo value back to the debugger pane
delay(10);                     // wait 10 milliseconds before the next loop
}

Processing Code for Serial Visualization

import processing.serial.*;
Serial myPort;        // The serial port
int graphXPos = 1;    // the horizontal position of the graph:
void setup () {
size(400, 300);        // window size
// List all the available serial ports
println(Serial.list());
// I know that the fisrt port in the serial list on my mac
// is usually my Arduino module, so I open Serial.list()[0].
// Open whatever port is the one you're using.
myPort = new Serial(this, Serial.list()[2], 9600);
// set inital background:
background(48,31,65);
}
void draw () {
// nothing happens in draw.  It all happens in SerialEvent()
}
void serialEvent (Serial myPort) {
// get the byte:
int inByte = myPort.read();
// print it:
println(inByte);
// set the drawing color. Pick a pretty color:
stroke(123,128,158);
// draw the line:
inByte = (int)map(inByte,48,58,0,height);  // inByte = (int)map(inByte,0,255,0,height);
line(graphXPos, height, graphXPos, height - inByte);
// at the edge of the screen, go back to the beginning:
if (graphXPos >= width) {
graphXPos = 0;
// clear the screen:
background(48,31,65);
}
else {
// increment the horizontal position for the next reading:
graphXPos++;
}
}

Sensor Fabrication

I ended up buying a few Piezo Elements from Radio Shack for the project.

Asli, Adi and Liangjie pulled the metal elements out of the plastic housing.  They were unfortunately not as sensitive as Paul’s drum sensors, so they improvised an additional metal strip across the floor that helped to extend their range:

Wireless Communication

Just like the Simple Sensor Network (https://docs.google.com/present/edit?id=0AWLsuQTjJaQ8ZGZkdzc1cTJfMTI2OGZqbTgycmY0&hl=en), each sensor is attached at pin AD0 to an independent XBee on battery power set up to communicate to a Coordinator attached to a laptop with an Explorer:

Four sensor xbees in total send raw sensor data to the central coordinator in API format.

Liangjie then created a hash table to track the sensors and their data output.  This was monitored with a Processing sketch relating the strength of a footstep to the size of a circle.  The code is here: http://itp.nyu.edu/~mif226/sociableObjects/sensorGroup/

The output data from the hash table was then used to turn servo motors to raise and lower the wooden footbridge depending on the strength of the footstep.

Advertisements

From → Sociable Objects

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: