DIY Musical Keyboard

The idea is to design and construct an electronic musical keyboard with some functions, effects etc,. This is my old school project and I remake and modified it. It is fun.

There are many hobbyist’s musical keyboard circuits around the net.  Most design are based on 555 or some oscillator circuits. The limitation of these design are that this circuit generates only one tone at a time. To play a real chord, several keys  are to be pressed at the same time and generate multiple tones at the same times. Ie,. for 12 tones, there will be 12 frequency generators are required. If a keyboard has 48 keys, 48 tone generators are required.

This can be saved by 4060 CMOS logic chip. The 4060 is 14-stage ripple-carry binary counter/divider and oscillator. The internal function block diagram of 4060 from datasheet is as follows. Output Qn is the nth stage of the counter, representing 2^n, for example Q4 is 2^4 = 16 (1/16 of clock frequency) and Q5 is 2^5 = 32 (1/32 of clock frequency).

4060 IC functional block diagram (from TI data sheet)

The frequency of chromatic scale can be learned here.

There are a relation between the frequencies of octaves scales. The first octave of  C1 (16.3Hz) is half of second octave C2(32.7Hz) and so on. The 4060 IC can divide its clock frequency via Qn outputs. We will need 12 x 4060 tone generators and it will supports 7 octave as maximum (12×7 = 96 tones, bingo).

Thus, the initial design is like that. The design is composed of 12×4060 tone generators, a dsPIC for sound effect and control, an amplifiers.

Musical Keyboard block diagram

The first circuit is 4060 tone generators. The clock frequency can be calculated as f = 1 / (2.3xR2xC1). I plan to use 4 octaves (48 tones) and starting from C3(130Hz) to B6(1975Hz). You can choose what scales are used. For roughly calculation, the adjustable  frequency range of RxC circuit should be covered this selected range. For next expansion,  I prepared for 6 tones outputs in design.

Updated: thanks Rollicks for pointing the right frequency calculation f = 1 / (2.3xR2xC1).

4060 Tone generators circuit

The next circuits are simple 7805 power supply and LM386 audio amplifier. Nothing specials.

7805 5V regulator

LM386 audio amp circuit

The first step is preparing the physical key and PCBs. The keys are salvaging from old toy china made keyboard. Unfortunately  the switches from toy keyboard used matrix keys. So, I made a PCB for switches also.


Prepared switches bar with the original switches dimension.

And next switches assemblies,

And circuits and wiring,

Initial setup is finished.

Tuning the frequency, I used my Nexus 7 and gStrings tuner app :D.  Thanks the developer for such useful applications. Only one octave is required to tune. Once,the C3, C4 or one of any note is tuned and the rest will be in-tune atomically because of frequency divider.

Finally, after some weekends and many coffees, the first phase design is like this.

The next step:

– You may notice the blank space at the moddle of board. Yes, this is for dsPIC sound effects and control

– I have to make a upside cover also.


– The switches are not ease as original keyboard. I have to find more proper solution for final design.

– The LM386 amp is not matched with tones. I notice some distortion in low volume. I will replace with a proper stereo amplifier in next phase. I want the left and right octaves with separated effect and sound output.

For now, it is ready for open 7400 logic competition because it has only discrete logic :).

Bus Blaster v2 and gift arrived

last a few weeks ago, I ordered Bus Blaster v2 from Seeed, my favorite open hardware facilitator and supplier. Bus Blaster v2 is an experimental, high-speed JTAG debugger from Dangerous Prototypes. I explorer the world of embedded and this tool will help me a lot.

Luckily, it was a 4th annual birthday of Seed and I also got a Seed T shirt and solar charger shield as special mysterious gift. Thanks to Seeed. Sure, I will make a renewable energy project with this shield.


I am back

I am back to my workbench and smell of soldering iron.

I live in Myanmar. Yes, a strange country many lack of things and full of opportunities opened it’s door. For day job, I work as a professional in ICT sectors. My company deployed mass amount of mobile and internet infrastructure since last year. I traveled and worked around the country with a tight project schedules.  I noticed that my tiny blog has some visitors even without update.

Many tasks are pending at my desk. Many projects and circuits are not finished yest since last year. I will try to update ASAP. Dear visitors, you are welcome.