Simple Electronic Piano

130K677118

Intro: Simple Electronic Piano

Electronics can make sounds very easily with just a handful of parts. Here's how to make a simple piano using a 555 timer. I designed and tested this circuit using Tinkercad, and then built the real thing.

Here's everything you'll need:

  • 1 x 555 timer (Jameco)
  • 8 x pushbuttons (Jameco)
  • 1 x 100 nF capacitor (Jameco)
  • 1 x Resistor assortment - 390Ω, 620Ω, 910Ω, 2 x 1kΩ, 1.1kΩ, 1.3kΩ, 1.5kΩ, 6.2kΩ (Jameco)
  • 1 x Piezo buzzer (Jameco)
  • 22 AWG hookup wire (Jameco)
  • 1 x 9V battery connector (Jameco)
  • 1 x Solderless breadboard (Jameco)
  • 1 x 9V battery

STEP 1: A Little Background

Danger: There be math ahead...

If you don't care about how this thing works and want to get straight to putting it together, then skip on ahead to the next step.

This piano uses the astable mode of a common 555 timer integrated circuit to produce the tone that drives the speaker (piezo buzzer). If you are curious about how a 555 timer works, and the different configuration modes, there's a good Instructable about it here.

Each musical note has a main frequency, which is how many times per second the thing producing the sound vibrates back and forth per second. The frequency produced by a 555 timer in astable mode relies on the values of the capacitor (C) and two resistors (RA & RB). This relationship is

I decided to design this so that RA and C are the same for all the notes (RA is 1kΩ, and C is 100 nF). This leaves RB to set the tone. So for any particular frequency,

The way this thing is wired, for any particular button RB is the value of all of the resistors from the button to the end of the resistor chain to the right added together. So it was a matter of finding the right chain of resistors to make this work. The following table shows how the resistors were chosen. Starting with the highest note, RB was calculated for each note, and commonly available resistors were chosen to approximate RB.

Notefreq. (Hz)RB (Ω)Resistor(s)C5523131511.5kΩ + 1.3kΩ + 620Ω + 1.1kΩ + 1kΩ + 910Ω + 390Ω + 6.2kΩD5587116621.3kΩ + 620Ω + 1.1kΩ + 1kΩ + 910Ω + 390Ω + 6.2kΩE565910335620Ω + 1.1kΩ + 1kΩ + 910Ω + 390Ω + 6.2kΩF569897271.1kΩ + 1kΩ + 910Ω + 390Ω + 6.2kΩG578486111kΩ + 910Ω + 390Ω + 6.2kΩA58807617910Ω + 390Ω + 6.2kΩB59886731390Ω + 6.2kΩC6104763256.2kΩ

Because of the choice to use commonly available resistors to approximate the values desired, the tones are a little bit off, but not by much.

STEP 2: Try Before You Buy Parts

I first "built" this circuit in Tinkercad to try it out and make sure everything worked before putting the real circuit together. This allowed me to try different resistor values and configurations (for free!) before settling on the final design. I was even able to hear what it sounds like in my browser.

Here's the piano in Tinkercad. Press "Start Simulation" to try it out.

STEP 3: Put It Together

After collecting the parts from the list at the beginning of this Instructable, it's time to put it together.

The long rows at the top and bottom of the breadboard are intended to to connect power (+9 volts and ground) from the battery to the rest of the circuit. These rows are electrically connected all of the way across and act as a wire between components pressed in their holes. Eventually, the black wire (ground) will be connected to the row at the bottom, and the red wire (+9 volts) will be connected to the row at the top. Don't do this yet. You will connect the battery last.

Similarly, each column of 5 holes in the center area is electrically connected. So any two things plugged into the same column are connected as if by a wire. Note that the columns above and below the empty area in the middle are electrically separate.

Start off by placing the 555 timer chip in the breadboard. It will be aligned so that the dot on top of it (pin 1 indicator) is in the lower left when you are looking at it. Place it toward the right side of the breadboard so that the pins straddle the empty channel running down the center of the breadboard. Carefully press it down with even pressure until all of the pins have entered their holes and the chip sits flat on the surface of the breadboard.

The pins of the 555 are numbered 1, 2, 3, 4 on the bottom from left-to-right and 5, 6, 7, 8 on the top from right-to-left. They run counter-clockwise starting at the lower left.

Connect pin 2 to pin 6 of the 555 using an appropriate length of hookup wire. You can see this as the green wire in the pictures above. Connect pin 1 to the ground row at the bottom. Connect pins 4 and 8 to the +9 volts row at the top of the board.

Carefully bend the leads of one of the 1kΩ resistors (brown-black-red) and connect it between pin 7 of the 555 and the +9 volt row at the top.

Connect the capacitor between pins 1 and 2 of the 555.

If the piezo buzzer that you have has bendable wires, then connect the positive (red) wire to pin 3 of the 555 timer. Connect the negative (black) wire to the ground row at the bottom. Otherwise, if your piezo has rigid pins, then place it over the breadboard to the right of the 555 with the negative pin somewhere on the ground row. Locate where the positive pin will connect with the breadboard, and put a hookup wire to connect that column with pin 3 of the 555. Then press the piezo in place.

Now, for the buttons. Start by putting a small hookup wire between pin 7 of the 555 and some column to the left (see the orange wire in the picture above). Locate the 6.2kΩ resistor (blue-red-red) and connect it between the other end of this hookup wire and another column to the left.

Place one of the pushbuttons so that it straddles the channel in the middle of the breadboard with the top-right pin on the same column as the resistor. Carefully push it into place so that it is fully seated in the breadboard. Connect an appropriate length hookup wire between the lower right pin of the button and pin 2 of the 555.

Now it is time for a quick test! Connect the black wire of the battery connector to the bottom (ground) row and the red wire to the top (+9 volt) row. Connect the battery to the battery connector. Try pressing the pushbutton and you should hear a tone! If you don't hear sound, then recheck all of your connections, make sure the battery is good and try again. After this test, disconnect the battery.

Now each of the remaining buttons are added from right-to-left. Connect the resistor from the column of the previous resistor to where the next button will be (4 rows to the left in the pictures above). Place the next button in place with the top-right pin at the other end of the resistor. Connect a small hookup wire between the lower-left pin of this button and the lower-left pin of the button to the right. Do this for all of the buttons. The resistors in order from right to left will be:

  • 390Ω (orange-white-brown)
  • 910Ω (white-brown-brown)
  • 1kΩ (brown-black-red)
  • 1.1kΩ (brown-brown-red)
  • 620Ω (blue-red-brown)
  • 1.3kΩ (brown-orange-red)
  • 1.5kΩ (brown-green-red)

After all the resistors and buttons are in place, reconnect the battery and start playing!

85 Comments

Which piezo speakers will work for this project? I have tried a small one, as well as one similar to the size you have used, in addition I tried some old computer speakers I had laying around. I am having an issue where the speaker is outputting one continuous tone. After reading through some of the comments, you suggested that this may be from the speaker. Are there any other possible problems that would create a constant buzzing noise?
I know this is two years to late, but maybe someone like myself will stumble upon the issue and need a solution. I built this circuit last night, and was having a constant buzzing sound in both the headphones I tried, and the buzzer I had. I could still here an alteration in the sound when I pushed the buttons, but there was a steady sound when no button was pushed. I added a 10uf electrolytic cap between the output pin(3) and the speaker/headphone, and it works perfectly fine now.
Thanks very much, Kavity. That fixed it perfectly for me.
I had the same issue, the reason was I was using a Active buzzer, I changed to a passive one and the issue went away. To test this you could open up the buzzer and remove the circuit board and connect the negative and positive directly to the speaker metal, this worked for me.
Sir plese send the circuit diagram
This experiment done in my engineering project
Please help me sir
Its my honorable request sir
Awesome instruction!
I am teaching kinds the electronics basics. I used this tutorial to create step-by-step guide on how to assemble electric piano. I created two difficulty levels for different groups, with detailed explanation and frequency calculations (thanks to this instructables for formulas and tables collected in one place), and for younger kids just assembly guide. I use it as the introduction class to show kids the fun of electronics and knowledge.
Bellow i added PowerPoint presentation with step-by-step assembly guide.
Hello, may I know if I want to use 3.5mm jack for ear phone, any change on the capacitor or resistor is required? Thanks.
would it matter how much hertz the peizo buzzer is

What kind of piezo buzzer is the most suitable in this project? Because the link you provided is no longer available and I am quite confused while looking up on the Internet.

that one also doesn't work as well, can you please tell me the hertz so that i can shop for a similar one

The resistances are very specific in order to get the proper tones. There's a section of the instructable that discusses how the resistance values were calculated.

Hi, I was trying to figure out how to solve for the fequency. I can not seem to get the right number when I do the equation.

Can you give me an example of what you are trying? Are you trying to solve for the frequency, given the resistances and capacitance?

Can you make the circuit public? I can't look at it otherwise.

I was looking for frequency, but now I understand. Thank however.

I found this interesting to create for my 9th-grade physics project! However, why is there a need for a capacitor, how does it affect the sound produced in any way? Will there be a significant effect if I used a different capacitor (I only have 1000mF capacitor)? Thank you! I'll be sure to credit you in my project's write-up. :))

The capacitor is critical to the functioning of this circuit. The period of the 555 timer depends on the amount of time it takes to charge and discharge that capacitor. Changing the value of this capacitor will alter the time. I gave the frequency formula for this in the instructable:
freq = 1 / (.7 *(Ra + 2Rb) * C)
The capacitor that you have will make the frequency too low to be audible with the resistors I used.

More Comments