oliviere
Published © GPL3+

Laser harp-like sound making instrument prototype

Make a laser harp with a phototransistor and a laser module, that play a random note.

BeginnerWork in progress624
Laser harp-like sound making instrument prototype

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Laser Module KY-008
×1
Vishay phototransistor BPW77NB
×1
LM386 amplification module
×1
speaker 1W 8 ohms
×1
Rotary potentiometer (generic)
Rotary potentiometer (generic)
1k potentiometer
×1
Resistor 220 ohm
Resistor 220 ohm
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
both male-male and male-female
×1
9V battery (generic)
9V battery (generic)
×1
9V to Barrel Jack Connector
9V to Barrel Jack Connector
×1
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
used with smarphone power supply to power the laser module separately
×1

Story

Read more

Schematics

Laser Harp Schematic

Code

Laser Harp Version 1

Arduino
To upload on ARDUINO UNO board
// Laser Harp Project V1.0 
// Olivier E
// 12/04/2021

int maxBrightness = 0;    //calibration of max detected brightness

void setup() {
  //Serial.begin(9600);   //uncomment to show analog input values on serial m.
  pinMode(9,OUTPUT);      //speaker

  //calibration during first 5000 ms
  long startTime = millis(); 
  while (millis()-startTime < 5000) {
     int brightness = analogRead(A0);
     if (brightness > maxBrightness) maxBrightness = brightness;
  }
  //Serial.print("maxBrightness = "); //uncomment to show analog input values
  //Serial.println(maxBrightness); //uncomment to show analog input values
  tone(9,110,100);        //make a sound when calibration done
  delay(100);
  noTone(9);     
}

void loop() {
  int brightness = analogRead(A0);      //read phototransistor output voltage
  if (brightness < maxBrightness*0.1) { //if low brightness: asked to play!
    //Serial.println(brightness); //uncomment to show analog input values     
    tone(9,random(50,600),random(100,2000)); //play random note
    delay(250);
    noTone(9);               
  }
  delay(10);
}

Credits

oliviere
0 projects • 2 followers
Contact

Comments

Please log in or sign up to comment.