jbrandstater
Published © GPL3+

Nano Light theremin

This is a variation of the Light Theremin project from the starter kit and features components soldered onto a PCB.

IntermediateFull instructions provided1 hour4,364
Nano Light theremin

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
Buzzer
Buzzer
×1
Photo resistor
Photo resistor
×1
Resistor 10k ohm
Resistor 10k ohm
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

Schematic for Nano light theremin

Hopefully this can help you setting up the board. If you can find the light theremin project in the book accompanying the starter kit, the diagram and instructions there might help as well. The only difference, once again, is the board: a Nano substituting in for the Uno.

Code

Light theremin

Arduino
This code is from the Arduino starter kit. Once you upload it, the buzzer will start making sounds. Wave a hand over the photocell for sound variations.
/*
  Arduino Starter Kit example
 Project 6  - Light Theremin

 This sketch is written to accompany Project 6 in the
 Arduino Starter Kit

 Parts required:
 photoresistor
 10 kilohm resistor
 piezo

 Created 13 September 2012
 by Scott Fitzgerald

 http://www.arduino.cc/starterKit

 This example code is part of the public domain
*/

// variable to hold sensor value
int sensorValue;
// variable to calibrate low value
int sensorLow = 1023;
// variable to calibrate high value
int sensorHigh = 0;
// LED pin
const int ledPin = 13;

void setup() {
  // Make the LED pin an output and turn it on
  pinMode(ledPin, OUTPUT);
  digitalWrite(ledPin, HIGH);

  // 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;
    }
  }
  // turn the LED off, signaling the end of the calibration period
  digitalWrite(ledPin, LOW);
}

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

jbrandstater

jbrandstater

0 projects • 5 followers
I am a self-published author, mainly of children's books. I also like to tinker, especially with electronics kits, especially Arduino.

Comments