Step 1: Materials Needed

The different parts will be connected directly to the Arduin Board. There is no need of a breadboard for this construction because of the few parts.

Step 2: Connect Parts

Connect the Piezo Buzzer to the Arduino Board to Gnd and Digital output 10 (because of the distance between the pins).

Solder the resistor and the photocell sensor. By doing so, they can also be connected directly to the Arduino Board. Make an extension of the pin of the photocell sensor. Connect one pin of the photocell sensor to the 5V POWER, the soldered pin to the Analog 0 input, and the pin of the resistor to the Gnd.

Step 3: Coding

Write this code to the Arduino software.

Measure the light level in the surrounding environment and put that value into the startValue. It should be an average of between 50-300. This makes the program start only when a change in light level is made (when your external light source is added) and stops the program when the extra light source is removed.

The photocell sensor reads the amount of ambient light, in Lux, that hits the surface of the sensor. Thereafter it sends an output to the speaker with a corresponding frequency (in this case 4 times the value of the light) to make the sound of a certain tone. As the value of the amount of Lux that the photocell reads changes, so will the tone. This means that when you move an object further away from the light source, the tone that the sound from the speaker makes will have a lower frequency and as the object comes closer, the tone will have a higher frequency.

Step 4: Make It Work!

Create an object of choice or use an existing one as a case for the parts. Make sure to have a hole where the photocell sensor can stick out of the object. Connect the battery to the Arduino to allow use without computer. Place the connected parts in the object with the light sensor on the outside. Place the light source under the object and move it up and down to create sounds.

Congratulations, you have now created a tool for making sounds depending on the movement of an object!