• WANTED: Happy members who like to discuss audio and other topics related to our interest. Desire to learn and share knowledge of science required. There are many reviews of audio hardware and expert members to help answer your questions. Click here to have your audio equipment measured for free!

Development of DIY Pi5 multi-channel soundcard

gordoste

Member
Joined
Nov 19, 2023
Messages
41
Likes
41
Hi all, I am working to develop a soundcard for the Pi5 that utilises the new multi-channel I2S capability. The design parameters are:
  • Decent performance for reasonable price (<-90dB THD+N for ~$100 parts)
  • 8 channels out, 6+ channels in
  • At least 96kHz sampling rate
  • Full isolation from the Pi - so it will not use the Pi's power supply either.
  • Single-ended inputs/outputs
This is not supposed to be an audiophile device - it is just supposed to work (especially the first version). My particular use case is to allow a Pi to act as the brains of my DIY DSP-capable AVR, without needing to send the sound out over HDMI (this has some issues and takes up much more space).

I selected TI's PCM3168 because the datasheet is more detailed than the one for the other main candidate, the AD1934, and it looked like the Linux driver support was much more complete. However, it has differential inputs and outputs which makes the surrounding circuitry more complicated. I am attaching the prototype design which I am pretty close to sending for fabrication. I would appreciate comments and suggestions from anyone who is interested. A few notes about the design:
  • Yes, those are electrolytic AC coupling caps. I know film caps are better, but for the prototype these will have to do. If anyone can suggest a good, not-too-expensive film cap, I'm all ears.
  • Power input is +/-6V. There is a separate board (still under design) to supply this using two SMPS.
  • I selected the OPA1679 as the op-amp, as the one in the datasheet (OPA4134) is too expensive. It has lower noise but higher distortion (although still very low). The slew rate is less than half of the 4134 and it is unity-gain stable. Importantly, it's about a quarter of the price! It seems like it should be OK, but TBH I have little knowledge in this area.
  • Descriptions of the various schematics:
    • rpi_soundcard.pdf - The top-level schematic with the PCM3168
    • rpi_soundcard-Input.pdf - Input side, with 6 input filters into buffers into SE-to-Diff converters
    • rpi_soundcard-Input-inFilt1.pdf - Input filter. RF filter, HPF, under/over-voltage protection
    • rpi_soundcard-Input-LPF12.pdf - SE-to-Diff converter and LPF (straight from datasheet)
    • rpi_soundcard-Output.pdf - Output side with 8 channels of diff-to-SE conversion and AC coupling
    • rpi_soundcard-Output-out1234.pdf - 4 channels of diff-to-SE conversion
    • rpi_soundcard-Output-out1234-of1.pdf - Single channel diff-to-SE converter
    • rpi_soundcard-Output-outCap4.pdf - Output AC coupling
    • rpi_soundcard-Pi_and_Isolation.pdf - Pi GPIO connector and isolation
    • rpi_soundcard-power.pdf - Generates +5VA, VDD for PCM3168 and VCC+/VCC- for op-amps
Well, that's all I can think of for now! I'm sure it can be improved... have at it!
 

Attachments

  • rpi_soundcard.pdf
    341.3 KB · Views: 144
  • rpi_soundcard-power.pdf
    155.5 KB · Views: 96
  • rpi_soundcard-Pi_and_Isolation.pdf
    255.3 KB · Views: 77
  • rpi_soundcard-Output-outCap4.pdf
    19.3 KB · Views: 85
  • rpi_soundcard-Output-out1234-of1.pdf
    51.3 KB · Views: 59
  • rpi_soundcard-Output-out1234.pdf
    97.2 KB · Views: 65
  • rpi_soundcard-Output.pdf
    116.8 KB · Views: 71
  • rpi_soundcard-Input-LPF12.pdf
    117.8 KB · Views: 95
  • rpi_soundcard-Input-inFilt1.pdf
    32.8 KB · Views: 67
  • rpi_soundcard-Input.pdf
    162.9 KB · Views: 86
  • rpi_soundcard_pcb.zip
    216.9 KB · Views: 77
OK, well over the last month I have made substantial improvements to the design, including:
  • Corrected a major schematic error where +/- inputs of some op-amps were swapped.
  • Complete redo of layout, with much better routing and less wasted space.
  • Change of grounding scheme away from split grounds for the codec. After a lot of reading, it seems to me that the split ground approach has fallen out of favour. The codec side of the isolators have a separate ground with star point at the power supply, but the codec and input/output circuitry have one big ground plane. (The Pi side of the isolators is obviously totally separate). Input and output ground are joined, but there is no path from those to the internal ground (these will be connected via power ground externally).
  • Added more decoupling caps for op-amps and codec chip.
  • Moved the caps between +/- of the differential inputs close to those inputs.
I am happy with my op-amp choice as I found another thread on here (I think the RTZ DAC) where someone had good results with OPA1679 as a drop in for NE5532, which is the other candidate in the datasheet.

I've now ordered the prototype boards, as well as the power board which generates +/-6V@1A using two LMR54410 switchers (one in inverted configuration).
 
Well, the prototype is built. I have tested the power section and it generates all 4 rails (3.3V for digital, 5V for analog, 5.5V for +ve op-amp rail and -3.3V for -ve op-amp rail). I used a stencil for the first time to do the front and it is awesome. I did the back manually and ended up with some kind of problem that meant the 5.5V rail was sitting at -0.7V. After running the hot air gun over it to reflow the solder, the problem went away. Now I need to wait for my Pi5 to show up...
(Also I ran out of 3-pin sockets :))

proto_main.jpeg



Here is the power board which generates +/-6V from 12V.

proto_power.jpeg
 
This a fantastic idea. I have been using the Pisound (Pi4/5) for 2CH audio for a while now but did not know multi existed on the Pi5 until now. Cap wise we have been lucky finding decent film caps surplus. In a pinch I bet you could get away with using greenies or ceramics.



Kat
 
Last edited:
My prototype has bipolar electros as film caps would massively increase the BOM cost (there are 14 of them).
 
Is there any progress? Did your RPi5 arrive? Have you managed to do any tests?
 
Yes my RPi5 arrived but in initial tests the PCM3168 is not detected via I2C. Unfortunately I haven't had time to try and figure out why.
 
These may be obvious but have you checked:

- Correct supply volts and ground to relevant pins on PCM3168?
- SLC goes to SLC & SDA goose to SDA?
- There are pull-ups on both SLC & SDA?
- Any enable pins on PCM3168 are correctly biased?
 
There is an isolator (ISO1641) passing the I2C signals. I already realised that I omitted pullups on the PCM3168 side of the isolator (I forgot SDA is bidirectional), which I've now soldered on but it didn't help. I need to use a logic analyzer to check that the signal passes across the isolator. I will check all the stuff you mentioned as well.
 
@gordoste unrelated question: I see your hat is larger than the usual hat size. What sort of header socket do you plan to use to leave space enough to the pi connectors? Can you link it if you already have one in mind? Thanks! And good luck with the i2c connection!
 
Last edited:
Yes there was no way all of this was going to fit on a regular Hat. I am just using a 40-pin IDC cable at the moment - using jumpers is pretty common for I2S boards and I want to see if it works OK with a bit of wire between the Pi and my board.
I did check if the hat will sit on top of the Pi but it runs into the USB connectors (as I think you are highlighting).
You can use something like this to leave enough space if you want to. I use this on HAT prototypes since I can easily connect my logic analyzer to the pins.
 
  • Like
Reactions: MCH
Following with interest! In my particular use case, I'm looking for a 6 channel I2S RPi 5 ADC for a hex guitar processing project. There's the Octo board, but it doesn't look to be well supported.
 
Last edited:
I dropped this for a few months but just came back to it after a computer upgrade. Also, PulseView's support for my logic analyzer (cheap FX2-based Saleae clone) on Windows was broken before, but it seems to mysteriously be fixed now.
Anyway, I found that the I2C signals from the Pi seem to be getting messed up. On the Pi side of the isolator, they look fine. On the other side, I get a 50Hz waveform. Obviously, it's probably something to do with power supply noise, so that's the next thing to investigate.
However, writing this, I just realised that I had the logic analyzer GND plugged to the Pi GND while logging signals on the other side of the isolator, so now I need to go and recheck.
 
Back
Top Bottom