Announcements

November 24, 2007
Reading for November 27th, are now posted. Enjoy!

October 2, 2007
To upload your thoughtless acts, create a new assignment page like any other lab. You'll see "Thoughtless Acts" listed as one of the assignment options.

May 24, 2008
This site has been archived and is no longer editable. Stay tuned for the next version, coming in the fall!


"Crikey!", the Hamster-sized Wombat that channels Steve Irwin

Project Members: 
Lora Oehlberg

Description

"Crikey!" is a hamster-sized stuffed wombat that pseudo-randomly says one of five Stever Irwin quotes when squeezed. Although the program "randomly" selects a quote to play, it does not play the same quote twice.

Components Used

  • Arduino
  • Breadboard
  • Force Sensitive Resistor (FSR)
  • 12 kOhm Resistor
  • Stuffed Wombat, approximately the size of a hamster
  • Foamcore
  • LED (for debugging)
  • 220 kOhm Resistor (for debugging)

Arduino Code

/*
* Resistive Sensor Input
* Takes the input from a resistive sensor, e.g., FSR or photocell
* Dims the LED accordingly, and sends the value (0-255) to the serial port
*/
int sensorPin = 0; // select the input pin for the sensor
int ledPin = 11; // select the output pin for the LED
int val = 0; // variable to store the value coming from the sensor
void setup() {
Serial.begin(9600);
}
void loop() {
val = analogRead(sensorPin); // read the value from the sensor, 0-1023
analogWrite(ledPin, val/4); // analogWrite (dimming the LED) can be between 0-255
Serial.println(val/4); // writing the value to the PC via serial connection
delay(50); // rest a little...
}

Processing Code

/* "Crikey!", the Hamster-sized Wombat that channels Steve Irwin
* by Lora Oehlberg
* Theory and Practice of Tangible User Interfaces, Fall 2007
*
* Adapted from:
* Arduino Ball Paint
* (Arduino Ball, modified)
* Created 25 October 2006
* copyleft 2006 Tod E. Kurt <tod@todbot.com
* http://todbot.com/
*/

import krister.Ess.*;
import processing.serial.*;

// Define Audio Channels
AudioChannel naughtyChannel;
AudioChannel noworriesChannel;
AudioChannel lookChannel;
AudioChannel crikeyChannel;
AudioChannel havocChannel;

// Change this to the portname your Arduino board
String portname = "/dev/tty.usbserial-A4001o6X"; // or "COM5"
Serial port;
String buf="";
int cr = 13; // ASCII return == 13
int lf = 10; // ASCII linefeed == 10
int soundplaying = 0; // 0 if sound is playing, 1 if sound is not playing;
int threshold = 125; // sensitivity of force sensor
int lastplayed = 0; // keeps track of the last sound played

void setup() {
// println(Serial.list());
size(300,300);
frameRate(10);
smooth();
background(40,40,40);
noStroke();
port = new Serial(this, portname, 9600);

// adding sound
Ess.start(this);

// loading sounds into new audio channel

naughtyChannel = new AudioChannel();
naughtyChannel.loadSound("../data/naughty.wav");
naughtyChannel.gain(10);

noworriesChannel = new AudioChannel();
noworriesChannel.loadSound("../data/no_worries.wav");
noworriesChannel.gain(10);

lookChannel = new AudioChannel();
lookChannel.loadSound("../data/have_look.wav");
lookChannel.gain(10);

crikeyChannel = new AudioChannel();
crikeyChannel.loadSound("../data/crikey.wav");
crikeyChannel.gain(10);

havocChannel = new AudioChannel();
havocChannel.loadSound("../data/havoc.wav");
havocChannel.gain(10);

}

void draw() {
}

// called whenever serial data arrives
void serialEvent(Serial p) {
int c = port.read();
if (c != lf && c != cr) {
buf += char(c);
}
if (c == lf) {
int val = int(buf);
// println("val="+val);
if (soundplaying == 0){
if (val > threshold){
println("play");
playsound();
}
}
buf = "";

// background(40,40,40); // erase screen
}
}

// plays a random sound when called
void playsound(){
soundplaying = 1;
int j = int(random(1,6));
if (j == lastplayed){
j ++;
println("repeat");
}
println(j);
if (j == 0){
}
else if (j == 1 || j == 6){
lastplayed = 1;
noworriesChannel.play(1);
}
else if (j == 2){
lastplayed = 2;
lookChannel.play(1);
}
else if (j == 3){
lastplayed = 3;
naughtyChannel.play(1);
}
else if (j == 4){
lastplayed = 4;
crikeyChannel.play(1);
}
else if (j == 5){
lastplayed = 5;
havocChannel.play(1);
}
}

void audioChannelDone(AudioChannel ch) {
soundplaying = 0;
// println("AudioChannel "+ch+" is done playing.");
}

Item

finishedWombat: "Crikey!" the Wombat, taking a walk around the cutting mat post-op.finishedWombat: "Crikey!" the Wombat, taking a walk around the cutting mat.

 

Process Photos

beforeWombat: "Crikey!" the Wombat, taking one last sensor-free walk on the cutting mat before the operation.beforeWombat: "Crikey!" the Wombat, taking one last sensor-free walk on the cutting mat before the operation.

Wombat and Knife: "Crikey!" the hamster-sized Wombat about to be cut open with an Exacto knife.  Does he look nervous?Wombat and Knife: "Crikey!" the hamster-sized Wombat about to be cut open with an Exacto knife. Does he look nervous?

Wombat with Foamcore Structure: "Crikey!" had a foamcore implant inserted into his abdomen in order to protect the FSR when squeezed.  When squeezing "Crikey!", squeeze him side-to-side, not up-down!Wombat with Foamcore Structure: "Crikey!" had a foamcore implant inserted into his abdomen in order to protect the FSR when squeezed. When squeezing "Crikey!", squeeze him side-to-side, not up-down!

"Crikey!" posed on a breadboard, ready to go!: As FSR goes in between the foamcore pieces, "Crikey!" is now ready to channel the spirit of Steve Irwin.  Take a look a' that!"Crikey!" posed on a breadboard, ready to go!: As FSR goes in between the foamcore pieces, "Crikey!" is now ready to channel the spirit of Steve Irwin. Take a look a' that!


Comments

woah!

i didn't see this in class, it's awesome.

 

> "--,,---,,--` 


Powered by Drupal - Design by Artinet