Description
Our original plan was to rig up a little machine which sensed when your phone rang and then crawled toward you. We tried a variety of ways to make this work. First, we put the phone on vibrate and created a little catch with a rubber band that the phone sat on and then would slide down when the phone vibrated and ideally land on an FSR. This didn't work, however. We couldn't get enough concentrated force to trigger the FSR, even when we taped various things to the phone. Andrew then suggested that we use the piezo speaker as input, so we researched this and tried to trigger the speaker with the audio phone ring, or with the phone vibration while it was on vibrate. Both failed, however, either because our speakers weren't sensitive enough or the code was wrong, we couldn't be sure.
Finally, after many hours, we decided simply to make it so when your phone rang, you would have to manually press a button (the FSR) and your phone would come to you.
Electrical Components Used
Arduino Board
1 resistor
1 FSR
2 Servo Motors
various wires
Mechanical Construction
Cardboard
4 AA batteries
2 tacks
1 Servo Motor box
Rubber bands
Tape
Arduino Code
/*
* Two servos with one FSR controlling them
* Theory and Practice of Tangible User Interfaces
* October 18 2007
*
*/
int servoPin1 = 7; // Control pin for servo motor 1
int servoPin2 = 8; // Control pin for servo motor 2
int fsrPin = 0; // select the input pin for the FSR
int pulseWidth1 = 0; // Amount to pulse the servo 1
int pulseWidth2 = 0; // Amount to pulse the servo 2
long lastPulse1 = 0; // the time in millisecs of the last pulse of servo 1
long lastPulse2 = 0; // the time in millisecs of the last pulse of servo 2
int input, val_1;
//int val_2; // variable used to store data from potentiometer 2
boolean start = false;
int refreshTime = 20; // the time in millisecs needed in between pulses
int minPulse = 500; // minimum pulse width
void setup() {
pinMode(fsrPin, OUTPUT);
pulseWidth1 = minPulse; // Set the motor position to the minimum
pulseWidth2 = minPulse;
Serial.begin(9600); // connect to the serial port
Serial.println("Two servos with two potentiometers ready");
}
void loop() {
input = analogRead(fsrPin);
Serial.println(input);
if (input > 100) {
start=true;
}
if(start){
if (val_1 == 1024)
val_1 = 0;
else val_1++;
pulseWidth1 = val_1*2 + minPulse; // convert angle to microseconds
pulseWidth2 = 2498 - (val_1*2 + minPulse); // convert angle to microseconds
}
updateServo1(); // update servo 1 position
updateServo2();
}
void updateServo1() {
if (millis() - lastPulse1 >= refreshTime) {
digitalWrite(servoPin1, HIGH);
delayMicroseconds(pulseWidth1);
digitalWrite(servoPin1, LOW);
lastPulse1 = millis();
}
}
void updateServo2() {
if (millis() - lastPulse2 >= refreshTime) {
digitalWrite(servoPin2, HIGH);
delayMicroseconds(pulseWidth2);
digitalWrite(servoPin2, LOW);
lastPulse2 = millis();
}
}
Item
side view of crawler
front view of crawler
breadboard
video:
<object width="425" height="350"> <param name="movie" value="http://www.youtube.com/v/RnjsHjELIKU"> </param> <embed src="http://www.youtube.com/v/RnjsHjELIKU" type="application/x-shockwave-flash" width="425" height="350"> </embed> </object>