MIDI Keyboard

A 25 key Midi keyboard based on an Arduino (Atmega328P-PU). It has an small OLED Display, too.


Paper PCB

Code

The Atmega 328 on the board should be programed and used like an Arduino UNO. For burning the boot loader and uploading the code please follow the manual for the Paperduino-UNO

MIDI Keyboard Code


MCP23017

I2C

 I2C      	SDA 	SCL
 Arduino Uno 	A4 	A5

Setting the Adress

To set the I2C address of the MCP23017 one has to connect A0, A1 and A2 to GND or to power.
GND = 0 and +5V = 1

 A0 	A1 	A2 	adresse
 0 	0 	0 	0x20    0
 1 	0 	0 	0x21    1
 0 	1 	0 	0x22    2
 1 	1 	0 	0x23    3
 0 	0 	1 	0x24    4
 1 	0 	1 	0x25    5
 0 	1 	1 	0x26    6
 1 	1 	1 	0x27    7

And in the code one has to put the address in the “begin” command:

 mcp.begin(address);

Pulldown Resistor

Every botton is connected to +5V and at the pin to the MCP23017 it has a 10k pulldown resistor to ground.

 IO Pin ----- Button ------- +5V
          |
         10k
          |
         GND

Library

Datasheet

Key and Pin parsing

 MCP1   Key/Note     Pin Library
 A0       D1         0
 A1       C#1        1
 A2       E1         2
 A3       D#1        3
 A4       F1         4
 A5       C1         5
 A6       G1         6
 A7       F#1        7
 B0       A#1        8
 B1       H1         9
 B2       G#1        10
 B3       A1         11
 B4    Switch        12
 B5   Octave Up      13
 B6   Octave Down    14
 B7                  15
 
 MCP2   Key/Note     Pin Library
 A0       D2         0
 A1       C#2        1
 A2       E2         2
 A3       D#2        3
 A4       F2         4
 A5       C2         5
 A6       G2         6
 A7       F#2        7
 B0       A#2        8
 B1       H2         9
 B2       G#2        10
 B3       A2         11
 B4       C3         12
 B5   Program Up     13
 B6   Program Down   14
 B7                  15
 

OLED Display

Pins:

 OLED Display                      Arduino
  
 GND:  Ground                      GND
 VCC:  3.3v or 5.0V Power Supply   +5V
 D0:   CLK                         Pin 08
 D1:   MOSI                        Pin 07
 RST:  Reset                       Pin 06
 DC:   Data Command                Pin 05
 CS:   Chip Select                 NC
 

Bit Converter

http://en.radzio.dxp.pl/bitmap_converter/
To convert a picture one need a 128×64 pixel, B/W, 1Bit Bitmap.
Settings:

 Byte Orientation: vertical
 Width: 128  Hight: 64
 Size Endianness: Little
 Pixel/Byte 8

Example Code

MIDI

MIDI Library

Here are the links for the MIDI library for MIDI over the serial pins (TX, RX).
MIDI Library 4.2

MIDI Specifications

Knowledge

MCP23017

OLED Display

License

The MIDI Keyboard was designed by Wolfgang Spahn 2014.
It is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Creative Commons License