How many times have you heard a song - on the radio, during a movie, or at a concert - and thought "Man I wish I could play that"?  Now you can! This project allows you to learn a song note by note on the piano by lighting up appropriate LED lights that correspond to each individual key on the piano.  In fact, even if you don't have a piano but have a smaller electronic keyboard, you can customize it for that.  Some electronic keyboards actually have light-up keys for just this purpose, but doing it on a real piano is so much more satisfying. Have fun, and learn some songs!

The three main components of this project (like many) are:
1) Software
2) Hardware (non-electronic)
3) Electronics and Wiring
Although they're separate parts of the project, in reality you'll frequently be working on more than one at a time simply because how you decide to do one part affects how you'll do another.  A good thing about doing them in parallel, however, is that you keep the big picture in mind and if you get tired of writing code, you can design your acrylic parts, and if you're tired of the computer altogether you can wire up some resistors and LEDs and have some fun with that.  The parts are in a specific order in the Instructable, but how you do it is up to you.

Conceptual Overview

The biggest question when I started out was "How the heck do you individually control 88 LEDs?!?!"  Fortunately, after some research I found some chips designed to do just that and some Arduino tutorials and code that helped along the way.  Aside from that question, everything else was fairly straightforward or at least only required me to pick from several options - what to make the strip out of, how to hold the LEDs in place, how to write the code to make it all run, and so forth.  Let's talk about the big question in a little more depth so you have an idea of how it all works before you get started.

The chips I got are LED matrix (or 7 segment display) drivers, which means that as far as the chip is concerned, we have our LEDs wired as if they're in a square grid, with a certain number of rows and columns - the positive terminals are common in each column, and the negative terminals are common in each row.  This allows 64 LEDs (in an 8x8 grid) to be controlled by each chip and only requires three (that's right THREE!!!) control inputs.  No matter which or how many of the LEDs you want to turn on, the system can handle it.  

But wait, if you want to turn on LEDs (1,1) and (2,2), wouldn't that also light up (1,2) and (2,1), because in order to achieve the original goal all of rows 1-2 and columns 1-2 would have to be on?  This is where the clock inside the chip comes in - the LEDs aren't actually on continuously.  Rather, they're blinking so fast that the human eye observes them as continuously on.  This is how unwanted LEDs can remain off!

So although we see the strip as just a line of LEDs, they're wired as if they're in two square matrices - one 8x8 (first chip) and one 5x5 (second chip), which adds up to 89 keys (the final "row" of the 5x5 matrix only has 4 LEDs, so that brings us down to 88).  Voila!

How do we tell the chip which LEDs to illuminate?  That's all done using binary numbers.  Using some code borrowed from developers online (see the code for the attribution), I created the program in such a way that all you have to do when translating a song is to call the command playKey(...).  This plays the given numbered key, starting with 1 on the left and ending with 88 on the right.  This command takes the key number and translates it so the chips can do their duty by doing the following: the key number is translated into a row and column number, which is then translated into a row number and a binary number that represents which LED should be on (read from the left, not the right).  For example, if I call playKey(13), which is A, the functions translate that as row 2, column 5; then since 2^5 is 32, that would be the number that goes to the chip.  Reading from the left, 32 is 00000100, which represents the state of the second row.  The same concept applies when we're dealing with lighting up multiple LEDs - it's all about binary numbers!  Check out the code for the exact functions and a little more explanation.

Finally, there's a potentiometer attached to it all to control tempo - something really, really important when you have no idea what you're doing...

NOTE: This was not an easy Instructable to write because of how complicated it was to put everything together and make it all work.  Don't hesitate to let me know if something is confusing or unclear, or if you have specific questions!

Let's get going!

Step 1: Get All the Components

There isn't one right way to make a strip of LEDs fit nicely and elegantly atop your piano keys, so definitely spend some time and see what cool spins you can put on the idea.  Before settling on this design, I bounced around a number of other ideas, some of which would have been uglier and some of which could have been much prettier.  My goal was to achieve balance: making something worth leaving on the piano all year long without spending too much time being a perfectionist.  I was glad with that decision when I started messing with the electronics and software and realized (as expected) that most of the work up front would be focused on those two things.  So see what you can design!  Either way, the electronics and software should work regardless of what your strip looks like.

- Arduino (Uno from Adafruit, $30)
- 88 red LEDs (100 pack from Jameco, $10)
- 2 MAX7219 LED driver chips (Jameco, $16)
- 1 potentiometer (had)
- 2 100nF capacitors (had)
- 1 10uF capacitor (had)
- 2 18K resistors (had)
- PCB prototyping board (Jameco, $6)
-- Note - it's good to have a breadboard too, for prototyping and testing electronics
- 2 24 pin sockets (10 pack from Jameco, $2.40)
- spool(s) of wire (had)
- Arduino USB cable
- Arduino wall adapter (LEDs will draw a lot of current)
- small 8x8 LED matrix for debugging code if necessary - it was SO nice to be able to test this way instead of wiring up the entire strip before I knew the software was right.  Only "debug" one thing at a time!
- black acrylic 7.5" x 13.5" (TAP Plastics, ~$7)
- acrylic glue (TAP, $7)
- solder (thinner is better)
- zip ties
- a piano!

- laser cutter
- soldering iron
- wire strippers
- wire cutters
- small needle-nosed pliers
- acrylic glue hypo applicator (TAP, $3.25)
<p>hy,</p><p>first of all - wow.</p><p>i ordered all the parts and can't wait to start.</p><p>I recommand you to check out the &quot;guitar pro 6&quot; software witch is engineered for the &quot;fretlight guitar&quot;, the program may work on your hardware and all the song are allready in.</p><p>thanks.</p>
Would I be able to use an individually addressable rgb light strip? I'm desperately looking for code to use for my light show project, and I want each bulb to represent a particular pitch. This is the closest to what I'm looking for.
<p>My take would be to build a simple generic serial controller for vizen lights driving the led's, I would then utilize the &quot;Import midi to channel&quot; plugin too map the keys too the output channels which in turn will Light the corresponding keys../Led's.. Inspired me buddy =]</p>
<p>Thanks =]</p>
<p>hi. did you used any library to programme the code? sorry if the question is stupid. I'm a newbie to arduino and electronics.</p>
<p>hi. did you used any library to programme the code? sorry if the question is stupid. I'm a newbie to arduino and electronics.</p>
<p>hi. did you used any library to programme the code? sorry if the question is stupid. I'm a newbie to arduino and electronics.</p>
<p>hi. did you used any library to programme the code? sorry if the question is stupid. I'm a newbie to arduino and electronics.</p>
<p>hi. did you used any library to programme the code? sorry if the question is stupid. I'm a newbie to arduino and electronics.</p>
<p>hi. did you used any library to programme the code? sorry if the question is stupid. I'm a newbie to arduino and electronics.</p>
<p>hi. did you used any library to programme the code? sorry if the question is stupid. I'm a newbie to arduino and electronics.</p>
Hey... This is great !!!! I had this idea in mind... and the purpose you stated is exactly right... to play something we want until we get used to it... one thing can be done is to attach a small mic and read the note we played... if that's right, we can see next led other wise it will show the same one until we play the right key.... this will make sure that we are playing correctly....but anyways... great work and thanks for publishing .
Hi there, <br>great work indeed!..i just a had a quick read...an immediate doubt that i had is...the next led pops up immediately after a key is pressed..my question is :how is the input that a key is pressed recieved?..nd how is it determined that the correct key is pressed?..what happens if a key else than the one corresponding to the LED is pressed?
Thats neat! <br>I have the same idea for 2 years now. <br> <br>The next logical step would be a interface like synthesia, <br>http://www.synthesiagame.com . <br> <br>With a minimum of 5 rgb leds for each key. <br>When you have the programming sorted out you can add microswitches and hang your arduino to an raspberry pie and actually play songs via that software, eliminating the need to program every song. <br> <br>Essentially turning your piano into an kind of acoustic keyboard with midi output . <br> <br>Also if you want you can hook up an screen in stead of the leds, you could also use both. But that way you can practise/play without looking at the keys themselves :-)
I applaud your making. But certainly would never mess up my (future) acoustic piano with that. And that's not a good way to practice piano. You should be looking at the sheet/monitor of music, not your fingers. Those LEDs can only show you the VERY next note set to play. Not the next 2 sets that you need to be ready for. And by the time they show, you probably already missed them in time. Seeing ALL the notes on the screen will actually work. But this won't. <br> <br>I do like the making, though.
Thanks for the comment. &nbsp;And I take your point, but I was intentional in writing that this project will help you learn a <em>song</em>, not how to play the piano. &nbsp;I realize that this method may be more likely to hurt your actual piano-playing abilities (in the traditional sense) than help it, but it's still a neat way to learn songs, and might even reduce the barrier to learning piano in some contexts or at least make someone feel somewhat comfortable with their hands on a keyboard? &nbsp;And the potentiometer is there to control the tempo in real time to avoid missing the next notes. &nbsp;Perhaps a cool extension would be to have multi-color LEDs where one color represents the next note, another color represents the note after that, etc. &nbsp;I'm also curious what you mean by &quot;mess up&quot; your piano, since the strip is just laid atop the keyboard?
Oh - sorry - I saw the glue in the ingredients and freaked out :)&nbsp; (didn't read thoroughly - sorry)<br> <br> I guess it could work for songs with VERY few notes, or maybe just the melody of a full song.&nbsp;<br> <br> Once you start playing real songs, the LEDs are just not going to cut it regardless of color, etc. That sort of thing has to be done on a monitor. I've written a program that does this. http://pianocheetah.com<br> <br> Regardless, it's a pretty cool project :)
wonderful, how many times i thought about to make that, and never had time.... i have the keyboard and all the electronics needed from... years. <br> <br>you are the best, thanks a lot, saved in highlight to built mine this summer. <br> <br>
Right on! Thanks for the kind words and share the results when you get the time to make it!
I was sitting at the piano today and thought of doing the exact same thing just for fun. I typed in &quot;arduino&quot; on the home page, and this was the first thing to come up! Totally weirded me out, but I guess that means I should build it :) Great work!
What a great story! Definitely meant to be. I'd be really interested to see what your result is like, especially if you do a thing or two differently (particularly on the software &amp; song translation side). Keep me posted if you decide to build one!
Great instructable!
Video is private?
Thanks for the alert - fixed it!

About This Instructable




Bio: Always looking for things to improve, repair, improvise, or modify. Studied mechanical engineering and physics at Stanford with a focus on robotics and international development ... More »
More by tcone:The Drink-O-Meter Reflecting on my AiResidency The QuickSilver (Ammo Can Silverware Organizer) 
Add instructable to: