MiniDexed TX816 – Part 5 – Mechanical Assembly

Having now built the required PCBs and obtained a panel, this post starts to think about the actual mechanical assembly of the MiniDexed TX816.

Posts in this series:

  • Part 1: Introduction, context, and high-level design.
  • Part 2: PCB design.
  • Part 3: Panel design.
  • Part 4: PCB assembly.
  • Part 5: Mechanical assembly.
  • Part 6: Pico MIDI Router and TX816 IO Code.
  • Part 7: In use!

Warning! I strongly recommend using old or second hand equipment for your experiments.  I am not responsible for any damage to expensive instruments!

If you are new to microcontrollers and single board computers, see the Getting Started pages.

Pico and IO Integration Test

Prior to the full mechanical assembly, I thought it prudent to check that the Pico was able to correctly talk to both IO panels.  And to be honest, I really wanted to see those LEDs in the panel for the first time!

Recall, that the current status is as follows:

IMG_6875

I’m still not adding the Raspberry Pi itself into the mix, so I’ve kept the “Pico 5V” patch from testing the IO boards (see photo below), and I’m relying on the Pico for 3V3 power too, both of which will be supplied via the Pico’s USB interface.

The IO board for TG1-4 can be directly connected to the Interface board using the soldered on headers.  The IO board for TG5-8 still has no connector, so I’m going to keep using the “fishing line trick” to temporarily use a 20-way dupont style pin to socket cable to connect it to the Interface board.

But first I need to decide on the fixing on the Interface board.  I’ve now added a 20-way set of right-angled pin headers soldered to the top of the board as shown below.

IMG_6867

The three boards and be assembled and then, optionally, but as I say, this was my main reason for doing this test in the first place, they can carefully be inserted into the panel for testing.

IMG_6874

Recall that the holes in the front panel for the potentiometers needed widening from 8mm to 9mm due to the type and style of potentiometers I ended up using.

IMG_6872IMG_6873

Take particular care with the 16 individual LEDs.  But if the panel was used to correctly align them and set the height as suggested previously, hopefully they will line up and push back in with just a little, gentle encouragement!

Full IO Panel Integration Code

The code for the IO panel is a slight evolution of the previous code. It has now been extended in the following ways:

  • It now scans all 8 switches.
  • It now drives all 16 LEDs via the two shift registers.
  • It monitors all 8 potentiometers.
  • It now initialises the MAX7219 library for 16 digits, with 8 “scan_digits” indicated – i.e. 8 digits per MAX7219.

During the course of this testing, I’ve actually updated the two libraries I’m using.  Recall, I am using the following:

And have already updated the MAX7219 library to support the Pico’s SPI 0 bus on GPIO 16-19.

It turns out there is a bug in the cascade handling (or I think there is anyway).  There seems to be additional flicker in the second set of digits in the cascade, but that can be fixed by updating the MAX7219 library’s flush() command.

To fix this (optionally), the following line must be updated as shown:

#self._write([pos + MAX7219_REG_DIGIT0, buffer[pos + (current_dev * self.scan_digits)]] + ([MAX7219_REG_NOOP, 0] * dev))
# Replace with:
self._write(([MAX7219_REG_NOOP, 0] * (self.devices-dev)) + [pos + MAX7219_REG_DIGIT0, buffer[pos + (current_dev * self.scan_digits)]] + ([MAX7219_REG_NOOP, 0] * dev))

This has been reported as an issue against the library, so this might even be fixed by the time you read this.  Either way it is optional.  Everything else works fine without this fix anyway.

Find the test code on GitHub here.

MiniDexed Panel IO Mounting

Now its time to fix the panel-mounted components.

IMG_6877

Bill of Materials:

  • 128×64 OLED SSD1306 display.
  • Panel mounted, switched rotary encoder (8mm mounting diameter).
  • Power switch (12mm mounting diameter).
  • 2x TRS sockets for MIDI (8mm mounting diameter).
  • 1x TRS socket for Audio (8mm mounting diameter).
  • 1x stereo 3.5mm jack plug.
  • 1x LED and resistor – I used RED and 1KΩ.
  • 4x M2 5mm screws and 4x M2 nuts.
  • Jumper or connecting wires as required.
  • Sacrificial short USB extension cable to be spliced across the power switch (micro USB for a Pi 3; USB-C for a Pi 4).

Rotary Encoder

I’m using a PCB mounted encoder with a bush for panel mounting.  As this will be fairly close to the Raspberry Pi Pico, the pins need to be “flattened out” prior to soldering.  The GND pin (centre of the three pins) needs connecting to one of the switch pins, then the other three connections will be switch, “A”, and “B”.

To connect it back to the interface board, I’m using a 4-way “dupont” style jumper wire with pin header sockets on the end, soldered directly to the encoder.

IMG_6878

I’ve then taped up the back with insulating tape to prevent shorts once everything is together.

OLED Display

The OLED display also requires a 4-way “dupont” style connector, soldered onto the 4-way set of header pins.

IMPORTANT: Make careful note of the pin order.  The pins on the interface board are in the following order: GND-VCC-SCL-SDA, which happens to match most of the OLED displays I’ve used to date.  But the one I picked up for this build has the GND and VCC swapped around!  So watch out 🙂

IMG_6881IMG_6882

Once the cable has been fitted I covered the connections with insulating tape again.  Then the display itself can be mounted onto the panel using M2 (2mm) nylon screws and nuts.

The three TRS sockets, the power switch and the LED can now be added too.  The LED is the same “lighthouse” or “tower” type used for the IO boards. It fits into a 2mm hole.  The power switch hole is 12mm, but the switch I ended up using was 12.5mm, so I had to widen the hole slightly to allow it to fit.

Note: in the photo below this is showing an OLED display without any built-in level shifting.  After spotting this, I swapped to a different one!  More here.

IMG_6884

MIDI Links

There is a 5-way connection to the MIDI circuit.  This supports “pins 4 and 5” on the IN and “pins 4 and 5” and GND on the OUT.  Using a multimeter I worked out which tag connector on the TRS sockets was pin 4 and which pin 5 (see the MIDI Connections Cheat Sheet) and fixed everything accordingly.

IMG_6885

Power Circuit

This is one area that I should have given a little more thought to when designing the boards.  I’d just assumed an external switch and LED would control the USB power to the Raspberry Pi, and that is what I’ve done, but it could have been done a little more elegantly if built into the interface board.

In the end I used a micro-USB breakout and cut the end off a power-only micro-USB cable.  There is no detailed guide here, as each circumstance will be different, but the main idea is to build the following:

IMG_6902

The BLACK wire passes through from socket to plug; the RED wire goes in and out of the switch; the LED goes between the switched RED and the common BLACK via the resistor.

Here are some photos of the somewhat Frankenstein power “circuit” I’ve ended up with.  Notice that I mounted the VCC pin from the micro-USB breakout directly to one of the tag terminals of the switch.  Then I used the GND pin as a common point for the BLACK wire and the cathode side connection from the LED.

Finally, I used a fair bit of hot-glue to give it some semblance of rigidity and covered it all up with tape.

Audio Link

Finally, I used twin, shielded cable for the audio link, fixing a 3.5mm stereo jack on one end and soldering the other end to the audio TRS socket.  Again, I used a meter to check which solder tag on the connector was the tip and which was the ring to try to get them correct.  If they end up swapped then L and R will be reversed.

IMG_6894

Assembly

The final assembly will vary according to specific circumstances, but in general terms, this is what was required for me.

Bill of Materials:

  • 8x M2.5 screws.
  • 8x M2.5 nuts
  • 4x M2.5 washers
  • 4x M2.5 10mm spacers (M-F)
  • 4x M2.5 20mm spacers (M-F)

The suggested assembly sequence is as follows:

  1. Mount top IO board.
  2. Mount bottom IO board.
  3. Connect Interface board to panel mounted components.
  4. Mount Interface board.
  5. Mount Raspberry Pi.

So starting with the panel and all panel-mounted components ready to be connected…

IMG_6896

Now add two 10mm spacers to the top IO board (TG1-4) in the lower pair of mounting holes, poking downwards towards the interface board.  I used the washers to increase the spacing slightly to fit.  It all depends on the length of the headers used.

IMG_6895

Carefully mount the IO board onto the panel, lining up the potentiometers, 7-segment displays, and most importantly, the LEDs, which should be positioned correctly to push flush into the panel holes.

If it hasn’t already been done, now is the time to ensure that the “power fix” has been performed.  I’m using a Pico with the 3V3_OUT pin omitted, as shown below.

IMG_6898

Once the Pico is fitted onto the Interface board, the panel-mounted components can also be connected.

IMG_6897

Now the four 20mm spacers need to be added to the Interface board using the holes to mount the Raspberry Pi.  The spacers will poke through to meet a nut on the component side of the board.

IMG_6899

Now the second IO board can be added.  Once again, two 10mm spacers must be added to the board, but this time using the top two mounting holes.  A 20-way cable will be required to connect the IO board to the Interface board, to serve TG5-8.

IMG_6901

Finally the Raspberry Pi and be added; the audio connection linked up to the PCM5102 on the Interface board, and the power link made to the Pi.  Here you can see I’ve used a Raspberry Pi 3A+ which I’m hoping will be sufficient to run the 8 tone generators of MiniDexed.  If not, then I’ll switch to a Raspberry Pi 4 (and update the power link to USB-C).

IMG_6900

At this point it should be possible to confirm that all the IO is still working ok, but running the same dual-IO test program described above, but this time powering the board from the Raspberry Pi.

No SD card (or operating system) is required for it just to act as power delivery to the Pico.  But at this point the power switch and LED should also be functioning.

The final stage is a test program to try the panel-mounted IO.

Raspberry Pi Integration

At this point it should be possible to test the following, all from powering the Raspberry Pi via the power switch:

  • Raspberry Pi running MiniDexed as before: verifying use of the display, encoder.
  • Raspberry Pi Pico driving all IO as before: verifying pots, LEDs, 7-segment display, buttons.

And with the addition of a temporary USB MIDI keyboard plugged into the Pi behind the panel, it can be verified that the MiniDexed can output audio.

To test the Pico to MiniDexed MIDI link requires an update to the code on the Pico.  The simplest case is to initialise the two UARTs on the Pico and route any information from UART0 RX out to UART1 TX.  This should result in any MIDI messages being forwarded on to MiniDexed.  If the messages are echoed back out to UART0 TX too, then the MIDI OUT can also be checked.

This requires the following additional code:

uart0 = machine.UART(0,31250)
uart1 = machine.UART(1,31250)

def checkMidi():
  if (uart0.any()):
    data = uart0.read()
    uart0.write(data)
    uart1.write(data)

And then a call to checkMidi() from the main while loop at the end of the code.  This won’t be particularly responsive, as the Pico is only checking the serial ports with the same frequency as servicing all the other IO and display, but it should indicate that the MIDI route is valid in hardware at least.

The updated code is on GitHub here.

Closing Thoughts

My own build requires a little debugging still, so it isn’t impossible that I’ll uncover some more issues to address – my rotary encoder isn’t working at present – well it almost works, some of the time, so I’ll need to look into that.

But in general terms, I’m really pleased with how this has come together, although I should have done something neater for the power.

But the next step is another big one – getting the software functionality implemented so that the IO panel can actually control the MiniDexed; alongside implementing proper MIDI routing; and then starting to test the performance.  Truth is that apart from the test code, I haven’t even started!

But my hope is that by doing the MIDI routing on one core and all the IO on the other, I can leave all this in Micropython, in which case I have all the routing code ready to go.  But if that isn’t responsive enough, then I’ll have to rewrite it all in C using the SDK which is something I’ve not really had to do yet.

I expect this stage will take me a bit of time.  Watch this space!

Kevin

IMG_6905

Leave a comment