Instructables
Picture of LED Piano Learning Strip

Introduction

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!
 
Remove these adsRemove these ads by Signing Up
xinyiic25 days ago

hi. did you used any library to programme the code? sorry if the question is stupid. I'm a newbie to arduino and electronics.

xinyiic25 days ago

hi. did you used any library to programme the code? sorry if the question is stupid. I'm a newbie to arduino and electronics.

xinyiic25 days ago

hi. did you used any library to programme the code? sorry if the question is stupid. I'm a newbie to arduino and electronics.

xinyiic25 days ago

hi. did you used any library to programme the code? sorry if the question is stupid. I'm a newbie to arduino and electronics.

xinyiic25 days ago

hi. did you used any library to programme the code? sorry if the question is stupid. I'm a newbie to arduino and electronics.

xinyiic25 days ago

hi. did you used any library to programme the code? sorry if the question is stupid. I'm a newbie to arduino and electronics.

xinyiic25 days ago

hi. did you used any library to programme the code? sorry if the question is stupid. I'm a newbie to arduino and electronics.

chinmay001vdus10 months ago
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 .
Amal Jose1 year ago
Hi there,
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?
boeietoch1 year ago
Thats neat!
I have the same idea for 2 years now.

The next logical step would be a interface like synthesia,
http://www.synthesiagame.com .

With a minimum of 5 rgb leds for each key.
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.

Essentially turning your piano into an kind of acoustic keyboard with midi output .

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.

I do like the making, though.
tcone (author)  stephen.hazel1 year ago
Thanks for the comment.  And I take your point, but I was intentional in writing that this project will help you learn a song, not how to play the piano.  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?  And the potentiometer is there to control the tempo in real time to avoid missing the next notes.  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.  I'm also curious what you mean by "mess up" your piano, since the strip is just laid atop the keyboard?
Oh - sorry - I saw the glue in the ingredients and freaked out :)  (didn't read thoroughly - sorry)

I guess it could work for songs with VERY few notes, or maybe just the melody of a full song. 

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

Regardless, it's a pretty cool project :)
furri1 year ago
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.

you are the best, thanks a lot, saved in highlight to built mine this summer.

tcone (author)  furri1 year ago
Right on! Thanks for the kind words and share the results when you get the time to make it!
bot boy1 year ago
I was sitting at the piano today and thought of doing the exact same thing just for fun. I typed in "arduino" 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!
tcone (author)  bot boy1 year ago
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 & song translation side). Keep me posted if you decide to build one!
talk2bruce1 year ago
Great instructable!
tcone (author)  talk2bruce1 year ago
Thanks!
Video is private?
tcone (author)  derkeksfresser1 year ago
Thanks for the alert - fixed it!
Insane!