Djuke - DIY Audio

build your own audio equipment

  • Increase font size
  • Default font size
  • Decrease font size
Dutch customers can pay using iDEAL

PreAmplifier v2.0

Print PDF

Preamplifier display

Products related to this project are for sale on this page.
More information for this project can be found on the support page.


Several years ago, I designed and built a multichannel pre-amplifier based on BurrBrown's PGA2311 volume control chip. It is still playing nicely in my living room, but since then technology has improved (e.g. OLED displays have become common and better ICs are available). Also it lacks some features (like multiple 5.1 inputs, automatic switch off, audio/video playback, smartphone control, etc), so I decided to do a redesign.


This is a modular preamplifier, so the features depend a lot on the different pcb's that are used. The heart of the preamp is the PreampController pcb, which connects the other pcb's, display, buttons, encoder, infrared, etc. Other sensible configurations are:

  • Standalone stereo or 5.1 input selection (switch inputs using buttons and infrared, no volume control)
  • Standalone DAC in software mode (volume is controlled by the DAC)
  • Standalone VolumeControl (without input selection, so single input)
  • Combinations of the above (e.g. 5.1 input selection + volume control)
    • Stereo input selection + volume control
    • Stereo + 5.1 input selection + volume control
    • Stereo input selection + DAC + volume control
    • Stereo +5.1 input selection + DAC + volume control
    • DAC + volume control

An overview of features is given per pcb:

  • PreampController
    • Convenient user interface
      • Infrared remote control
      • Control buttons (power/standby, menu, left, right, select)
      • Power/standby LEDs
      • Display (LCD, OLED, VFD supported)
      • Rotary encoder for changing volume
    • Power saving features
      • Switch power supply of other equipment (e.g. power amplifiers)
      • Signal detection to allow automatic switch off after 15 minutes without signal
    • UART connector for firmware update and software interaction
      • Connect a Raspberry Pi or USB-Serial converter
  • StereoInputSelection with 6x analog stereo inputs
  • 5.1InputSelectionwith 2x analog 5.1-channel inputs
  • DAC with 2x optical and 2x coaxial S/PDIF inputs
  • VolumeControl (5.1-channel and chainable 8-channel version)
    • Based on CirrusLogic CS3318 volume control chip offering
      • Large volume range (-96dB to +22dB in 0.25dB steps)
      • Low distortion (-112dB THD+N)
      • High dynamic range (127dB)
      • Low channel-to-channel crosstalk (120dB)
      • Zero-crossing detection for noise-free level transition
    • Inputs buffered using OPA2134
    • 5.1 channel version
      • 1x 5.1 channel volume controlled output
      • Integrated Headphone Amplifier
      • Hafler circuit for generating virtual surround output from stereo sources
      • Loopback connector for future extensions (tone control)
    • 8-channel version
  • OutputBuffers
    • 2x monitor outputs (stereo)
    • 3x channel outputs (stereo)
    • connectors for balanced outputs


The architecture and the signal flow of a full 5.1-channel preamp are shown in the figure below.
PreAmplifier Architecture


The preamp needs a digital single 5V supply and analog dual 9V supply. The functionality of the different pcb's will be described in detail next.

StereoInputSelection pcb

Stereo Input Selection pcbStereo Input Selection connectors

On this pcb, a maximum of 6 cinch inputs can be mounted, using these cinch connectors the pcb can be mounted directly to the back panel of the preamp. The MCP23S08 8-bit SPI I/O extender IC is used to select the desired input using SPI. It switches miniature relays to choose between the inputs. Optionally, 1 input comes from the DAC pcb. Optionally, a 5.1 Input Selection pcb can be stacked on top of this pcb using spacers.

PreampController pcb

Preamp Controller mounted

The heart of the PreampController is the PIC18F4620 microprocessor. This control board has many connectors:

  • 8-bit parallel display, supported displays:
    • LCD with contrast input potmeter, backlight supported
    • OLED/VFD with or without enable input
    • Display needs to be HD44780-compatible (most parallel displays are)
    • Preferred is 2x20 character display, 2x16 is supported (main screen shows ok, some menus do not fit)
  • Power connector for the power/standby button and power/standby LEDs
  • Input selection pcb
  • Volume control pcb
  • Control buttons (normally-open buttons that can pull the input to GND should be ok)
  • Rotary encoder (A/B pulse)
  • Infrared receiver (i.e. TSOP1138)
  • UART to communicate with Raspberry PI board or connect an USB-serial converter.

An onboard relay can be used to switch the power of external equipment when the preamp is switched on.

CS3318VolumeControl pcb

CS3318 Volume Control mounted (5.1 ch version)

The Cirrus Logic CS3318 chip is a 8-channel volume control IC, which will be controlled using SPI. The CS3318 needs dual 8 or 9V analog supply, which gives some extra headroom compared to my previous dual 5V preamp. The digital supply and logic is 3.3V, so a voltage regulator and SPI level converters are used to interface the CS3318 with the 5V used in the PreampController pcb.

Currently, 2 versions of this PCB are designed:

  • 5.1 channel version with integrated headphones amplifier
  • 8 channel version, which can be chained to control additional channels

5.1 channel version

The 5.1 version of this pcb contains an integrated headphone amplifier. For it, 2 channels of the CS3318 are used, the other 6 channels are used to control the 5.1 outputs. The inputs are buffered using OPA2134 opamps. An onboard Hafler circuit is used to create virtual surround for the surround/center/bass channels from the stereo channels. The difference of the stereo channels is used for the surround channels, the sum of the front channels for the center/bass channels. Using a digital output from the PreampController a relay is switched to select whether to use the Hafler virtual surround or the surround/center/bass inputs directly.

8 channel version

The 8 channel version of this pcb contains OPA2134 opamps to buffer the inputs. Additional pcb's can be chained to control additional channels (16-channels currently supported by the software)

Digital Supply pcb

Provides regulated 5V supply for the digital electronics. An example of a combined supply pcb for both digital and analog supply is the TripleRegulated_EI38_supply. A suitable separate supply is the DualRegulated_15/25VA_supply.

Analog Supply pcb

Provides regulated 9V supply for the analog electronics on the CS3318VolumeControl pcb, optionally also for the DAC pcb. An example of a combined supply pcb for both digital and analog supply is the TripleRegulated_EI38_supply. A suitable separate supply is the DualRegulated_15/25VA_supply.

5.1InputSelection pcb

PCB side of the 5.1InputSelectionConnector side of the 5.1InputSelection

A separate pcb with 2x 5.1 inputs can be stacked on top of the StereoInputSelection pcb. Using 2 outputs of the MCP23S08 8-bit I/O extender on the StereoInputSelection these inputs can be selected.

CS4398DAC pcb

This DAC is based on CS8416 receiver chip and CS4398 DAC chip and is described in detail on its own project page. It will interface to the PreampController pcb using SPI.

OutputBuffers pcb

PCB side of the OutputBuffersConnector side of the OutputBuffers

The outputs of the CS3318VolumeController pcb can be buffered with this pcb if needed. Also it has connectors for balanced outputs. Cinch connectors can be directly mounted on this pcb, with these it can be mounted easily to the rear panel of the preamp. Analog power for the output buffers is received from the CS3318VolumeControl pcb.


Because I am familiar with C/C++ programming, I decided to use the SDCC (small device c-compiler). It is a free and unrestricted C-compiler for PIC (and other) micro controllers and I already used it in a couple of other projects.

To make future software updates much easier, I added a bootloader, which allows software updates without a dedicated programmer using the UART connector. I tested the software update process in combination with a Raspberry Pi, but it should be possible also with a USB to Serial adapter. The software update needs:

  • Unmodified Tiny PIC Bootloader firmware made by Claudiu Chiculita running on the PreampController
  • Modified version of Unix Tiny PIC Bootloader Loader software to flash a new hex file in the microcontroller from the Raspberry Pi using the command line.

Note that the Unix Tiny PIC Bootloader Loader software was chosen because it runs from the Raspberry Pi command line and does not need a Graphical User Interface and therefore the software can be updated by logging in remotely. Unfortunately it did not work correctly out-of-the-box and quite some time was needed to modify the program for it to become useful. But finally I managed to get it running properly and it seems to work very reliable and it is fast (software update takes about 30s using baudrate of 115K2). Since an unmodified version of the Tiny Bootloader firmware was used it is also possible to use the Windows flash program that comes with the Tiny Bootloader in combination with a USB-to-serial adapter.

More information about the UART terminal and how to connect a Raspberry Pi can be found on the PreampV2 software page.

Currently the following software functionality is working:

  • Buttons
  • Display
  • Encoder
  • Infrared control (RC5/RC5x)
  • Input selection
  • Volume control (5.1, 1x8 channel and 2x8 channel version of the pcb supported)
  • DAC (select inputs, read bitrate/frequency, control volume)
  • Menus (input/channel offsets, input names, settings, information, infrared)
  • Support different HW setups
    • Standalone stereo or 5.1 input selection (switch inputs using buttons and infrared, no volume control)
    • Standalone DAC in software mode (volume is controlled by the DAC)
    • Standalone VolumeControl (without input selection, so single input)
    • Combinations of the above (e.g. 5.1 input selection + volume control)
  • Load/Store settings from/to EEPROM
  • Detect headphone connection (and mute other channels)
  • Detect and visualise signal level
  • Generic use of parameters (name, type, value, etc)
  • Auto switch off after 30minutes without signal
  • Serial terminal communication (e.g. from Raspberry PI)
  • Verify HW setup
  • Event Handler mechanism (i.e. button press, or infrared control, or terminal function trigger same event, which is handled by same event handler)


  • Additional IR protocols (RC6, more?)


Then the next question are: is it any good, how good is it, can you get me some proof? So, time to put it on the measurement bench. For the measurements I use RMAA with my EMU1212M sound card, which allows to measure extremely low distortion and noise levels. The preamp allows the signals in the chain to be taken out at various stages, so the particular contribution of the Input Selection relays or Output Buffer pcb can be seen as well. I measured the chain at 4 points:

  • Right after the DAC pcb to get the best reference measurement
  • Monitor Ouputs on the Output Buffer pcb, so including input selection and output buffers
  • Front Outputs on the Output Buffer pcb, so including input selection, volume control and output buffers (volume set at 0.0dB)
  • Headphones Outputs on the volume control pcb (volume set at -10.0dB)

Measurements where done in the chain: sound card optical out -> Preamp -> sound card analog in. All measurements done at 24-bit, 96 kHz. Front measurements done with volume set at 0dB.


Test DjukePreampV2-DAC DjukePreampV2-Monitor DjukePreampV2-Front DjukePreampV2-Headphones
Frequency response (from 40 Hz to 15 kHz), dB: +0.01, -0.12 +0.01, -0.12 +0.01, -0.16 -0.02, -0.18
Noise level, dB (A): -103.2 -99.3 -99.3 -99.0
Dynamic range, dB (A): 103.2 99.2 99.2 98.9
THD, %: 0.0003 0.0005 0.0008 0.0009
IMD + Noise, %: 0.0020 0.0032 0.0035 0.0036
Stereo crosstalk, dB: -102.0 -98.3 -98.0 -99.3

Complete measurement report can be found here.

Frequency response


Frequency response of the preamp

Total harmonic distortion


Total harmonic distortion

Measurement conclusions

  • DAC reference measurements show very low THD and noise levels,  limited by the Analog Inputs of the sound card
  • Input Selection relays and Output Buffers only degrade the signal marginally
  • Volume Control gives a slight increase in THD (0.0003% -> 0.0008%), but values are still very low

User gallery


My fully equipped prototype with CS4398DAC, StereoInputSelection, 5.1InputSelection, CS3318VolumeControl, PreampController and a Raspberry Pi2 with HifiBerry Digi+ and Volumio mediaplayer.

Peter Bellamy

Fully featured 5.1 channel amplifier built inside a custom enclosure. Also includes a third party phono preamplifier.

Peter P.

Full 5.1 preamplifier with CS4398 DAC and Raspberry Pi media player built inside a custom cabinet.

Last Updated on Friday, 17 February 2017 11:44  


#14 Runescape Event 2017-06-24 20:35
Whеn sⲟme one searches for his required thing,
tɦerefߋre he/sɦe wishes to ƅе available thɑt in detail, therefore
that thіng is maintained ovеr here.
#13 True Brilliance 2017-06-24 03:24
My relatives all the time say that I am wasting my time here at net, except I know I am getting knowledge everyday by
reading such pleasant articles.

my web page; True Brilliance:
#12 2017-06-23 21:41
Its like you read my mind! You appear to know a lot about this, like you wrote the book in it
or something. I think that you could do Quick And
Easy Weight Loss With Garcinia Fuel And Apple Cider Vinegar;,
some pics to drive the message home a little bit, but
instead of that, this is excellent blog. An excellent read.
I'll definitely be back.
#11 New Age Skin Care 2017-06-22 07:50
This website is my inhalation, rattling good design and Perfect content material.

my web site - New Age Skin Care:
#10 TestX Core GNC 2017-06-21 22:18
I needed to thank you for this good read!! I definitely loved every
bit of it. I have you bookmarked to check out new stuff you post?

Here is my website ... TestX Core GNC:
#9 AdrianneAbt 2017-06-20 04:07
I see your blog needs some fresh & unique articles. Writing manually is time consuming, but there is
solution for this hard task. Just search for - Miftolo's tools rewriter
#8 Matthias 2017-05-16 15:35
Quoting Menno de Graaf:
Quoting Matthias:
Is the source code also available to make customisations?

Yes, if you want you can get the sources. I plan to make it available on Github, but first need to do some cleanup.

That would be really great. Could you send them per E-Mail?
I don't need any cleanup :-)
#7 Menno de Graaf 2017-05-16 12:53
Quoting Matthias:
Is the source code also available to make customisations?

Yes, if you want you can get the sources. I plan to make it available on Github, but first need to do some cleanup.
#6 Matthias 2017-05-16 07:38

great project!
Is the source code also available to make customisations?
0 #5 Rick Savas 2014-06-25 15:20

Spot on with your structure for IR decoding, here is a link to use as a reference, if you need it.
I reviewed the book for Jure, it helped me a lot.
Took me long enough to port the NEC code for a Amtel tiny2313 to Atmel xmega :-)


Add comment

Security code

Shopping Cart

Your Cart is currently empty.

List All Products

Advanced Search

Copyright © 2017 Djuke - DIY Audio. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.