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.

http://en.wikipedia.org/wiki/Chromatic_scale

http://www.harpsatsang.com/harp_design/data/frequencies.html

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.

PCBs,

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.

Thought:

– 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 :).

Protostack ATmega168A development kit and USBasp programmer arrived

I won an ATmega 168a development kit form DP days ago. The kit is provided by Protostack.

http://dangerousprototypes.com/2011/07/07/protostack-dev-board-and-programmer-winner/

Today, I got the the board, accessories. Not only development board and also a  USBsap programmer.  How amazing support for developer.

Thanks to DP and Protostack. As promised, I will construct a DDS signal generator (+ more optional features).

A through, brief review for kit,

  •  Well designed and good quality PCB
  • Doubled side PCB but for through hole components ( as a developer, I love to solder through hole although SMD parts are  fun for me)
  • Plenty of spaces for prototyping area
  • Two area, controller, power, ISCP, ICD and development area
  • development area is breadboard friendly
  • Boards are stack-able style
  • Can be power with CR2032 battery clip or USB (optional)
  • Well documented

For programmer;

For interested, closed up photo from Protostack.com.

Programmer,