Arduino Based Light Chimes




Introduction: Arduino Based Light Chimes

Brief Introduction

Howdy folks, today we will make an electronic, Arduino based, light triggered random music player! I’m calling my creation “Light Chimes” (think wind chimes, but with light instead of wind!) It is an elegant music device that plays random musical notes based on its interaction with light.

Let's get started and see how can we make a set of Light Chimes.

What you will need for this project:

A small electronic child's piano toy or similar

(1) Arduino Nano

(8) Photocells

(8) 10k Resistors

(1) Speaker (You might be able to use the one that came with the toy piano)

(1) Breadboard

Various breadboard wires

Various stranded copper wires

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Step 1: Gathering Parts

One of the main components that you need for this project is some sort of inexpensive electronic mini piano (or similar small electronic noise maker). The one I am using was acquired at a dollar store. We will be salvaging the main printed circuit board (PCB) as well as the internal speaker. The electronic components from this device will produce the sounds that the Light Chimes makes, so pick something that produces some nice notes.

Since this project is Arduino based you will need an Arduino! I chose the Arduino Nano because it had 8 Analog input pins, which is the same number of notes that my mini piano can produce. If you mini piano has more or less note you might want to consider using a different Arduino. Visit for a nice table showing the different Arduino specifications. Try to pick an Arduino that has the same number of analog in/out pins, and digital out pins that your mini piano does.

Photocells, also known as light-dependent resistor (LDR), or photoresistor are a light-controlled variable resistor. That means it gives a different level of electrical resistance depending on how much light is shining onto the photocell. These photocells will be the input that goes through the Arduino telling it when to trigger the mini piano. You will need the same number of Photocells as you have musical notes on your mini piano. In my case I am using 8.

10k Resistors. Resistors, similar to photocells, provide a level of electrical resistance to a circuit. In this case 10 kilohms. Resistors have colored banding on them so you can tell their resistance value. A 10k resistors bands are brown, black, and orange. You can use this website to figure out the value of any resistors you might have that you are unsure of You will need the same number of resistors as you have photocells.

Speaker. Speakers make noise depending on the current that runs through them. Your mini piano should come with one. If not you should find a small speaker that uses a low amount of power.

Breadboard. Breadboards are great prototyping tools used to test build electronic circuits (Shockingly, not made of bread). You simply push components into the holes of the breadboard to form connections without the need to solder anything. For more information on how to properly use a breadboard check out

Step 2: Step 2: Circuity

These Fritzning images show where all the parts plug into each other.

It gets a little crowded so I've added a second detail image showing the placement of a photocell and a 10k resistor connecting to a single analog pin. Repeat this pattern for each musical note on your piano circuit board.

Step 3: Step 3: Construction

Plug the Arduino Nano into the breadboard, bridging the gap along the center. Leave room on either side to allow for additional components.

Plug the 10k resistors into each Analog In/Out pin row and into the - power column. You can cut the legs off to make installation easier. Each analog in/out row gets one resistor each, for every note that your piano has.

(careful when cutting the legs off, the can fly off and cause all sorts of problems, wear safety glasses or hold onto the leg when you’re cutting it off.)

Plug the photocells into each Analog In/Out pin row and into the + power column.

Plug a breadboard wire into the 5V pin row and the + power column.

Plug a breadboard wire into the GND pin row and the - power column.

Solder wires onto each electrical contact for each piano key on your PCB that came with your mini piano.

Plug the other end of the soldered wire from the mini piano into a Digital In/Out row, one wire for each pin.

Step 4: Step 4: Code

I’m no Arduino coding expert, but this code functions.

Simply download the text file containing the Arduino code and copy the text into the Arduino IDE program.

After you have copied the code into the Arduino IDE, connect your Nano via USB cable.

Under the Tools pull-down menu be sure to select the proper Board, Port and Processor for your specific Arduino.

(My processor was the ATMega328, and my port was COM6, but yours may be different. Failure to select the right options will cause the code to not upload.)

After you have selected the proper settings for your Arduino, upload the code to your Arduino Nano.

You should now be able to test out your new Light Chimes!

You can download the Arduino IDE from

It's free, and works on Mac, Windows, and Linux operating systems.

Step 5: Step 5: Test It Out!

To test out your newly made circuit, simply grab a small flashlight or laser pointer and power your Arduino up!

Your Light Chimes should chime depending on which photocell gets sufficient light. You can add some heat shrink, electrical tape, or something else to cover the photocells more to make them more sensitive to directional light.

If your Light Chimes continually chime, even without the use of a flashlight you will have to go into the Arduino code and alter some values to change the threshold at which the digital pins tell the circuit board to chime.

The specific area of code you need to change is here:

if (photocell0 > 700>){            // if the photocell gets enough light it will set corresponding pin to on for a short while, then set it back to off<br>    digitalWrite(note0, HIGH);    
    digitalWrite(note0, LOW); 

The 700 in this case is the light threshold level at which the Light Chime will chime that specific note. This value can range from 0-1023. Lowering the value will make the Light Chime more sensitive to light, allowing it to chime in dimmer light (good for indoors or dark locations) where as increasing the value will make it require more light to chime (good for outdoors or bright rooms)

If you do need to change the code, you will need to re upload the new code again to the Arduino Nano for it to function differently. Arduinos have internal memory and will store the last program that they were programed to use.

Step 6: Step 6: Going Forward…

This project is in no way perfect or 100% finished. It is just a kicking off point and exercise in learning how to work with an Arduino in a fun way.

You may want to improve the Arduino coding to incorporate some smoothing to the photocells, change the delays at which the chimes sound, or change the number of notes possible. I encourage you to look up some Arduino tutorials and go for it!

You may want to move away from a prefabricated circuit board from a toy. Some options might be looking into sound libraries for the Arduino or perhaps fabricating your own custom PCB!

You might also want to make a housing for your amazing new Light Chimes. This is a great idea, I believe in you!

I'd also like to give thanks to Kyle Fitzsimmons for their LED Music Box instructable from which I was inspired to make this one.

Be the First to Share


    • Magnets Challenge

      Magnets Challenge
    • Raspberry Pi Contest 2020

      Raspberry Pi Contest 2020
    • Wearables Contest

      Wearables Contest

    2 Discussions

    DIY Hacks and How Tos

    This could make for an interesting kind of security system. Someone turns the lights on and the music plays.


    Reply 2 years ago

    Depending on your taste in music it certainly would deter criminals!