Published 1.12.2014 (built mid-2014)
- Very small 4-channel preamplifier with digital signal processor and digital-to-analog converter
- 4 digital SPDIF stereo inputs and one analog input
- 4-channel unbalanced analog output
- DSP-solution consists of miniDSP-board and applicable software
- Extensive software features: IR-remote code learning, input-/output-wise volume offset and channel balance, input renaming
- Main components: SRC4392 SPDIF-receiver and sample rate converter, miniDSP-board, PCM4104 DAC, OPA1662 op-amps and PGA4311 volume control
This was designed after DD Preamp using the same idea to try slightly different approach and different components. miniD Preamp is a 4-channel audio preamplifier using miniDSP signal processing board which is cheaper than miniSHARC used in DD Preamp, lacking some of the advanced features. Functionality is still similar, meaning possibility for 2.1 or 2.2 system with main speakers and subwoofer(s) with proper crossover filters and digital room correction, although with slightly less computing power. miniDSP is also a DSP-solution from a company having the same name, but unlike miniSHARC it can be also used on its own using the analog connections and built-in converters. However, in this design it is integrated into part of the device and better quality DA-converter is used along with analog volume control.
Four digital stereo (no coded multi-channel formats) sources can be connected to miniD Preamp and also one analog one using the built-in connections of miniDSP (although I am still having some problems with this). Outputs are provided by unbalanced RCAs. The device then operates as a volume control, input selector and filter for room acoustic correction. Besides DSP (whose functionality is described at the end), actual functionality is provided by the embedded software based on the DD Preamp, including features such as:
- Simple user interface with one rotary encoder with push-button and small LCD
- Master volume and input selection as basic operation and menu for advanced features
- IR remote control possibility with learning function (support for NEC-codes).
- Volume offset for all physical inputs and second output pair
- Separate balance for both outputs
- Possibility to assign a name for source from pre-defined list (CD, DVD, etc..)
Filters in DSP are set up using a PC-software called plugin. There are different plugins available for DSP-boards and plugin defines the functionality of the complete solution (where hardware certainly sets computational limitations). I am using the DSP for digital room correction so acoustic measurements are done to calculate filters.
UMIK-1 USB-measurement microphone is used for acoustic measurements with Room EQ Wizard (REW) software. Based on the measurements, filters are computed in REW and imported into miniDSP plugin. The point is to measure response at the listening spot and set up filters to compensate (the worst) deviations from the desired response (which is not necessarily flat).
My part of the design concerns a motherboard for miniDSP. Technically the DSP-board is separate despite being in the same enclosure. It is a closed undocumented system so I cannot communicate with it, only handle the audio signals. So basically I had a “black box” with I2S serial digital audio inputs and outputs. My board provides inputs with input selector, sample rate converter, DA-converters followed by low-pass filters and buffers, volume control and software with user interface to control everything. Block-level implementation is shown below and electrical schematics are further below.
In DD Preamp SPDIF-signal was routed directly to miniSHARC since it has a proper input. However, miniDSP only accepts I2S serial audio signals. DSP works at a constant sample rate (here 48 kHz) while audio signals are normally 44.1-192 kHz. Therefore, sample rate converter is needed to always provide the 48 kHz input signal to the DSP. This makes the design even slightly more complicated than DD Preamp although the single IC used here serves as input selector, SPDIF-receiver and sample rate converter.
Schematics of the preamp board can be seen as pdf here. It is drawn with KiCad and has hierarchical sheets. First page is top level and blocks labeled “Sheet: name” are shown on following pages. Pin-like connections in blocks are hierarchical labels going between hierarchical levels or pages. Power labels are global throughout the document.
Power supply of miniD Preamp board is simple LM317/337-regulator circuit providing ±5 V for analog parts and 5 V with 7805 and 3.3 V with TPS70251 for digital parts; miniDSP is also powered from 5 V. In the same enclosure is a voltage regulator board (schematics here) providing dual supply from simple wall-wart type AC-adapter using half-wave dual rectifier circuit and LM317/337 pre-regulators. Plenty of ferrite beads and bypass capacitors are used throughout the board.
High-quality oscillator is used to provide master clock via buffer (CDCV304) for SRC and DAC but also for miniDSP since with this board external clock can be used unlike with miniSHARC.
On page 4 is input selector circuit with TI SRC4392 in the center. It is very versatile IC providing plenty of routing options and features from which I am only using few. Digital inputs are connected to four inputs of internal multiplexer of the SRC. Isolation transformers are used for electrical inputs. SRC uses master clock and internal phase-locked loop to lock into the incoming digital SPDIF-signal which is decoded into I2S audio. SRC has two I2S-ports and port A is used for connection to miniDSP input which also acts as a I2S-master. Internal sample-rate converter is used if input sample rate is not 48 kHz which is required by the miniDSP. After setup at startup everything in this IC works automatically.
There are extra routing options on page 2 where P7 is a miniDSP connector. First digital switch is used to make loop from analog input of the miniDSP – it chooses if signal is taken from that analog input or from the SRC. Second switch after the DSP selects if processed or unprocessed signal is used – a DSP-bypass switch. Both of these are controlled by software.
Analog section on page 3 consists of 4-channel TI PCM4104 DA-converter followed by 2nd order Butterworth multi-feedback low-pass filters. The filter circuit is based on the datasheet except I omitted big (electrolytic) DC-block capacitors. I thought the DC-level would be low enough but it is not! There are too high DC-levels which I need to get rid of, probably with some smaller capacitors further in the signal path. Usually it doesn’t matter since power amplifiers have DC-blocking capacitors anyway but you will easily forget that this problem exists! Anyway, PGA4311 stepped attenuator works as volume control after the filters, followed by output buffers.
Microcontroller here is ATmega324A (page 5) with connectors to programmer, LCD, rotary encoder and IR-receiver. I didn’t include crystal but it should be there for the IR since it makes time-sensitive operations easier.
Inside miniD Preamp. On the left behind front panel, LCD and rotary encoder is the voltage regulator board and then the main board with miniDSP. Inside is rather tight and messy.
Back panel holes are made with handtools so it looks a bit DIY. There are 2 toslink and 2 coaxial SPDIF digital inputs, stereo analog input in the miniDSP, 4-channel analog output, DC-power in and USB for miniDSP.
I won’t go into the details of layout here. PCB is 2-layer board ordered from Iteads where I have ordered my PCBs from. Obviously with mixed-signal design of this complexity, 4-layer board should have been used. But I am still quite happy with the layout and it seems to work well although any EMC-measurements haven’t been done.
miniD Preamp PCB.
Enclosure is a small Hammond model I have been using in many projects. Holes have been “machined” in my bathroom with hand tools so obviously quality is not professional. This was before I found Schaeffer AG.
Software is a modified version of DD Preamp software so the description is basically the same. Everything is controlled by an Atmel ATmega324A microcontroller so functionality comes from the embedded software. Simpler program would have been enough but I wanted to push a bit further and the features are listed in the beginning of the page. After startup and setting up the SRC, the purpose of the software is to respond to user actions and show information back to the user on display, otherwise it is just idling. Responding means switching input or sending commands via SPI to a stepped attenuator to change volume or to SRC to change input. Basic functions could be done by simple program but due to extra features it got more complicated and especially remote control sets some time constraints as well. But it was not due to demanding software requirements but my will to learn new that made me choose FreeRTOS as a basis for the software. FreeRTOS is, as the name implies, Free Real Time Operating System ported to numerous different microcontroller and processor families. It is not the simplest and smallest of them but is very versatile and can be scaled by selecting needed feature set. It took quite some time to learn how to use the provided functionality and especially how it should be used to ensure deterministic operation. I won’t go into details of RTOS here, their website provides some basic information and API reference of the FreeRTOS kernel.
As an opinion, and without further experience on RTOSes, I can say that everything needed for using FreeRTOS is on their website but it is not always easy to find. Also the kernel has evolved over the years and documents have been made for different versions. It has also developed into a much more complex OS you never need or can use in small microcontrollers. However, thanks to its great scalability you can just exclude parts and reduce the compiled size and use in almost every controller. It needs few kB of flash and the amount of tasks you can run depends on the RAM available. With inefficient 8-bit controllers only few tasks is sensible and also context switching shouldn’t occur too often or otherwise the FreeRTOS kernel suffocates the program. It may be worth buying one of the presumably better documentation sets.
I won’t go into the details of my software here and won’t provide the codes. This is mostly because it is such a huge mess when learning and developing at the same time. If I once find motivation to re-write it, I may release the codes.
Stacked boards, LCD and rotary encoder.
User interface: small 2×8 character LCD, rotary encoder with pusbutton and IR-receiver.
miniDSP is a multi-purpose audio digital signal processor board (using Analog Devices ADAU1701) which can be used in various filtering tasks in audio such as two-way active speaker crossover filtering and equalisation. I am using it for digital room correction which is equalisation based on the characteristics of the audio system including room acoustics. These DSP boards by miniDSP Ltd are for OEM applications and custom products, therefore most of the products they sell cannot be used on their own. miniDSP has analog RCA connections so it can be used as stand-alone device but here its stacked on the mother board and signal is in digital I2S-format which is a synchronous serial digital audio format with data and 3 clock signals. There are 2 input channels but 4 output channels so the input channels can be divided into various outputs with various filters.
Setting up a DSP is programming all needed filters along with level and delay if needed. Filters can be set in parametric format (PEQ) or biquad coefficients. miniDSP doesn’t have FIR-capability as miniSHARC. Setup is done in PC-software, or plugin as they call them, so computer is always needed when changing filter settings. For digital room correction, acoustic measurements are necessary. I am using Room EQ Wizard (REW) software and UMIK-1 USB measurement microphone for measurements, and from REW you can export filter parameters and import them into the plugin. It is an iterative process of measure, setup, measure, listen, etc. MiniDSP website has some application notes for DSP-basics, digital room correction, acoustic measurements and how to get quickly started with REW. I have mostly followed these to get started. I am not an expert in this field yet and have a lot to learn and experiment when all my hardware is finally finished.
Below are some screenshots of the plugin, a PC-software used to set up filters and program the DSP. Therefore, no knowledge of DSP-programming or capacity limits are needed here. I use 2 way advanced 21 plugin, here is the datasheet. There are many different plugins for this DSP and plugin is what determines technical capabilities of the DSP. Software and DSP-board are designed and manufactured by miniDSP and I am just one of their customers, curious to take their products as part of my own designs to create impressive functionality with reasonable efforts.
miniDSP 2 way advanced 21 plugin – parametric EQ. These biquad coefficients are from Room EQ Wizard.
miniDSP 2 way advanced 21 plugin – crossover. This could be a possible subwoofer band with low-pass and subsonic filters.
I have not given references list but used links directly to references. However, there is a list of some documents and books I think are worth reading on the main projects page. Feel free to comment and ask questions so I can clarify some things and further develop the description. At the moment it is still quite vague. It will not become detailed building instructions though.