MiniDexed TX816 – Part 4a – PCB Build Guide – RPi Interface Board

I’m not going to do full build guides for the PCBs for this, but I will be documenting in high level terms how they are put together.

There are two build guides, this one for the Raspberry Pi Interface board and a second one (4b) for the IO board.

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.

Raspberry Pi Interface Board

Bill of Materials

IMG_6830

  • MiniDexed TX816 Raspberry Pi Interface Board PCB
  • Raspberry Pi Pico
  • GY-PCM5102 module (NB: Set the solder jumpers as per the Clumsy MIDI board – details here)
  • H11L1 optoisolator
  • 74HCT125 (must be the HCT variant, not the HC variant)
  • MCP3008
  • Resistors: 1×10Ω, 1×33Ω, 1×220Ω, 1×470Ω
  • Ceramic capacitors: 5x10nF, 5x100nF
  • Diode: 1N914 or 1N4148 signal diode
  • DIP sockets: 1×6-way, 1×14-way, 1×16-way – Optional but highly recommended
  • Pin header sockets: 2x 20-way – Optional but very highly recommended!
  • Pin headers
  • 1x 20×2 way dual GPIO extended header socket
  • Optional: 2x PCB mount DIN sockets

Additional components that will be required to complete the front panel components:

  • 128×64 I2C SSD1306 OLED display (see photo and note about I2C power levels and pullups)
  • Switched rotary encoder (NB: not a KY-040 module)
  • 2x Stereo TRS sockets for front panel MIDI connections
  • 1x Stereo TRS socket for audio output
  • Power switch
  • LED indicator and resistor (e.g. 1K)

IMG_6821

A note on I2C SSD1306 Displays

These are typically powered by 5V but are being interfaced to an I2C bus connected to the Raspberry Pi’s 3V3 GPIO.  The issue is that some of these modules include I2C pullup resistors to their VCC pin, so if powered by 5V then the I2C bus lines will also be pulled up to 5V.

Some modules don’t do this, and some modules include level shifters to cope with this.

So basically, it is important to test the display to see what voltage levels the I2C bus is running at and put an appropriate solution in place, probably one of:

  • Find a 3V3 display (although note the PCB assumes 5V power to the display).
  • Use a display with built-in level shifting.
  • Remove the pull-ups and include external pull-ups to 3V3 on the I2C lines instead.
  • Use an external level shifting module.

In the following photo the board on the left has no level shifting built in, but the board on the right includes it – see the device marked “U2”.

IMG_7419

Build Options

There are a number of build choices to be made depending on the final mechanical assembly required.  The key choices are:

  • Whether to use DIP sockets for the chips (up to you – I do).
  • Whether to use pin header sockets for the Pico.  If you don’t then it will be difficult to programme the Pico using the USB socket as there will be components on the PCB in the way.  But if your Pico is “pre-programmed” or you only plan to programme it via the SWD interface, you could solder it directly to the board.
  • How to connect to the IO boards. I recommend pin headers for the TG1-4 board and a cable for the TG5-8 board.
  • How to connect the OLED display, encoder and MIDI.  I’m planning on using header pins on the interface board and then jumper wires soldered directly to the panel mounted components.
  • How to get the audio out.  I’m planning on using a 3.5mm stereo jack and cable from the PCM5102 to a front panel audio jack.
  • How to power the unit. I’m planning on adding a switch and power indicator LED (via a 1K resistor) into the Pi’s USB power lead.  Also, note the comments later about the “power fix” that will be required.
  • If the (rear, underside) PCB mounted MIDI DIN sockets are required.  They are not required if using panel MIDI sockets from the breakout headers. I’m installing them anyway in case I want to use them in the future.  Both types of socket can be hooked up as long as I don’t try to use them both at the same time!

I’ve not made any mention of mounting spacers, nuts, bolts, etc.  These will depend on your exact hardware build, but the PCBs are joined with 2.5mm (M2.5) spacers – the same as those required to mount a Raspberry Pi to the Pi interface board.

Panel mounted components will use nuts, or in the case of the OLED display, four small M2.5 nuts and bolts.

Build Steps

Taking a typical “low to high” soldering approach, this is the suggested order of assembly:

  • All resistors and diode.
  • DIP sockets
  • Disc capacitors.
  • GY-PCM5102 – check the solder jumpers on the back first – see notes.
  • Pico pin header sockets
  • Rest of the pin headers – recommend leaving TG5-8 unpopulated – see notes.
  • Raspberry Pi GPIO connector – NB: additional spacers may be required – see notes.
  • DIN sockets.

Here are some build photos and some important notes.

When it comes to fixing the GY-PCM5102 module, the solder jumpers on the back must be checked – some boards come with no jumpers installed at all. For the required configuration, see the Clumsy MIDI build guide here.

Update: As part of a fix to the power lines (see next section), one option is to remove one of the Pi’s GPIO pins.  The other option is to remove one of the Pico’s pins or its connection in the pin header socket.  Either of these are easier to do before soldering on the respective header, so is worth consider at this point.  The easiest fix that keeps testing the board relatively easy, would be to have a Pico with no 3V3_OUT pin.  See later for details.

Notice that I’ve left the pin headers for TG5-8 off.  The plan is to use pin headers to connect the Pi interface Board to the TG1-4 IO Board; but to use a cable to connect the Pi interface Board to the TG5-8 IO board.  So I’ve left the pin headers for TG5-8 unpopulated for the time being.

When it comes to adding the Raspberry Pi GPIO header, I’ve used an extended header with some additional spacers to give me plenty of room between the Pi and the Pi interface Board.  For spacers I used the plastic from some standard pin headers.

IMG_6827

Finally the MIDI DIN sockets (if used) can be added.  IMPORTANT: the GPIO header and MIDI sockets go on the rear of the PCB.

Update: Errata in Powering the Pico

Now that I’ve had a chance to try integrating the Interface and IO boards, I’ve spotted a problem with powering the Pico.  The ideal way to power the Pico would either be from the Pi’s 5V to its VSYS pin, or via its micro USB connection.  But I’ve connected its 3V3 pin to the Pi’s 3V3 pin.

There are two workarounds that might help:

  • Either cut the Pi’s 3V3 pin from the GPIO connector, so that pin is left “blank”.
  • Or remove the connection to the Pico’s 3V3 pin so.  This itself could be done two ways: either remove the pin from the Pico, so it doesn’t connect into the Pico’s header; or whilst building, remove the conducting part of the pin header socket used.

The easiest for testing will be to remove (or leave off) the 3V3_OUT pin from the Pico.  This means that during testing with no Raspberry Pi, a Pico WITH the 3V3_OUT pin can still be used temporarily.

Regardless of the approach taken, it is then necessary to either solder a wire between 5V on the Pi’s GPIO and the Pico’s VSYS, or just power the Pico from USB.

WARNING: If powering the Pico independently, DO NOT allow the Pico or Pi to be powered without the other powered as well!  Doing so could damage either your Pico or your Pi (or both)!

Also, if powering using VSYS do not plug the Pico in via its micro USB port!  You’ll need to remove the power source to VSYS prior to using USB – basically remove the connected Raspberry Pi if you want to program your Pico in situ.

The affected pins are shown below – remove one of the pins circled in RED (just one of them); link up the pins circled in GREEN.  Ideally the green link would be made on the PCB, to make removing the Pico easier for testing.

IMG_6829 - PWR Fix

In an ideal world (i.e. with a redesign of the board), the Raspberry Pi’s IO (SSD1306, MIDI, PCM5102) would hang off the Pi’s power and GPIO; and the Pico’s IO (595, HC125, MAX7219, MCP3008) would hang off the Pico’s power and IO pins.

Instead, as the link from 3V3 on one of the boards to the entire PCB has to be broken, all 3V3 components will be powered by the remaining connected board (Pi or Pico).

Removing the pin from the Pico in the final build, but having a “normal” Pico on hand for testing would be my recommended approach.

In the final build the Pico can be powered from the 5V line into VSYS or just independently via its USB port.  I’ll repeat my WARNING here though: if powered independently, DO NOT power one board without powering the other or you risk damaging one of your boards; and do not attempt to power the Pico via USB and VSYS at the same time.

One option for the 5V to VSYS link is to use the 5V pin on the SSD1306 header as shown below.  Ideally this link would be made via a jumper on the underside of the board, so that it can be disabled if the Pico is USB connected (for testing).

IMG_6876

Testing

I recommend performing the general tests described here: PCBs.

Raspberry Pi MiniDexed Interface

Once the basic pcb checks are complete it is possible to test the MiniDexed functionality in isolation if the following connections can be made:

  • Use jumper wires to hook up an OLED display and rotary encoder.
  • Remove the Pico and connect a jumper wire between pins 2 and 6 (this links what would have been GP1 – RX0 – to what would have been GP4 – TX1).  This passes the MIDI IN straight into the Pi’s GPIO.
  • Leave the TG IO boards unconnected and plug into a Raspberry Pi 3 or 4 running MiniDexed.

This is the MiniDexed configuration required for the Interface Board.  This enables the following:

  • I2S audio via the PCM5102.
  • SSD1306 128×64 display (assuming the default I2C address = 0x3C).
  • Switched rotary encoder.

Update: if the described “power fix” has already been performed by removing the Pi’s 3V3 GPIO connection to the board,, then it will be necessary to add a link to power the 3V3 section of the board.  If your chosen fix was to remove the Pico’s 3V3, then this will still work ok.

SoundDevice=i2s

SSD1306LCDI2CAddress=0x3C
SSD1306LCDWidth=128
SSD1306LCDHeight=64
LCDColumns=20
LCDRows=4

ButtonPinPrev=0
ButtonActionPrev=
ButtonPinNext=0
ButtonActionNext=
ButtonPinBack=11
ButtonActionBack=longpress
ButtonPinSelect=11
ButtonActionSelect=click
ButtonPinHome=11
ButtonActionHome=doubleclick
ButtonPinShortcut=11

EncoderEnabled=1
EncoderPinClock=10
EncoderPinData=9

Note: I’m not using the “home” or “back” button connections at present, but if they are wanted they are on GP23 and GP24 and could be added to the configuration with a “click” action instead of the longpress/doubleclick actions listed for use with GP11 as shown below.

ButtonPinBack=24
ButtonActionBack=click
ButtonPinSelect=11
ButtonActionSelect=click
ButtonPinHome=23
ButtonActionHome=click

An audio connection to the PCM5102 and MIDI IN should allow the display, encoder menu, MIDI IN and audio to be tested.

IMG_6831

Raspberry Pi Pico IO

Minimal Pico functionality can also be tested by removing the interface board from the Raspberry Pi and plugging in a Pico, powering it via a USB link to a PC.

Update: if the described “power fix” has been performed by removing the Pico’s 3V3 connection to the board,, then it will be necessary to add a link to power the 3V3 section of the board.  If the plan is just to have a Pico with the 3V3_OUT pin removed, then for these tests, a “normal” Pico with the pin still present can be used.  The 5V link is not required at this stage just to test the interface board.

First install Micropython and then use Thonny to connect to the Pico and try the following:

from time import sleep
from mcp3008 import MCP3008
from machine import Pin

spi = machine.SPI(1, sck=Pin(14),mosi=Pin(15),miso=Pin(12), baudrate=100000)
cs = machine.Pin(13, machine.Pin.OUT)

chip = MCP3008(spi, cs)

while True:
    print(chip.read(0),"\t", chip.read(1), "\t", chip.read(2), "\t", chip.read(3), "\t", chip.read(4),"\t", chip.read(5), "\t", chip.read(6), "\t", chip.read(7))
    sleep(1)

With no pots connected, it should still correctly find the MCP3008 via SPI 1 and be printing out a row of zeros.  If any of the “ALG” pins on the TG1-4 and TG5-8 headers are connected to 3V3 (NOT 5V!) then the reading for that “pot” will change.

That is pretty much all that can be tested of the interface board at this time.

PCB Errata

There are the following issues with this PCB:

  • As mentioned above, the power link to the Pico is wrong.  It should be the Pi’s 5V to the Pico’s VSYS, but instead feeds the 3V3 into the Pico’s 3V3_OUT pin (the clue to the mistake is in the name!).
  • Do not power up the Pico or Pi with the other board connected by unpowered.  Either only have one board installed (e.g. during testing) or always power up both boards together.

Enhancements to the RPi Interface board:

  • With hindsight I might have made the USB socket of the Pico more accessible by rearranging the components that currently get in the way.
  • I’d consider providing pin headers for 5V, 3V3, and GND to make testing the boards a bit easier.
  • If the encoder breakout header had included a 3V3 link then it could have supported KY-040 style encoder modules too.
  • There is plenty of space on the board where a test SSD1306 header could have been included, to temporarily plug in a display if required.  Alternatively the existing header breakout could have been positioned such at there was room to plug in a display for testing.
  • There should be an option either to power the display from 3V3 or to include external pull-ups to 3V3 or build in some level shifting.
  • It might have made sense to include breakouts and connections for the power switch and LED.
  • I need to find a way to prevent “parasitic powering” via the serial connection if only one of the boards is powered up.
  • A future issue of the board, as well as fixing the Pico’s power issue mentioned above, could include a power supply circuit and power socket (e.g. via barrel jack) to power everything.
  • It might be useful to add a jumper on the underside of the board to allow the VSYS link to 5V to be removed to allow for the Pico to be USB connected and powered (e.g. during testing).  Either that or explore the method described in the Pico datasheet to add a schottky diode to the VSYS link to allow either method to be used.

Find it on GitHub here.

Closing Thoughts

Apart from the power issue, and there are a number of minor “quibbles” with the board, the design in principle seems to hold up well.  In the next guide I’ll walk through how to put together the IO board too.

These boards would now have been possible without the support (in terms of discount vouchers) from the Seeed Fusion PCB service, which I am very grateful for, and very happy to continue to recommend if you want to have PCBs made yourself.

Kevin

Leave a comment