Music is the most universal means of expression. Regardless cultural language or age the idea conveyed though music would not differ much. It is safe to say everyone loves music, one type or another. When one’s favourite piece is played there is a overwhelming desire to get involved and turn on one’s Air Guitar.
Not being familiar with any type of musical instrument myself. Moving my hand insanely in the air and imagining my virtual tone lines up perfectly along the music was the best I could do.
Why not put my engineering degree to use. Design something able to play music without any training, minimal music knowledge but still get that person highly involved.
Music box seems like a good start. The music is actually ‘played’ in real time, unlike mp3 music player which merely convert a string of data to time varying voltages. However the music storage method has to be changed, a drum with pins poking out does not allow much customization. If the music is stored on file we are back to the mp3 player, but if the music is on a piece of paper…..Now we are talking.
Hence the Electronic Music Box was conceived.
What you will need:
2 proto boards or PCBs
LM7805 5V regulator
ATmega328 or Atmega168 microcontroller
16 MHz crystal with 2x22pF cap
Or forget about the two above if you use an Arduino
3 X LM324 opamp
14 X IR LEDs
14 X IR photodiodes
10K potentiometer
50k potentiometer
3.5mm headphone jack
MCP4911 10bits DAC
20 ways Right angle male heading connector
20 ways Female header connector
Various capacitors and resistors
Optional, mechanical:
6V motor with gearbox ~ 30RPM
Rollers, more on that later

Youtube link here

Step 1: Preliminary Design

How is the music stored on a piece of paper?
The simplest way is to divide a piece of paper, a certain width, into equal width columns and each represents a musical note of some sort. Kind of like musical notes on sheet music.
Notes are marked by pen and the duration of the note, or break, is controlled by the length of that mark.
The paper with music notes should look something like the photo below.
How does the unit read this paper?
A simple vision would be useful. Infrared, less likely to be distorted by our normal lighting is a great solution. Like visible light the dark mark on the sheet absorbs IR light while the blank passes most of IR through.
With this in mind the only thing we need to do to differentiate the two is a level comparison on the IR photodiodes.
How do we generate musical tone?
Since is fully electronics, the best tone generation method is that employed by mp3 players. Using a fast DAC or digital to analog converter to create the right voltage at a given moment, we can get a pretty smooth analog tone.
This method also allows any kind of waveform to be generated. It opens the possibility of polyphony.

<p>Hi! love it, I&acute;ve just discovered it and I have a question. Will it work with other colors apart from black? I know color darkness affects the sound but how exactly?</p><p>Thanks!</p>
<p>Hi Jorge</p><p>The colour of the note is only for the IR sensor to detect them. I guess any colour that absorb IR light enough for the circuit to pick up would work, lets say dark blue. As to colour changes tone, it doesn't. Either the machine 'sees' the note or not. </p>
<p>Hello, I love your work, but there is a problem. I would like to ask MCP4911 10bits DAC is not necessary to use it? MCP4921 can not replace it? Want to give me an answer as soon as possible, thank you.</p>
Hi there<br>I'm not 100% sure about your question. I'll answer it as to my understanding.<br>You will need a DAC, doesn't have to be the same part. Any DAC with SPI input can work with little to no alternation on the code.<br>The arduino atmega328 I'd used don't have enough spare IOs to generate analog signal by itself.<br>
<p>I made it by ARM7 and photocells and a USB powered programmer</p>
<p>Wow this is brilliant. way more professional looking than mine. Good work</p>
Hi h2osteam, <br> <br>I've been trying to create the music box powered by an Arduino but have run into a few problems. I was hoping you'd be able to answer my questions. <br> <br>First of all, how is the music box powered? Where is the input voltage source to run the arduino and light up the IR LED's? <br> <br>Secondly, where does the right angle male header fit into the IR array? From the pictures it seems that is a straight male header that is being used. <br> <br>Finally, where do we use the 10K and 50K potentiometers? It seems that the main board just has one 10K potentiometer.
Hi martellyer I am glad you are trying to build one for yourself. As to all your questions, they are actually all answered in my article. to make things easier, take a look at the images attached.&nbsp;<br> Feel free to ask<br> Cheers
excellent instructable...
Very cool idea. Good Job.
The one complaint I have is that the different parts to Canon in D are actually supposed to be played together, in a round. The cello line is also supposed to be repeated continuously throughout the entire song. While I understand that doing that is likely beyond the capacity of the device, it still doesn't sound good having it mutilated like this. <br> <br>A way to remedy this without adding additional hardware: Replace one of the tracks with a 'loop' indicator; it records all the notes played while the loop bit is set, and then plays them back repeatedly (in addition to further notes) until the recording is replaced by a new section.
You are right. This canon does sound weird without the repeating loop. Like you said the repeating part is beyond the note range the device covers. <br>Also It is more of a novelty item than a real instrument.<br> <br>
Very cool. <br> <br>A possible variation on this would be to have a MIDI version where instead of generating tones, it would send MIDI note on's &amp; offs to a MIDI output (just saw one here a few days ago). There could even be a band that does an octave switch for more range.
You can do that, it will actually be simpler in the code. accurate timing will no longer be essential. <br>But that kinda defeat the idea of a stand alone system. Actually you can replace the IR sensors with a keyboard and play music
Understood. However the angle of hand-drawing something (besides notation) that a robot then plays back is kind of cool MIDI or not.
Great project I can appreciate the quantity of work here, when I think of feeding a paper strip I think cash register or calculator paper feed, it's ready made reliable and you could make quite a long tune.
I had the similar idea using the thermal paper and a receipt printer.
I love this! I want to try putting in a scantron to see what music a quiz makes.
Or you can put the music through a scantron see how many mark you get
great idea

About This Instructable




More by h2osteam:Electronic Music Box Powered by Arduino (sort of) Electronic Music Box Clap and let there be light 
Add instructable to: