XIAO Pi USB MIDI Device PCB – Part 2

Here are the build notes for my XIAO Pi USB MIDI Device PCB.

IMG_7136

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

These are the key tutorials for the main concepts used in this project:

If you are new to microcontrollers, see the Getting Started pages.

Bill of Materials

IMG_7124

  • XIAO Pi USB MIDI Device PCB (GitHub link below).
  • 3x H11L1 optoisolator.
  • 1x 1N914 or 1N4148 diode or similar.
  • Resistors: 1 each of 10Ω, 33Ω, 220Ω.
  • 2x 270Ω.
  • 3x 470Ω.
  • 3x 100nF ceramic capacitor.
  • Optional: 2x 7-way header sockets.  Ideally “short profile” with plastic height of 5mm, see photo below.
  • Optional: 1x 2×2 “spring loaded pogo-pin” header.  Ideally the “A height” (i.e. from the bottom of plastic base to the top of spring-loaded contact) is 10mm.  See photo below.
  • 1x 2-pin tactile switch, see photo below.
  • Optional: 2x 180 degree DIN sockets OR 2x TRS stereo PCB mount sockets (see photos for footprints).
  • 1x 3-way pin header (straight or right-angle).
  • Optional: 3x 6-way DIP socket.
  • 1x 40-way 20×2 extended GPIO RPi header socket.
  • 1x Seeed Studio XIAO SAMD21

IMG_7112

Note that if normal profile 7-way headers are used then longer pogo-pins will be required in order to connect with the XIAO. I would imagine that common-sized headers may require 13 or 14mm pogo pins, but some experimentation may be required.  This would almost certainly require more “height” in the GPIO header of any board stacked on top though.

Alternatively the pogo-pins and headers can be omitted and the XIAO soldered directly to the PCB.  This has the advantage of keeping everything “low-profile” for stacking.

IMG_7125

Build Steps

The PCB has the option of either DIN or TRS MIDI sockets, or neither.  If DIN sockets are not required then the board should be cut to remove that section of the PCB.

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

  • All resistors and diode.
  • DIP socket (if used).
  • TRS sockets (if used).
  • Ceramic capacitors.
  • Tactile switch.
  • 7-way headers (if used).
  • XIAO (if soldered directly onto the board – see details below).
  • Pogo-pin (if used) and normal pin headers.
  • GPIO header – on the underside of the board.
  • DIN sockets (if used) – on the underside of the board.

As mentioned in the design notes, the PCB has two resistors next to the Pi to XIAO MIDI interface circuitry labelled 250Ω and 10Ω.  As 250 is not a particularly common value for a resistor, it is recommended that a 270Ω resistor is used instead and the 10Ω is replaced with a simple wire link.

IMG_7126 - resistors

As a key aim for this board is to allow it to be stacked between the Pi and another board, keeping all the components “low profile” is quite important.  For this reason, in this one instance I’m not using DIP sockets or the 7-way headers for the XIAO but soldering the H11L1 and XIAO directly to the PCB.

If the reset switch and SWD headers are required for the XIAO, connections must be made from the PCB to the pads on the underside of the XIAO. I found that soldering small blobs of solder onto the XIAO’s pads prior to placing on the PCB appears to then allow me to solder “through” the holes on the PCB to connect to the pads.

When soldering through I held the XIAO in place with unsoldered pin headers, but then removed them before soldering the SMT IO connections on the XIAO. I also left the iron on the holes/pads a little longer than I normally would in the hope it was flowing down to the XIAO.

Unfortunately it turns out the SMT pads for the IO pins, from the KiCad footprint for the XIAO don’t stick out very far from the XIAO itself.  But with care it is possible to solder them to the castellated edges as shown above.  If that is proving problematic, then header pins could be used (and trimmed off) instead.

Here are some build photos.

IMG_7133

As mentioned in the design notes there is one problem with the PCB.  The external MIDI circuitry should be powered from the XIAO but the PCB connects it to the Raspberry Pi’s 3V3 pins.

This works fine in general terms, but it means that Pi won’t power on if the XIAO is already powered up.  If it is fine to always connect the XIAO to USB after powering on the Pi, then it can be left as is.

But to fix it requires two tracks to be cut (one on the top, one on the bottom) and two patch wires to be added (on the bottom), as shown below in orange and blue respectively.

XiaoPiUSBMIDIDevice-pcb - Patch

Here are photos of a patched board.

It is a bit of a pain to patch, but it makes the board much more useful and fulfills the aim of having the XIAO and Pi fully independently powered.

Testing

I recommend performing the general tests described here: PCBs.

The XIAO can be tested without plugging into a Pi.  In fact, that is recommended.  The code that provides the routing functionality can be found on GitHub here: https://github.com/diyelectromusic/sdemp/tree/main/src/SDEMP/XiaoPiUSBMIDIDevice

When running, MIDI activity over USB should be indicated by the led flashing.  MIDI activity over serial will only be shown at this stage if the patch to the PCB has been carried out.

If the reset button isn’t working, then the SMT soldering of the XIAO’s pads hasn’t worked.

Full testing will require a Raspberry Pi, but once connected, MIDI should be routed as follows:

  • USB MIDI -> Raspberry Pi
  • Serial MIDI -> Raspberry Pi
  • Raspberry Pi -> USB and Serial MIDI

With any MIDI activity indicated by the LED flashing.

PCB Errata

There are the following issues with this PCB:

  • As already mentioned the external MIDI circuit should be connected to the XIAO’s 3V3 supply not the Pi.
  • The 250Ω/10Ω resistors on the Pi to XIAO MIDI link should be a single 270Ω resistor.

Enhancements:

  • Make the SMT pads for the XIAO slightly larger to make soldering easier.

Find it on GitHub here.

Closing Thoughts

The power line mistake was due to me getting lost as I was attempting to separate out the two 3V3 zones on the board.  The resistor issue is a symptom of my inexperience with electronics and forgetting there are common resistor values to be used.

But apart from these, this board seems to do its job well.  I’m particularly pleased with the fact that I was able to solder through the PCB to reach the XIAO’s reset and SWD pads.

The installed MIDI routing application is pretty simplistic at present.  It doesn’t process MIDI real-time messages or SysEx for example, but that can be added in the future.  Of course more sophisticated MIDI routing and filtering would be possible too.

These boards have been manufactured 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

Leave a comment