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!


Simple theramin

Project Members: 
Elisa Oreglia

Description

I had missed this assignment, so I built a simple theramin that is controlled through a photocell. It is unbearable to listen to, and I suddenly remembered why I forgot about the assignment.

Components

Piezo speaker
photocell
various wires
Arduino & breadboard

Code

/* Theremin
* --------
*
*
* Created 24 October 2006
* copyleft 2006 Tod E. Kurt <tod@todbot.com
* http://todbot.com/
*/

int photoCell = 0; // select the input pin for the potentiometer
int speakerPin = 7;

int val = 0;

void setup() {
pinMode(speakerPin, OUTPUT);
beginSerial(9600);
Serial.println("ready");
}

void loop() {
digitalWrite(speakerPin, LOW);

val = analogRead(photoCell); // read value from the sensor
val = val*2; // process the value a little
//val = val/2; // process the value a little

for( int i=0; i<500; i++ ) { // play it for 50 cycles
digitalWrite(speakerPin, HIGH);
delayMicroseconds(val);
digitalWrite(speakerPin, LOW);
delayMicroseconds(val);
}
}

Photos

theramin
theramin


Powered by Drupal - Design by Artinet