The Flying Cursing Monkey
January 29, 2008 – 12:24 pmThis monkey is a cult favorite from woot.com. It is essentially a slingshot in the form of a cute, lovable monkey. When you launch it, a device in its stomach screams. I decided that this wasn’t good enough. I wanted to give it some character; something more along the line of the jaded, chain-smoking, circus monkey. This required several parts: a monkey, an Arduino, a Piezo pressure sensor, and a Processing program to interpret the serial data from the Piezo and play the voices. I needed quite a bit of wire between the monkey and the Arduino to allow it to fly. Clearly this project would be much better served by a wireless interface, which will come later.
The Processing program works like this: The monkey says one of three random phrases with each sensor reading to give the illusion of spontaneity. There are thresholds in the code that make the monkey yell louder depending on how hard he hits a surface.
Since the voice comes out of the computer instead of the monkey itself, there is a bit of detachment that takes away from its realism. Another application of this monkey is wiring the entire body with sensor and tracking which body parts are hit during his flight to track injury.




Processing Code:
[sourcecode language='java']
import processing.serial.*;
import pitaru.sonia_v2_9.*;
Serial port;
int input;
Sample asshole;
Sample shithead;
Sample dick;
Sample[] phrases; //collection of monkey sayings
int val;
float volume = 2;
int index;
boolean firstContact = false;
void setup() {
size(256, 256); // Stage size
noStroke(); // No border on the next thing drawn
//the sound code
Sonia.start(this);
asshole = new Sample(“asshole.wav”);
shithead = new Sample(“shithead.wav”);
dick = new Sample(“dick.wav”);
phrases = new Sample[3];
//these are the random phrases the monkey will say.
phrases[0] = asshole;
phrases[1] = shithead;
phrases[2] = dick;
// Print a list of the serial ports, for debugging purposes to find out what your ports are called:
println(Serial.list());
port = new Serial(this, “COM5″, 19200);
port.write(65); // Send a capital A in case the microcontroller is waiting to hear from you
println(“Let’s do this!”);
}
void draw() {
background(255);
if (firstContact == false) {
delay(300);
port.write(65);
}
}
//stop Sonia upon shutdown
public void stop(){
Sonia.stop();
super.stop();
}
void serialEvent(Serial port) {
if (firstContact == false) {
firstContact = true;
}
input = port.read();
if (input != 0){
println(“Raw Input: ” + input);
val = input;
}
index = int(random(0,3));
println(index);
if (val > 40 && val < 80) {
volume = 2.0;
} else if (val > 80 && val < 120) {
volume = 6.0;
} else if (val > 120) {
volume = 10.0;
}
phrases[index].play();
}
[/sourcecode]

One Response to “The Flying Cursing Monkey”
nice champion sweatshirt
By androo on Feb 10, 2009