## Physical Computing

### Digital Kaleidoscope

Posted in Physical Computing on December 19th, 2010 by Toby – Be the first to comment

I’ll be unofficially showing this piece at the ITP Winter Show. Find/txt me!

### Mouse Ped

Posted in Physical Computing on November 16th, 2010 by Toby – Be the first to comment

Mouse Ped is a giant mouse pad / music controller for your feet. It has 15 homemade pressure sensors which control the volume on 15 music tracks.

Performers: Okka, Mark

<3 Ezra, Fernanda

### Capacitive Touch Sensor

Posted in Physical Computing on October 11th, 2010 by Toby – 1 Comment

This is a tutorial for a very useful, reliable sensor for sensing human touch. You can use these to detect when a person touches something conductive (like those new switches on LCD monitors). You can also detect when a body (or chain of bodies) completes a “circuit”, so to speak. Best of all, you don’t need any special parts to make them, just an Arduino and a resistor!

Lucky Dragons uses them in his live, participatory performances:

My friends in the Oregon Painting Society use them to detect when people touch plants:

This is the idea of the circuit:

Here’s a demo:

When I touch the green wire, I change the capacitance of the circuit which is read by the Processing sketch. When I touch the green wire and ground (e.g. my laptop case), this reads as a very large value.

The blue wire is the “sender”. It sends electrical pulses. The orange wire is the “receiver” or “sensor”. It listens for the pulses sent by the blue wire. There is a 100 kΩ resistor between the sender and receiver. Based on subtle timing changes in the pulses, the Arduino is able to calculate the capacitance in the circuit. This capacitance changes when I touch the green wire which is tied to the receiver.

There is an Arduino library called CapSense for doing this pulsing protocol. You’ll need to download the library (zip file) from that page and put it in Arduino/libraries (you may need to make the libraries folder).

This is my Arduino code. One caveat, you’ll need to have a good ground for this to work reliably so plug in your laptop!

```// CapSense library at: http://www.arduino.cc/playground/Main/CapSense

#include <CapSense.h>

CapSense   cs_4_2 = CapSense(4,2);
// resistor between pins 4 & 2, pin 2 is sensor pin, add wire, foil

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

void loop()
{
// the 10 is number of samples to combine, try different values
long value =  cs_4_2.capSense(10);

// print sensor output 1
Serial.println(value);

// arbitrary delay to limit data to serial port
delay(10);
}
```

To graph it, I’m just running the Processing code from the Arduino Graph example.

```// Graphing sketch

// This program takes ASCII-encoded strings
// from the serial port at 9600 baud and graphs them. It expects values in the
// range 0 to 1023, followed by a newline, or newline and carriage return

// Created 20 Apr 2005
// Updated 18 Jan 2008
// by Tom Igoe
// This example code is in the public domain.

import processing.serial.*;

Serial myPort;        // The serial port
int xPos = 1;         // horizontal position of the graph

void setup () {
// set the window size:
size(400, 300);

// List all the available serial ports
println(Serial.list());
// I know that the first port in the serial list on my mac
// is always my  Arduino, so I open Serial.list()[0].
// Open whatever port is the one you're using.
myPort = new Serial(this, Serial.list()[0], 9600);
// don't generate a serialEvent() unless you get a newline character:
myPort.bufferUntil('\n');
// set inital background:
background(0);
}
void draw () {
// everything happens in the serialEvent()
}

void serialEvent (Serial myPort) {
// get the ASCII string:

if (inString != null) {
// trim off any whitespace:
inString = trim(inString);
// convert to an int and map to the screen height:
float inByte = float(inString);
inByte = map(inByte, 0, 1023, 0, height);

// draw the line:
stroke(127,34,255);
line(xPos, height, xPos, height - inByte);

// at the edge of the screen, go back to the beginning:
if (xPos >= width) {
xPos = 0;
background(0);
}
else {
// increment the horizontal position:
xPos++;
}
}
}
```

### Table Tap Instrument

Posted in Exercise, Physical Computing, Uncategorized on September 27th, 2010 by Toby – Be the first to comment

I often enjoy tapping my fingers on a surface, like playing an invisible piano. If I’m really feeling a beat I’ll play some surface around me like a drum.

So, my “physical computing fantasy device” is an electronic musical instrument that can be played by tapping a table or other surface.

Here are some prototype videos.

The first one is with a piezoelectric microphone plugged directly into my laptop. I have some software written in Processing that “listens” for a tap and triggers a sound.

The second has the piezoelectric microphone plugged into the analog input of an Arduino microcontroller.

I made a version with two microphones to try to localize one-dimensionally.

However, this version did not perform as accurately as I would like.

My current version listens for a “trigger” (activity above a threshold) on the two microphones and compares the time between them. Some suggestions I have received are to rectify the signal (so that polarity doesn’t affect the trigger), to compare the waveforms in software (this will require a faster ADC), or to localize using phase.

### Sensor Tour

Posted in Exercise, Physical Computing on September 20th, 2010 by Toby – Be the first to comment

We are surrounded by sensors. These are the electrical sensors I noticed while making breakfast.

• Light switch
• Temperature sensor in my fancy water boiler
• Sensor in the refrigerator door mechanism (to turn the light on)
• Temperature sensor in the refrigerator (to regulate temperature)
• Sensor on the dial of my toaster (to turn it on)
• Sensor on the dial of my stove (to spark it)
• Time sensor on the digital clock on my stove
• Buttons to control my oven
• Circuit breakers in the electrical system

### Physical Computing Light Show

Posted in Exercise, Physical Computing on September 20th, 2010 by Toby – 1 Comment

Getting my Arduino feet wet.