Build your own MIDI projects
Frequently Asked Questions.
MIDI & Music
MIDI and Music Information
MIDI 8-way Program Change Unit


MIDI 8-way Program Change Unit


This project uses MIDI Program Change Commands  to operate an 8-way changeover relay units allows lights, guitar effects units etc. to be switched on and off and the sequence to be stored in real-time to a MIDI sequencer. Each Program Change value, from 0 to 127, can control up to 8 relays.  There is also a MIDI out socket so the MIDI data can be looped through a number of units, allowing control of more than 8 relays.


An advantage of using Program Change data, instead of Note on/off commands,  is that you can interface with a lot of MIDI controlled effects units.







midi_in_out_mega.jpg (283771 bytes)


MIDI 8-Way Program Change


PRICE:  €70.00







The MIDI 8-way Program Change unit utilizes:

  • An assembled Arduino MEGA unit including a suitable pre-programmed Atmega microcontroller,
  • A 2.1mm power socket, and associated Power LED, 
  • Select MIDI channel via a 4-way DIP switch,  
  • A MIDI 5-pin DIN input socket,
  • A MIDI 5-pin DIN output socket,
  • The 4-way DIP switch which selects the MIDI receive channel via 4-way DIP switch (See Table 1)
  • 1 Record toggle switch input, and associated LED,
  • 8 switch inputs for relay ON/OFF selection,
  • 8 positive logic outputs (ON for +5 Volt, OFF for 0 Volt),
  • 8 negative logic outputs (OFF for +5 Volt, ON for 0 Volt),



The MIDI 8-way Program Change unit also requires:

  • A 9v battery or equivalent DC power source
  • 8 toggle switches 
  • 1 Record Mode toggle switch,
  • Suitable relay interface circuitry


Circuit Schematic:


The schematic drawing diagram of the connections for the switches and the relay driver outputs on the Arduino board is available. Note that some relay boards use a Positive logic input and some relay boards use a Negative logic input. So there are 8 positive logic outputs (ON for +5 Volt, OFF for 0 Volt), and 8 negative logic outputs (OFF for +5 Volt, ON for 0 Volt).


A circuit schematic of the MIDI IN/OUT board shows the Input/Output connections. Arduino Pin D0/RX is connected to the output of the Opto-coupler whose input is connected to the MIDI IN socket. Arduino Pin D1/TX is connected to the MIDI OUT socket via resistor R5. Arduino Pins D2 and D3 provide +5 Volt and 0 Volt(GND) but they need to be set correctly in the software. Arduino Pins D4, D5, D6 and D7 are connected to the 4-way DIL switch, which can be used to select the MIDI Channel (1 to 16).



     *Click to Enlarge*

The MIDI IN and OUT connectors use  5-Pin 180 degree DIN sockets. Note that the MIDI IN/OUT wiring is polarised and the correct pins should be used.




So 8 Pins (D0 to D7) are used  when the MIDI IN/OUT board is plugged into the Arduino. All other pins are still accessible. 




The circuit schematic for the Arduino MEGA is also available. Also available is the Arduino Mega board and pin layout.



The MIDI 8-way Program Change unit can operate in two modes Normal and Record mode. In Normal mode the toggle switches are not required as the MIDI information is read from a hardware/software MIDI sequencer, when this controller command information is fed to the MIDI IN socket on the unit.


1) Normal Mode

In normal mode the MIDI 8-way Program Change unit receives input MIDI data and when it detects a Program Change Command, on the right MIDI channel, it switches the associated relays ON or OFF, as appropriate. The MIDI data can be generated by a MIDI sequencer or by the 8 toggle switches in record mode.


2) Record Mode

In record mode the 8 toggle switches are set ON or OFF as required and when the correct values are set the MIDI input is scanned and when a MIDI Program Change is detected  the switch values are stored in the EEPROM and the record LED is turned ON. So for any Program Change number (0 to 127) the associated relay ON/OFF values are stored. 


Also the corresponding MIDI Program Change Command is transmitted to the MIDI out socket, where it can be sent to be recorded on a MIDI sequencer in real-time. The units can be linked serially together ( MIDI OUT to MIDI IN) if more than 8 outputs are required.


Guitar Effects Operation

The relays can be wired so that a guitar effects unit can be switched in or out of a effects loop chain. Wiring of the relays is shown at Guitar Effects (FX) Unit Relay Switching. Any ON/OFF relay combination can be pre-programmed to a particular Program Change. 


Output Current Drive:

You can get a maximum of 40 mA (milliamps) current from each output separately. But the maximum combined rating when several pins are active at the same time  is 200 mA for all pins. However it is probably best not to run the outputs at their maximum rating.


MIDI Specification: 

The outputs are switched ON/OFF via MIDI Program Change commands. These MIDI commands are all channel (1-16) dependent. The MIDI channel (1 to 16) is selected by the 4-way DIP switch, shown in Table 1. The unit also works in MIDI Running Status mode.


DIP Switch Selections



4 3 2 1
on on on on 1
on on on off 2
on  on  off on 3
on on off off 4
on off on on 5
on off on off 6
on off off on 7
on off off off 8
off on on on 9
off on on off 10
off on  off on 11
off on off off 12
off off on on 13
off off on off 14
off off off on 15
off off off off 16

Table 1 MIDI Channel



The MIDI 8-way Program Change Unit can be combined/expanded by connecting the MIDI OUT of one unit to the MIDI IN of the following unit. So that groups of 8, 16, 24, 32 etc relays can be controlled. Each unit can correspond to a different MIDI channel (1 to 16) which is user-selectable via the 4-way DIP switch.


Power Supply:

The  Arduino MEGA can be powered via the USB connection or with an external power supply. The power source is selected automatically. The Arduino MEGA draws about 65 mA on standby.


External (non-USB) power can come either from an AC-to-DC adapter (wall-wart) or battery. The adapter can be connected by plugging a 2.1mm center-positive plug into the board's power jack. Leads from a battery can be inserted in the Gnd and Vin pin headers of the POWER connector. A low dropout regulator provides improved energy efficiency.


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.