As my collection of instruments and projects grows, I find myself plugging and unplugging MIDI cables quite a bit and although I've experimenting with a number of MIDI routers, sometimes I just need a relatively simple way of switching MIDI connections in and out.
This is another one of my "think while doing" projects - in that I've got stuck in to making some PCBs to help me actually work out how it might all work. Consequently there are a number of things that aren't quite right, a few things I really should have anticipated, and one complete mess up. But I'll talk about those as I go.
As a result, I'm not publishing the PCBs themselves, as I'm not sure how much use they would be to anyone else! But I'll revisit this one day and do it properly 
- Part 1: Design.
- Part 2: PCB assembly.
- Part 3: Mechanical design and assembly.

Warning! I strongly recommend using old or second hand equipment for your experiments. I am not responsible for any damage to expensive instruments!
Key Aims
I don't want an intelligent patch bay, like my active MIDI router, but I'm basically after a switchable THRU unit with the following properties:
- Several MIDI INPUTs.
- More MIDI OUTPUTs.
- Switches determine which MIDI INPUT goes to which MIDI OUTPUT.
- Utilises a buffered MIDI OUTPUT THRU stage.
- Choice of MIDI DIN or TRS sockets.
- Powered by 5V directly.
- Panelizable.
- Ideally modular and fitting in the standard cheap tier 100x100mm PCB footprint.
- No microcontroller (so no code) required.
Of course, being totally physical with no intelligence, then if ports are switched mid-stream then there will be corrupt messages and hanging notes (at a minimum). These switches are meant to be used when no MIDI data is being sent only.
The Core Circuit
Everything is based around a MIDI THRU circuit as shown below.

The INPUT circuit is based on a 5V version of the H11L1 optoisolated circuit. The OUTPUT circuit is effectively 10 copies of a 74HC14 buffered 5V output circuit, but each output can be enabled or disabled via a switch.
However, I want four inputs and each of those switches to be part of a 4x10 matrix configuration to allow any of the OUTPUTs to be patched to one of the four INPUTs at any one time.
After chewing over various configurations I found these cheap 4-way switches online. They are basically a 4-in, 1-out rotary switch.

So I decided to base the output circuits around these. To get the modularity and matrix functionality I've ended up designing an INPUT board which contains everything in the circuit above up to (but not including) the switch. Then there is an OUTPUT board that contains the last part of the MIDI OUT circuit from the switch onwards.
In the end, each INPUT board supports two MIDI IN channels and the circuitry for ten MIDI THRU ports. Each OUTPUT port supports two MIDI OUT channels with connections for the THRU outputs from each of the four INPUT channels. This way, I can support four INPUTS and ten OUTPUTs with two INPUT boards and five OUTPUT boards.

INPUT Module PCB Design

As mentioned previously the input board supports two input channels, each with 10 THRU outputs. Both DIN and TRS MIDI sockets are provided. Also included is a basic TL7805 power circuit, so the board can be powered by an input in the range 7-12V.
As this is a 5V throughout circuit, the HC version of the 74HC14 can be used. Previously I've needed the HCT version as it has been acting as a level shifter as well as output buffer. I've opted to include the 220Ω inline resistor for the output circuit on this board.
Looking back now, I'm not sure why I couldn't have put the resistor on the OUTPUT board on the far side of the switch. I obviously considered it at some point, looking at my scribblings. I think I'd only need 1 resistor per output port if I did that rather than 1 resistor per input THRU port. That would have saved me 30 resistors (and the soldering time)! I think at the time I was hoping to have all components on the INPUT board with just connectors on the OUTPUT boards, but of course the switch is part of the OUTPUT board. Oh well. They're just resistors... but I might have to top up my stash of 220Ωs.

I've included a power circuit in the PCB design but it can easily be removed as only one input board will require a power supply. There are also (again removeable) 5V and GND header pins for power to the OUTPUT boards and pin headers for adding in a power switch.
In terms of mechanical design, I was thinking that the TRS jacks could be for the panel connection with MIDI DIN at the rear of the PCB for "internal" connections. The idea is that the four (TRS) input jacks will sit horizontally across the bottom of the panel with OUTPUT jacks in pairs about them.
A slight problem with this idea though is that the PCB mounted TRS jacks I've used don't have panel mount connections! Maybe I should have included some mounting holes in the PCB after all...
With hindsight, another trick I've missed is that I could have used the switching connections on the TRS jacks to disable the DIN sockets if a jack is plugged in. As it is, only one connection can be used. When it comes to actually using the unit, I might cut some tracks and wire them up to the switching terminals anyway.

OUTPUT Module PCB Design

This part is a lot simpler. My first version was also wrong! Sigh. Above is the "V2" which has been corrected.
It was supposed to be just four inputs into the four-way switch and then the MIDI out connectors. I do need the resistor for the 5V connection though. Interestingly I did have the through of having the resistor on this board which will allow "daisy chaining" of the 5V connection rather than each board needing a separate connection back to the INPUT board.
So what is wrong? In translating from the combined schematic to this one, I'd not noticed that I'd turned the MIDI sockets around on the schematic, meaning the pin 4 and 5 connections are the wrong way round. I expect I had a moments distraction and came back to it later or something and then not spotted it. I'd also labelled the four ports the wrong way round compared to the position of the rotary switch.
Here is the PCB for the (V2) version with both of these things fixed and wired to use the switched connectors of the TRS sockets.

Once again the idea is that the TRS sockets and switch will be on the front panel and the DIN sockets can be used for internal connections. Whilst the TRS sockets aren't panel-mountable, this time the rotary switches are.
I had to make a footprint for the switch, but it is effectively just two rows of 5-way headers. Curiously the pins on each row are labelled backwards to each other, but it would appear to only be the rear pins that have any connection.
In terms of positioning of the switches on the board, they could do with being set back a little more to allow both the switches and TRS sockets to protrude through any panel used.
For actual manufacturing I copied the entire PCB layout, rotated it, and created a dual version whilst staying within the 100x100mm footprint. Unfortunately all my manufactured boards were wrong (the file below shows the V1 boards with the mistakes), so I'll describe what I've done to patch them in the build guide.

Closing Thoughts
The V2 OUTPUT board design above incorporates the following changes:
- It has the correct wiring for the MIDI OUTPUT ports.
- Use the TRS switched connectors to link to the DIN sockets.
- The labels for the INPUT ports are reversed to match the way the switches work.
- Mounting holes as described in part 3.
If I redesigned the whole thing, then I'd also make the following changes:
- Move the THRU resistors to the OUTPUT boards.
- Find some panel and PCB mounted TRS sockets.
- Also consider including mounting holes on the INPUT PCB to match.
- Align the switches and TRS sockets better to support panel mounting.
- Add a power LED.
At this stage, I hadn't decided what to do about the front panel: should I have one made again or am I ok with hand-drilled holes in an aluminium panel? Either way, I probably should have considered how to mount the PCBs a little more carefully.
These boards have been sent for manufacturing using the Seeed Fusion PCB service, which I am happy to continue to recommend. They have been supported with discount vouchers that I've been sent by Seeed for my previous projects.
Kevin
No comments:
Post a Comment