I2S-Hat: A Raspberry Pi Hat for SPDIF <-> I2S Communication and DSP

For the past few months, I have been working on a project to utilize a Raspberry Pi with CamillaDSP in a standalone, fully-digital DSP system. To this end, I have created an add-on board, also known as a "hat", for the Raspberry Pi that allows fully bidirectional SPDIF <-> I2S communication with the Pi. As an advantage to other designs on the market, it also performs sample rate detection, providing the information to the Pi GPIO, and allows full software control of the SPDIF transceiver IC. No resampling of the incoming/outgoing digital audio is required, and it supports all stereo formats from 44.1kHz to 192kHz as tested.

The DSP capability of a modern Raspberry Pi 4 greatly exceeds that of the ADSP/SHARC implementations available. This should open up significant possibilities for much more complex and accurate DSP.

Please read more about the project on the GitHub page:

GitHub - raptorlightning/I2S-Hat: An SPDIF Hat for the Raspberry Pi 2-X for SPDIF Communication

KiCad files, Gerbers, and code are all available for anyone to use for their own build. This post is targeted for an open discussion about the board and implementation. Please let me know if you have any questions or comments about the information on the Git page, or if there is anything I can clarify further.

Enclosed.jpg
 
Last edited:
Henrik, It might be possible using a single stereo input, as long as the SBC has proper support for I2S slaving, and configurable I2S I/O - TDM with external demux may be a possible route? There's not a lot of information on actually implementing this and there's no standards for it. Ian hasn't even attempted this one ;)

If you can find a solution for multichannel I2S output, whether that be TDM or otherwise, it's simply a matter of adding more WM8804's configured to the secondary I2C address and programming them for slave operation off of the main one with their AIF data coming from the other channel pins or demuxed TDM data.

For this project, I wanted to keep some goals in mind:

  • SPDIF I/O for easy use in most stereo and/or headphone listening setups.
  • Keep the form-factor to something which could easily be made a finished project (fits in a commonly available box). The board is pretty full at this point - another 8804 and some circuitry could possibly fit, but the I/O would need to be stacked or have options sacrificed.
  • Keep the BOM cost relatively low for people who want to make their own. A Pi4B+uSD+Case+PSU can be had for less than $100 - even lower if you check the used market. The boards cost ~$25 per 5 shipped from JLC, and the hat components are less than $100 shipped from Mouser/DigiKey+Ali for the optical modules (if desired).
Given the relatively low BOM price/unit, it wouldn't be absurd to build two (or more) and run them in parallel with identical inputs but different filters and output connections. Overall though, a higher performance, lower cost, open-hardware/software platform along the same lines as the miniDSP OpenDRC-DI was the idea and it's completed to the point of software imagination for future developments.

Of course, there's nothing stopping the use of a USB solution. The miniDSP USBStreamer (code left commented out in the Python file if someone wants to continue down that path) works on a RasPi, and I was using it for original testing of the "PiDSP" concept. It may be possible to use that as a multichannel output device, but all testing was done with the 2ch Stereo firmware.
 
The SBC I looked at (some time ago, don't remember the model unfortunately) had a pretty normal I2S interface with one set of clock lines, but with four data-out-lines instead of one. Should be rather easy to add three more slaved WM8804's then. Would be fun, but in reality I would never manage to find the time to work on something like that. Instead I was hoping that maybe someone else would get inspired :)
 

raptorlightning, thank you for this project.​


Do you know whether this I2S hat will work with a Raspberry Pi 5?

Also, KiCad 8.0 provides a prompt to convert the zone fill to a new strategy in the pcb file and to use new symbol libraries in the sch file. I briefly looked at the files after the automatic changes were made and they looked fine to me. But, if you are aware of any specific issues, please let me know.

Thank you!