MiniDexed TX816 – Part 4b – PCB Build Guide – IO Board

This is the second build guide, this time for the IO board.  The build guide for the Raspberry Pi Interface Board can be found here.

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.

IO Board

Bill of Materials

IMG_6852

  • MiniDexed TX816 IO Board PCB
  • 74HC595
  • MAX7219
  • Resistors: 8x1K, 1x50K
  • Ceramic capacitors: 4x10nF, 2x100nF
  • Electrolytic capacitor: 1x 10uF
  • 8x LEDs (I used “lighthouse” or “tower” design – see photos)
  • 4x 12mm tactile switches with 12x12mm key caps
  • 4x two-digit, 7-segment displays with decimal point (20 pin variants – see photos)
  • 4x 10K pcb mount potentiometers (see discussion on potentiometers below!)
  • DIP sockets: 1×16-way, 1×24-way – Optional but highly recommended
  • Pin header socket: 1x 20-way

IMG_6842

Build Options

A key issue with building the IO board will be getting the components aligned at the correct height for the panel.  A surprising issue turned out to be potentiometers!  The standard pcb-mount pots I’ve always used stand out too much compared to the other components, so I shopped around for some alternatives.  But unfortunately I couldn’t find the perfect fit.  These are the three I ended up with in my collection.

IMG_6840

The first is my usual “go to”, but you may notice that there are additional “stand out feet” or “lugs” on the bottom of the pot which actually raise the base to a height of approximately 10mm above the PCB which is too tall for what I need (unless I raise all the other panel-aligned components some how).

The second looked perfect, with a height of only around 5-6mm, but I didn’t notice until they arrived in the post that they had no threaded bushing for mounting on the panel.  The last of the three looks perfect, but the mounting is slightly wider than I’d accounted for.

I went with the last of the three but I had to carefully widen the holes in my panel from 8mm to 9mm diameter “by hand”.

Once again, I’ve not made any mention of mounting spacers, nuts, bolts, etc here.  These will depend on your exact hardware build, but the PCBs are joined with 2.5mm (M2.5) spacers. The panel will be fixed using the nuts and screw bushings on the potentiometers.

Two of these PCBs will have to be assembled.  It is recommended that one (for TG1-4, at the top) uses a 20-way pin header socket to connect it directly to the Raspberry Pi Interface Board and the other (for TG5-8, at the bottom) uses a 20-way ribbon cable soldered between the boards.

Build Steps

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

  • All resistors.
  • DIP sockets (if used)
  • Ceramic capacitors.
  • Electrolytic capacitor (has to be folded down on the board).
  • Tactile switches.
  • 7-segment displays (see notes about getting the height correct).
  • Potentiometers.
  • LEDs (see notes about getting the height correct).
  • 20-way pin header socket (if used).

Here are some build photos and some important notes.

IMG_6843

When it comes to getting the height of the tactile switches, 7-segment displays, potentiometers and LEDs correct, it is best to use the panel as a guide as much as possible.

I followed these basic principles:

  • I’d already chosen potentiometers that I thought would give me the right height, so they were soldered directly to the pcb with no further adjustments.
  • Similarly I was working on the basis that the tactile switches with their switch caps on were largely ok too, so they too went on “as is”.
  • The 7-segment displays needed raising to be flush with the panel.  I used some temporary spacers whilst soldering to do this (two layers of old PCB seemed about the right height for me).
  • The LEDs needed raising to just protrude slightly into the holes in the panel.  This was left till last (see later).

Two layers of old PCB strips where used to correctly set the height of the 7-segment displays prior to soldering.  I soldered just two pins, in opposing corners, then removed the strips prior to soldering the rest, taking care not to scratch the PCB itself whilst sliding them out.

IMG_6846

Note that the electrolytic had to be soldered in place in a “laying down” position, taking care not to short it in the nearby resistor.  If I redo this board, I’ll allow more space for that.

IMG_6847

In order to set the height of the LEDs, I did the following:

  • Push all LEDs into the panel, but not soldering them yet, taking care to get the orientation correct (cathode – short pin – aligned to the flat side of the silkscreen symbol).
  • Assemble the PCB and panel, fixing the nuts to the potentiometers and screwing in place.
  • From the rear, one at a time, gently push the LEDs up into the holes in the panel to set the height and then solder in place.
  • Carefully remove the panel once again.

Finally the 20-way header socket, if used (i.e. for the TG1-4 board, not for the TG5-8 board), can be soldered in place on the underside of the PCB.

Once complete, a second board can be build, without the header socket installed.

Testing

I recommend performing the general tests described here: PCBs.

IMG_6851Once the basic tests have been performed, the IO board can be tested by attaching it to the Raspberry Pi Interface Board, but with only the Pico installed – DO NOT install the Raspberry Pi.  Only one IO board should be tested at a time and it should always be connected to the “TG1-4” set of header pins.

If the IO board hasn’t had the main headers soldered on yet, then it is possible to use the “fishing line trick” to wedge in a 20-way dupont style pin to socket cable and use that to connect the IO board to the Interface board.

Update: If the “Pico power fix” has been performed to the Pico, then it will be necessary to source 3V3 from somewhere.  If the fix was to remove the Pico’s 3V3_OUT pin, then replacing it with a “normal” Pico with the pin still present would be sufficient.  If the fix was applied to the Pi’s GPIO instead, then these tests can be performed as described with a “normal” Pico.

Powering the Board

Most of the functionality can be tested by powering the Pico over USB.

NOTE: The board will require a 5V supply somehow.  Again how this is achieved will depend on the “Pico power fix” chosen.

If the Pico has had VSYS connected to 5V, then this will be sufficient for testing, supplying 5V from VSYS whist powering the Pico via USB whist testing.

If the approach is to have the Pico powered via USB in the final build, then a connection will need to temporarily be made between the VBUS and the 5V line.  One connection point is the 5V for the SSD1306 OLED on the Interface board so one option is to temporarily link VBUS (not VSYS) from the Pico to this pin for testing purposes:

IMG_6862

This will allow the following to be tested:

  • Reading of the four potentiometers using the MCP3008.
  • Driving the 7-segment displays using the MAX7219 over SPI via the HCT125 level shifter.
  • Driving the LEDs using the HC595 shift register.
  • Reading the four switches directly from the Pico’s GPIO pins, configured for PULL_UP operation.

Final testing of the complete set up will come later.

The following libraries were used:

Note that one change is required to the MAX7219 library. In the file mac7219.py, in the __init__ constructor, the following line has to be updated:

# Change the following line:
self._spi = SPI(spi_bus, baudrate=baudrate, polarity=0, phase=0)

# to this one:
self._spi = SPI(0, baudrate=baudrate, polarity=0, phase=0, sck=Pin(18), mosi=Pin(19), miso=Pin(16))

This configures the library to use SPI bus 0, but on pins GP16, GP18 and GP19 as required by these PCBs.

Note that no library was used for the 595 shift register, as the mechanism for sending data is relatively straight forward.  This code will send an 8-bit value to the shift register using a test pattern.

HC595_SHCP = 21
HC595_STCP = 20
HC595_DS = 22
PINdata = machine.Pin(HC595_DS, machine.Pin.OUT)
PINlatch = machine.Pin(HC595_STCP, machine.Pin.OUT)
PINclock = machine.Pin(HC595_SHCP, machine.Pin.OUT)

def update595 (value):
  PINclock.value(0)
  PINlatch.value(0)
  PINclock.value(1)
  for i in range(7, -1, -1):
    PINclock.value(0)
    PINdata.value((value>>i) & 1)
    PINclock.value(1)
  PINclock.value(0)
  PINlatch.value(1)
  PINclock.value(1)

for i in range (8):
  update595((1<<i))
  sleep(0.1)
for i in range (6,-1,-1):
  update595((1<<i))
  sleep(0.1)
update595(0)

The rest of the code has the following functionality:

  • Read the potentiometers and display the output as a value from 1 to 64 on the corresponding 7-segment display.
  • Illuminate one LED per “TG” and when the button is pressed, switch to the other LED.

Find the test code on GitHub here.

IMG_6864

PCB Errata

There are the following issues with this PCB:

  • The potentiometers are the wrong way round (sigh – I keep doing this, even though I always mentally check them!).  They read zero when fully clockwise and full when fully anticlockwise.  This can be corrected in code (see the test programme).
  • Turns out I’ve also managed to largely get the LEDs somewhat back to front too – in that the shift registers outputs 6,7 are linked to TG1, etc.
  • The positioning of the electrolytic capacitor isn’t great.  If I reworked the board, I’d make this better.

Find it on GitHub here.

Closing Thoughts

I’m mildly annoyed about the pots, but that is relatively easily solved in code.  The LEDS, well, routing the board was easier this way round anyway.

So, so far, so good. The next step is to start the mechanical assembly and add the final panel mounted components.

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