MIDI / RS-232 Converter
This is a DIY construction manual for an electronic circuit which transforms the physical layer and baudrate of a standard RS-232 signal into MIDI physical layer and baudrate - and vice versa. The RS-232 interface supports 38400, 19200, 9600 and 4800 Baud. The basic mode of operation is bidirectional 1:1 retransmission of every byte. Optionally bytes sent as hex formatted ASCII text to the RS-232 interface are retransmitted in 8 bit format from MIDI OUT. Vice versa, every byte received at MIDI IN is retransmitted then as ASCII text from RS-232. No special drivers or command codes are needed.
The heart of the circuit is a microcontroller ATmega328P, which provides 1 kilobyte buffer in each data direction. Alternatively an ATmega88, ATmega168 or ATmega8 may be used, which provide about 400 to 500 bytes buffer in each direction. All features else are the same. Because these microcontrollers are equiped with only one USART, the MIDI interface uses a precise software programmed USART. For best noise suppression every bit of the serial MIDI signal is sampled 7 times and the actual bit level is interpolated. For this reason a relative high clock rate of 16MHz is used.
The layout of the PCB is strictly arranged in a 2.54 mm grid and the printed "wires" are put in a way which is well reproducable for manual construction on a hole matrix veroboard (german: Lochrasterplatine) with copper dots (not stripes). The female subD connector for RS-232 (CN2) and the DIN connectors for MIDI (CN3, CN4) may be soldered directly on the PCB. For displaced mounting separated from the PCB, connectors CN2A,CN3A and CN4A are provided. This way front panel mounting is easier and looks better when no precision mechanical processing is possible.
For all holes a 0.8mm drill is recommended, except following parts: CN1,CN2,CN2A,CN3A,CN4A,D3,IC3,jumpers:1.0mm. CN3,CN4:1.3mm. CN5:1.5mm. (CN2 and CN5 do not fit properly into the 2.54 mm grid.)
Arduino Uno compatibilityThe firmware is 1:1 compatible with Arduino Uno (Rev2 and Rev3). The RS-232 and MIDI interface hardware has to be built around the Arduino board, as a shield or somehow else. The RS-232 port is connected with the ATmega8U2/16U2 serial lines and can be used simultaneausly with the USB interface, appropriate baud rate of the ATmega8U2 provided. The baud rate of the ATmega328 is selected by J2 and J3 and overrides the Arduino default setting. Care should be taken not to merge both received byte streams. In its original/default state, the USB interface of the Arduino is not useable as a true MIDI interface, however, because it does not support the USB MIDIStreaming class.
MIDI IN has to be connected with Arduino digital I/O no.8 (PB0).
MIDI OUT has to be connected with Arduino digital I/O no.11 (PB3).
The dual LED has to be connected with Arduino digital I/O no.12 and 13 (PB4 / PB5). The RX/TX LEDs mounted at the Arduino PCB work only on the USB interface.
Serial programming of the ATmega is not obstructed by the additional hardware at PB3/PB4/PB5.
J1 has to be connected with Arduino digital I/O no.5 (PD5), but seems not to be necessary for most users.
J2 has to be connected with Arduino digital I/O no.6 (PD6).
J3 has to be connected with Arduino digital I/O no.7 (PD7).
Firmware hex code for ATmega328P (rev.3,May2015   provided 'as is' - without any warranty)
Firmware hex code for ATmega168 (rev.3,May2015   provided 'as is' - without any warranty)
Firmware hex code for ATmega88 (rev.3,May2015   provided 'as is' - without any warranty)
Firmware hex code for ATmega8 (rev.3,May2015   provided 'as is' - without any warranty)
* State of information August 2015.
* Right of technical modifications reserved. Provided 'as is' - without any warranty. Any responsibility is excluded.
* This description is for information only, without any warranty. No product specifications are assured in juridical sense.
* Trademarks and product names cited in this text are property of their respective owners.