Watzit Tooya
Published © CC BY

Heat Theremin

Wondered what music the weather makes? This device is a theremin that changes pitch based on the heat- higher temperature, lower pitch.

BeginnerWork in progress1 hour23
Heat Theremin

Things used in this project

Hardware components

Resistor 220 ohm
Resistor 220 ohm
×1
Buzzer, Piezo
Buzzer, Piezo
×1
Arduino UNO
Arduino UNO
×1
Breadboard (generic)
Breadboard (generic)
×1
Temperature Sensor
Temperature Sensor
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Fritzing

A diagram of how to set up the theremin

Code

Untitled file

Arduino
/*
  Parts required:
  - temperature sensor
  - 10 kilohm resistor
  - piezo

*/

// variable to hold sensor value
int sensorValue;
// variable to calibrate low value
int sensorLow = 1023;
// variable to calibrate high value
int sensorHigh = 0;

  // calibrate for the first five seconds after program runs
  while (millis() < 5000) {
    // record the maximum sensor value
    sensorValue = analogRead(A0);
    if (sensorValue > sensorHigh) {
      sensorHigh = sensorValue;
    }
    // record the minimum sensor value
    if (sensorValue < sensorLow) {
      sensorLow = sensorValue;
    }
  }

}

void loop() {
  //read the input from A0 and store it in a variable
  sensorValue = analogRead(A0);

  // map the sensor values to a wide range of pitches
  int pitch = map(sensorValue, sensorLow, sensorHigh, 50, 4000);

  // play the tone for 20 ms on pin 8
  tone(8, pitch, 20);

  // wait for a moment
  delay(10);
}

Credits

Watzit Tooya
1 project • 0 followers

Comments