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.
This project is compatible with Arduino Uno (Rev2 and Rev3). More details are found at the end of the text.

pcb photo

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.

An Atmel compatible programming connector is provided on the PCB (CN1).
The data mode is selected by jumper J1: default 1:1 binary, MIDI<-->ASCII when the jumper is set.
Baud rates are selected by jumpers J2 and J3: default 38400 (no jumper). 19200 when J2 is jumpered, 9600 when J3 is jumpered, 4800 when both jumpers are placed.
Instead of jumpers, these pins can be connected with separately mounted toggle switches.

The RS-232 interface is designed as a transistor circuit, which looks simple but works reliably. For proper data input to RS-232, a negative input voltage during idle or "mark" state is not really necessary. The High/Low threshold of commonly used RS-232 interface chips is about +0.7 to 0.8 Volt.

The 5 Volt power supply is build with a 7805 compatible switching regulator, which accepts 8-30Vdc input.
The dual red/green LED signals presence of power supply and data transfer: In idle state it shines yellow-orange. When bytes are received at CN2 (RS-232), the LED flashes green (red goes off). When bytes are received at MIDI IN, the LED flashes red (green goes off).

circuit diagram

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.

assembly diagram

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.)
All resistors are 0.25W types carbon or metal film. All capacitors are preferably multilayer ceramic, 5.08mm raster - except C3 and C4 with 2.54mm raster. Precision tolerance of all parts is uncritical.
Special parts:
CN5 "Roka" brand, Conrad order no.737992.
IC3: TSR-1-2450 (Traco Power), supplied by Conrad and Reichelt. Alternative R-785.0-0.5 (Recom).
LED: L115WEGV, Conrad no.187496. Other types may be used, then R2 and R3 have to be adjusted.
For E1 a low-ESR type is recommended but not necessary.

cabinet
If the PCB is cut a little bit wider than outlined (75mm), then it fits perfectly into an aluminium cabinet model "Fischer Elektronik FRAME",
Reichelt order code FR 80 42 100 ME.

Arduino Uno compatibility

The 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.
Arduino serial interface
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).

Downloads:
The subsequently downloadable material is copyrighted (c)2014-15 by Wolfgang Schemmert
Assembly and use of the interface is permitted for free by everybody for any purpose ("freeware")
All information is based on best knowledge, but without any warranty. Any responsibility is excluded.

PCB layout (1:1 TIF format)

Schematic full resolution

Firmware hex code for ATmega328P (rev.3,May2015   provided 'as is' - without any warranty)
(recommended Fuses configuration: extended 0xFC, high 0xCF, low 0xE7)

Firmware hex code for ATmega168 (rev.3,May2015   provided 'as is' - without any warranty)
(recommended Fuses configuration: extended 0xFF, high 0xCC, low 0xE7)

Firmware hex code for ATmega88 (rev.3,May2015   provided 'as is' - without any warranty)
(recommended Fuses configuration: extended 0xFF, high 0xCC, low 0xE7)

Firmware hex code for ATmega8 (rev.3,May2015   provided 'as is' - without any warranty)
(primarily recommended Fuses configuration: high 0x9F, low 0x7F
or with full swing oscillator (more stable, more electronic noise): high 0x8F, low 0x7F)



* 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.