This MIDI Keyboard circuit is capable of encoding any number of momentary action, push to make, single pole single throw (SPST), switches from 1 up to 25 to produce the equivalent MIDI note-on/note-off data commands. The encoded switches are wired via IN4148 diodes. The keys are arranged in a matrix for use with keyboards with up to 25 switches. Any unrequired switches can be left unconnected.
The MIDI start Note is set to C3 (Note 48), but any different start note can be pre-programmed if required. The MIDI channel (1 to 16) is set using the 4-way DIP switch, see Table. The encoded switches are wired via IN4148 diodes.
This unit can work in standard MIDI mode and via the USB connection. It defaults to standard MIDI Baud rate of 31250. By replacing the original firmware on Mega8u2/16U2, the Arduino Uno will act as USB-MIDI device (Standard Midi Class), you do not need to install additional device drivers on Windows, MaxOSX, and Linux, as the firmware acts as a device of Standard Midi Class. It will automatically install on the system as an Audio USB Device.Operation:
This unit can be connected to new Keyboards or it can be used with an older non-MIDI Keyboards by using magnetic/reed switches to isolate the old and new scanning circuits. This will allow the older Keyboard synthesizer to continue to operate as normal while also providing a MIDI output.MIDI Keyboard Wiring:
The switches are organized in a 6 x 5 matrix (30 switches) arrangement. Note if less than 30 switches are required, then ONLY the switches required need to be wired. The switch keys are wired as shown in the switches circuit schematic diagram.
The lowest note is switch 1 wired via diode D1 between Pins D8 and A1 (D15) of the Arduino. Pin D8 is also wired to the Anode of diode D7 and via SW7 to Pin A2 (D16) of the Arduino. Pin D8 is also wired to the Anode of diode D13 and via SW13 to Pin A3 (D17) of the Arduino. Pin D8 is also wired to the Anode of diode D19 and via SW19 to Pin A4 (D18) of the Arduino.
Arduino pin terminal connected to A1 ( D15) is wired to one side of the 6 key switches SW1 to SW6, and the wire can be looped from one key switch to the next. Arduino pin terminal connected to A2 ( D16) is wired to one side of the 6 key switches SW7 to SW12. Arduino pin terminal connected to A3 ( D17) is wired to one side of the 6 key switches SW13 to SW18.
Arduino pin terminal connected to A4 ( D18) is wired to one side of the 6 key switches SW19 to SW24. Each of the other side of these switches SW1 to SW6 is wired to a diode on the Cathode (K) side (end of diode with stripe).The other side of each of these diodes is looped to 4 other diodes. For example Anode (A) of diode D1 is looped to D7 then to D13 then to D19. The rest of the wiring is done in a similar manner.Power Supply:
External power can come either from an AC-to-DC adapter or battery. The adapter can be connected by plugging a 2.1mm center-positive plug into the board's power jack.
The board can operate on an external supply of 7 to 20 volts. If supplied with less than 7V, however, the 5V pin may supply less than five volts and the board may be unstable. If using more than 12V, the voltage regulator may overheat and damage the board. The recommended range is 7 to 12 volts.MIDI Channel Selection:
The MIDI Channel (1-16) is user selectable via the 4-way DIP switch. The system will also work with MIDI running status.
Table 1 MIDI Channel