MiniDexed TX816 – Part 2 – PCB Design

As I mentioned in my introduction, I soon gave up trying to prototype a Raspberry Pi Pico based TX816 styled user interface for my MiniDexed using solderless breadboard.  It was just too unweildy, unreliable, and generally impractical.  Consequently, I’ve took a bit of a risk and jumped straight into designing some circuit boards for my prototype.

This post looks at the design and functionality of the PCBs.

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!

PicoTX816-IOBoard-3d

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.

Proposed Hardware Architecture

Recall from part 1 that I’m proposing the following general hardware architecture.

IMG_6810

The key functionality I’m after being:

  • Drive the 16 LEDs by the use of two HC595 shift registers, using 3 GPIO from the Pico.
  • Handle the 8 switches using direct GPIO from the Pico.
  • Handle the 8 potentiometers using a MCP3008 over SPI bus 1.
  • Handle the 8 2-digit, 7-segment displays using two MAX7219s over SPI bus 0.
  • Serial MIDI via the hardware UART.

With the additional proviso that the MAX7219 requires a 5V SPI interface, so I plan to use a 74HCT125 as a level shifter for SPI 0 to make it a 5V interface.

In addition to the above, I also want to maintain some of the IO functionality of the MiniDexed too.  So whilst the above will all be handled by a Raspberry Pi Pico, I also need the Raspberry Pi itself to support the following:

  • OLED display connected over I2C.
  • GY-PCM5102 module connected to I2S.
  • Rotary encoder directly connected to GPIO.

It will also have to support MIDI IN/OUT via the hardware UART, which will have to connect to a second serial MIDI link on the Pico.

I also want all of this to fit into the 250x160mm footprint of one of my CD Rack Synthesizer Projects.

I considered a couple of different approaches:

  • Put everything in a single 250x160mm PCB to attach to the Pi via GPIO.
  • Mirror the TX816 itself and create a “host” PCB for the Pi and then up to 8 identical “tone generator” interfaces for the Pico-controlled elements.
  • Some hybrid.

As you might imagine, I went for a hybrid approach as whilst the idea of mirroring the modularity of the original TX816 with 8 independent units really appeals, the number of connections will be significant as all the IO will have to be handled by a Pico.  Although given the cost of a Pico, I could actually have a single Pico per tone generator… I might look at that again in the future.

For now, I’ve opted for three PCBs:

  • A Raspberry Pi “HAT” to support the MIDI links; the Pico, MCP3008 and 74HCT125; and the MiniDexed specific elements: PCM5102, OLED display, encoder.
  • Two IO boards each supporting the hardware user interface for four tone generators: 74HC595, MAX7219, 4x 7-segment displays, 4x push switches, 8x LEDs (two per TG), 4x potentiometers.

To fit into my CD Rack format I’ve opted for the following arrangement:

IMG_6813

The idea is to have two of the same PCB to support each row of four tone generators and some kind of Raspberry Pi “hat” to link to them both and the Pi.

IMG_6814

The physical arrangement I’m aiming for is sort of as shown below.

MiniDexed-TX816-PCB-Interconnects

The idea is that the “Hat” will sit on the Pi in the usual way, but with overlaps top and bottom.  These will contain header connections and mounting points to the two IO PCBs to be connected on top.  Then the IO PCBs will be fixed to a front panel using the potentiometers.

I could have aimed for a physical header connection to both IO boards, but that would mean producing two different boards – one with a header at the top, and one with the header at the bottom.  I felt this might get expensive.

Alternatively I could try to produce a board that included footprints for a connector both top and bottom.  That proved somewhat complicated.

In the end I went for a single direct header connection for one IO board and will just use a cable for the second allowing me to use a simpler, but the same, board for both IO modules.

Power Consumption

Now as regular readers of my blog are aware I don’t consider myself an electronics person, so this will be very “hand-wavy” and I strongly suggest it isn’t relied upon, but this is me having a go at thinking about the power usage of these boards, so you should perform your own calculation and formulate your own thoughts before you risk damaging any equipment (including a currently-hard-to-replace Raspberry Pi 3 or 4).

There are two sets of power usage in these circuits:

  • 5V for driving the MAX7219 (via the HC125 level shifter) and the 7-segment displays; and the PCM5102.
  • 3V3 for driving the MIDI input, MCP3008, the potentiometers, two 595 shift registers, switches and potentially the Pico itself.

The current  through the 7-segment displays has to be limited.  This is done by the “RSET” resistor in the MAX7219 circuit.  The datasheet states that the current per segment is typically ~100 times the current through RSET.  There is a table that suggests a resistor value of between ~50-70KΩ for a 10mA current limit depending on the forward voltage of the LEDs.  I must confess I don’t understand how these values are calculated, but I’m now wondering if my choice of 50KΩ is a little on the low side.  Of course this assumes full brightness too, whereas I’d tend to reduce the brightness using PWM in software anyway.

Regardless, the MAX7219 can apparently cope with up to 40mA per segment, although the total power still has to come from the 5V supply at some point.

The two-digit 7-segment LEDs I’m using seem to have a forward voltage of around 2V and a forward current of around 20mA (I don’t have an exact datasheet, but these values seem typical for RED 7-segment displays like mine).

As the MAX7219 will “scan” each digit in turn, the most that will be illuminated at any one time will be 8 segments (7 if the decimal point isn’t used).  That makes for a worst case current requirement of ~80mA for the LEDs for each IO board (so a theoretical 160mA max all told).

On the 3V3 side, there will be eight 10KΩ potentiometers in parallel, which I think will therefore just be around 2.5-3mA.  The switches just switch to ground so that doesn’t count.  The MIDI optoisolator and RX line pulled-up via the 470Ω resistor, so ~7mA there.

The big thing here (apart from the Pico) will be the shift register and 8 LEDs per IO board.  I believe (from the datasheet) that the maximum current it can pull via its VCC pin (I guess to power any illuminated LEDs) is 70mA, but that in principle each output could drive up to 35mA.  The worst case per 595 is driving all 8 LEDs, so to keep the current limit below the 70mA total, that means ~8.5mA per LED.

I’m using red LEDs, so working with a typical ~20mA forward current and 2V forward voltage, at 3V3, a resistor (per LED) of ~160Ω should limit the current to less than 8mA.  I’m using 1KΩ, so it should be a lot less than that (~2mA).  So the total for two 595s driving all 16 LEDs at once is probably less than 35mA.

So far, the hand-wavy totals so far (excluding the current usage of the chips themselves) will be something like the following:

  • 5V: <160mA (LEDs)
  • 3V3: <15mA (pots and MIDI) + <35mA (LEDs)

Ok, so this is where theory meets reality. I meant to do all of the above before designing the boards, but in all honestly, I had a pretty simple “that’s probably ok” approach and have only gone back to think about it in more detail having started to put the boards together!

The plan was to drive all this from either the Raspberry Pi’s GPIO or the Raspberry Pi Pico (which itself needs to be powered somehow).  Now discussions around current limits from the Pi’s GPIO get complicated, but the main considerations here are perhaps the limits on the 5V and 3V3 pins themselves, but details seem a little hard to “pin” down.  I’ve taken the following from pinout.xyz, which I’ve always found very reliable in other respects!

  • 5V Power: Up to 1500 mA.
  • 3V3 Power: Up to 500 mA (unless using an early Pi, then only 50mA).

Apparently the 5V pins are largely connected directly to the Pi’s input power source, but the 3V3 line comes via a regulator.  So “on paper” everything here should check out fine as far as I can see.

So what about the Pico?

My plan was to power the Pico from the Pi too.  And if I use the 5V line that looks entirely possible. Unfortunately due to an oversight when putting the design together, I’d linked the Pico’s 3V3 line to the Pi’s 3V3 pins rather than power it via VSYS.  This will be problematic for two reasons:

  • First, whilst it is probably still well within the current limits for the Pi’s 3V3 line, I haven’t done a similar calculation for what the Pico is doing to see how close things are and know the 3V3 is a lot more limited than the 5V line (according to the information I’ve read above).
  • But more crucially, the Pico’s 3V3 pin is meant to be a “power out” pin, not a way to power the device.  The Pico’s datasheet is pretty clear on the topic!

So this will have to be a patch on the final board as I put it together – I’ll need to remove the link to 3V3 on the Pico and power it another way.

I’ll try to fix this if I make a future version of the board.  Although I may actually add a simple power supply in a future version anyway…

Pico TX816 “HAT”

Here are the design details for the Raspberry Pi Pico TX816 “Hat” to go on a Raspberry Pi.

PicoTX816-RPiHat-Sch

Design notes:

  • As with all my modules it isn’t an actual “Hat” – i.e. the Raspberry Pi “Hardware Attached on Top” standard.  I’m just using that term (in inverted commas) for convenience!
  • I’m using a direct UART serial link between the Pi’s GPIO and the Pico’s UART 1 to support the two-way MIDI link between them.
  • The “real” MIDI interface is connected to the Pico’s UART 0.  Note that the connection is RX to TX; TX to RX.
  • The Pico’s SPI 0 interface links to the 74HCT125 to level shift it to 5V. Note that it only needs to transmit, not receive.
  • The MCP3008 is connected via a two-way link to SPI 1.
  • The GY-PCM5102 module is connected to the I2S pins.
  • I’ve included the option for two additional buttons (home/back) but opted not to use them in the final design.
  • The MiniDexed UI buttons and rotary encoder include debouncing capacitors.
  • There are two sets of pin headers to connect to the IO boards. As already mentioned, one of them is designed for a direct board to board connection and the other is positioned to require a connecting cable.
  • There are mounting holes for both the Raspberry Pi and the IO boards.

The two sets of header pins for connecting to the IO boards have an identical pinout, but it is connected to slightly different signals on the RPi board itself.  Here is the full pinout of the two links and what each will connect to from the RPi board.

MiniDexed-TX816-HeaderPinouts

Note that the pins associated with the 5V SPI 0 (for the MAX7219) and the 3V GPIO links for the 595s are “daisy chained”.

This means that the IO board can be exactly the same for the two sets of tone generators, but the appropriate routing “between” the boards to link from TG4 over to TG5 all happens on this RPi “Hat” board.

PicoTX816-RPiHat-Pcb

Pico TX816 IO Board

Here are the designs for the Pico TX816 IO Board.  Recall that this supports four tone generators, so two of these boards will be required.

PicoTX816-IOBoard-sch

Design notes:

  • As mentioned previously, these boards rely on the appropriate “daisy chaining” of the MAX7129 and 74HC595 to be happening on the Pi “Hat”.
  • The 2-digit, 7-segment displays are the type that don’t have common segment pins, so they need two sets of connections to the MAX7219, one for each digit.  Each MAX7129 can drive 8 digits.
  • The switches include a capacitor for some simple hardware debouncing.
  • There are mounting holes to connect to the Pi “Hat”, but the aim is that only two will be required.  For the top board (which will be directly connected via the pin header too) the bottom set of holes will be required.  For the bottom board, the top set will be required.
  • I’ve tried to be pretty precise about the positioning of all components, both for general final appearance, but also to make designing a front panel to sit above them as straightforward as possible.

PicoTX816-IOBoard-Pcb

Closing Thoughts

As I say, I’m taking a bit of a risk, but ultimately I decided this was the most reliable way to test everything and it would be a lot simpler than attempting to make everything on stripboard or protoboard.

Update: see the added notes about power usage that came out after some initial experimentation!

The RPi board is within the 100x100mm footprint to keep it in the cheapest tier of manufacturing, but the IO boards are 160mm wide so are a fair bit more expensive.

I am very grateful to Seeed Fusion for sending me some vouchers to enable me to get these boards made.

Kevin

Leave a comment