The key scanning circuit provides the electronic interface between the key switches and the micro-controller. Digital keyboards have many key switches. At least 88*2 are required for a velocity sensitive standard piano layout, and many experimental designs call for many more. Most microcontrollers have on the order of 10-20 digital I/O pins, so some scanning circuitry is necessary for all but the most trivial keyboards.
An outline for an 88 key design using an Arduino
Multiplexing lots of analog signals into a uC
Useful Parts
Decoders:
- SN74LS138N is the only DIP 3->8 pin decoder on digikey. Nice old school TTL logic family chip.
- There are several 4514 family 24-DIP 4-16 decoders available. i.e. CD74HCT4514E, HEF4514BPN
ADC's:
- You can get ADC's with onboard MUX to effectively provide lots of channels.
- You can get microcontrollers with built-in ADC's on darn near every pin. (Simpler!)
Analog Mux:
Microcontrollers:
Drew: I'm really happy with the atmel atmega168 that I started using thanks to the excellent work of the arduino project, which is a cheaper and easier to use branch of the Wiring Project. The standard board can be programmed over USB, and it has a cross-platform IDE that really just works, even in OS X!
Update: Developing in C for any of the chips in the AVR family looks reasonably easy. I'm tinkering around with some code in the google group subversion repository.
External Links to Scanning Circuits
- http://code.google.com/p/diykeyboard/images/fatar_88_key_matrix.gif
- http://code.google.com/p/diykeyboard/atmega168_arduino_pin_mapping.png
- A japanese guy selling pre-programmed PICs for key scanning. It takes about five, and he charges about $20 each.
- Velocity sensing IC gets 5 octaves with no further chips, 68 pin PLCC package
- E510 Velocity sensitive MIDI chip. Changeover switch type. 16 PIN DIL 128 keys velocity sensitive keyboard scanner
- Some DIY keyboard scanners based on PIC16F84:
- A DIY project, based on microcontroller, uses 74HC138 decoder chip
- MIDI keyboard Encoder (No velocity sensing)
Circuit Board Layout and Fabrication
fab houses popular among DIYers:
http://www.4pcb.com/
https://www.mktpcb.com/