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 about 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 actual version 5 (as of December 2017) supports CTS handshake for the RS-232 interface. If the control software and the data cable supports CTS handshake too, baud rate 38400 is recommended. No buffer overflow has to be expected then. But the interface is fully compatible be used without CTS handshake, there is simply a higher risk of buffer overflow. Without CTS handshake, baud rate 19200 is recommended for heavy load data transmission from RS-232 to MIDI, while 38400 is recommended for heavy load data transmission from MIDI to RS-232. RTS handshake is not supported, because there is no risk of buffer overflow in the PC at baud rates used here.
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 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. Alternatively sockets CN3A and CN4A are provided. When no precision mechanical processing is possible, in most cases separate connectors with metal flange are the better solution. This way front panel mounting is easier and looks better.
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) hardware, but CTS handshake cannot be supported. 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.5, 29 December 2017   provided 'as is' - without any warranty)
Firmware hex code for ATmega168 (rev.5, 29 December 2017   provided 'as is' - without any warranty)
Firmware hex code for ATmega88 (rev.5, 29 December 2017   provided 'as is' - without any warranty)
Firmware hex code for ATmega8 (rev.5, 29 December 2017   provided 'as is' - without any warranty)
* State of information December 2017.
* 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.