Screaming Potter
Thursday, July 22nd, 2010Together with Troels Just Christoffersen I hacked together a screaming potter. The idea is to create the impression that some kind of screeching creature is living within the potter. The schematic and code are simple, a photoresistor activates the speaker when its subjected to light.
Schematic
Arduino code
int photoResistorPin = 0;
int startThreshold = 4;
int speakerPin = 9;
int active = false;
int activationTime;
void setup() {
Serial.begin(9600);
}
void loop() {
int lightReading = analogRead(photoResistorPin);
if(lightReading > startThreshold) {
// when first activated set timestamp
if(active == false) {
activationTime = millis();
active = true;
}
// the time could be usd to create more variation in the sound
// int runtime = millis()-activationTime;
for (int i = 0; i < 6; i++) {
int frequency = lightReading*i;
Serial.println(frequency);
tone(speakerPin, frequency);
delayMicroseconds(500);
}
} else {
noTone(speakerPin);
}
}







