5.1 channel preamp

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
This 'preamp' is part of my home made 5.1 audio system. Volume control
uses 3 CS3310 (same as PGA2311) volume control chips, 3 New Japan Radio
NJW 1119A tone controls for Bass, Mid and Treble. 3 OPA2134 opamps are
buffers, summers and LP filter and impedance buffer for the analog feed to the Arduino controller.
This 'preamp' includes a 6 channel power amp based on the T.I. TPA3116
that delivers 20 Watts /channel into 8 ohms. The box is my 5.1 audio for an LG OLED TV.

This is not the exact encoder I'm using but it is functionally the same.

Rotary Encoder + Extras ID: 377 - $4.50 : Adafruit Industries, Unique & fun DIY electronics and kits

This display is exactly what I'm using. For volume only 1 unit can suffice.
With the tone controls it's better with 2 units. BTW I like blue better but
that's just me. They have several colors including white.

Quad Alphanumeric Display - Blue 0.54 Digits w/ I2C Backpack ID: 1912 - $13.95 : Adafruit Industries, Unique & fun DIY electronics and kits

The IR modules are these.

38 kHz Remote TSOP4838 DIP-3 IR Receiver Infrared Radiation Modules XZ | eBay

The 'interface' is nothing more than a blank Arduino shield to mount the connectors.
3 pin for IR, 4 pin for the rotary encoder, 5 pin for the displays and a 10 pin
to talk to the preamp board and get 5 Volt power. The pins just connect to
Arduino Uno pins with no extra semiconductors but a couple of capacitors.

I got a little silly with the controls. The 'mute' function has a 'dim' mode. If you hold
the mute button more than a user settable preset, it goes to a secondary volume.
I usually set it to -15dB. The hold time can be set in 10mS increments up to
500mS to trigger 'dim' mode. It can also do 'fade' as mute. You can select
10 to 100 dB / second in 10 dB steps. Selecting 11 is not 110 dB but plain old instant mute.

Volume DOWN in mute or dim mode will reduce the level to un mute to but stay in mute.
Volume UP in mute mode comes out of mute and increments 1 dB. Mute button while in mute
just ramps back up to the old value. All settings are stored in EEPROM (non volatile).
My version includes a mono mix for a center channel in stereo mode and also low pass filters
the center to feed to the sub woofer. The Arduino gets a buffered center channel feed so
when it finds audio on the center channel it switches back to 5.1 mode.

The shaft encode is not needed but gives local volume control without a remote.
The button portion triggers mute and holding will also enter 'dim' mode.

This 'preamp' includes a 6 channel power amp based on the T.I. TPA3116
that delivers 20 Watts /channel into 8 ohms. The box is my 5.1 audio for an LG OLED TV.

Operationally the 5.1 is active always and uses the cable box remote to changes channels,
volume and inputs exactly like TVs of old before they turned into something that sometimes
need an engineering degree to use.

I know you can buy these thing but it's DIY. It's fun.

The TXT file need its name changed to .INO

 

Attachments

  • 6 channel schematic.pdf
    186.6 KB · Views: 356
  • 6 channel preamp P1040511.jpg
    6 channel preamp P1040511.jpg
    71.8 KB · Views: 353
  • 6 channel preamp mounted P1040528.jpg
    6 channel preamp mounted P1040528.jpg
    76.4 KB · Views: 930
  • 6 channel preamp P1040484.jpg
    6 channel preamp P1040484.jpg
    70.9 KB · Views: 907
  • 6 channel preamp P1040483.jpg
    6 channel preamp P1040483.jpg
    79.6 KB · Views: 871
  • 6 channel preamp top  P1040086.jpg
    6 channel preamp top P1040086.jpg
    67.7 KB · Views: 905
  • 6 channel preamp bottom P1040085.jpg
    6 channel preamp bottom P1040085.jpg
    65 KB · Views: 922
  • LG_remote51T7.txt
    31.1 KB · Views: 144
Well done,

I know how much work it is, when I made my portable radio/media player, using the TPA3100, before the TPA3116 was out. I still have code to write, I am not so good at it :) Should be fun reading your code :) . I think I left it at the IR decoder code. I made a remote encoder too.
My Mom uses the radio all day, she likes the RDS decoding. If you want to add AM/FM radio, I have code to give you.

I'll take a further look at your design, thanks for sharing.
 
This is great work! Thank you so much for sharing details.

Your feature set is quite extensive. You've inspired me to give this type of project a try. However, I'm interested in building only an 8-channel volume controller using four CS3310 ICs.

I looked into the parts you used and I think my best course of action will be to start with the power supply, Arduino, its peripherals and the software. I can work in parallel to design the volume controller board.

It appears that everything can be powered with a +5V and -5V power supply. It doesn't appear that you are using multiple voltage regulators for the various +5V devices. Are you using any components to help isolate those leads.

I gather that your power supply bridge rectifier, filter caps and voltage regulators reside on your custom board. I don't see a transformer inside your enclosure. What are you using for a transformer? I also assume you're providing a single voltage from an external power supply to your amplifier board.
 
The preamp power transformer is a 12 VCT but it would have a little more 'wiggle'
room with a 14 Volt transformer. These guys sell good toroids inexpensively.

AN-0107 - 10VA 7V Transformer - AnTek Products Corp

The power amp uses a 19 Volt 9.5 amp laptop supply.

The CS3310 and PGA2311 data sheets recommend a low source impedance.
In my case the analog signal is coming from an optical input DAC so the source
is already low. You might want to use input buffers like U3 to allow any source
impedance. I my case U3 is to isolate the 10k summing amp from the source
since the CS3310 is also 10 K. I like low impedance but 5K is a little low even
for me, hence U3. The input then is the resistor to ground at the buffer, in my
case 10K.

It isn't clear on the schematic that U3 is a triple 2:1 switch similar to a CD4053.
All analog switches show varying series resistance vs signal level. The 4053
maybe 120 to 180 ohms at 25C. In series with the 10K load would cause some
non-linearities (distortion). The Analog Devices chip shows the same series
resistance change but varies from 3.3 to 4.3 ohms at 25C so an order of
magnitude plus better than a 4053.

Because the center and sub channels have 2 different sources because of the
analog switch, it stores 2 sets of tone control and volume numbers for stereo
vs 5.1, only for center and sub.

At work I'm known as Mr or Dr capacitor for all the 'lytic caps I've replaced
(10,000 plus). On this board the only 'lytics are 2200uF 16 Volt and those are
Organic Polymer. All the 10uF and 100uF caps are SMD ceramics in addition to
the 100n bypass caps. The capacitors in the signal path are 2% film.

The 4 resistors on the regulators are 1% thick film 0805. The rest are 0.5% thin
film 0805 Susumu from Digikey. 11 cents in single lot, 10 cents in 10s but 3.76
cents in 100 lot. I have considerable 'left overs' that cost less than the 'right'
quantities.

Some tricks for SMD. I use a Metcal soldering iron with an STTC0126 700 degree
fine bent tip. Flux on the board from a flux pen in addition to the 63/37 Multicore
solder. After the parts are soldered but likely a little crooked, a hot air tool set to
the lowest air flow will allow the surface tension of the solder to align the part
without blowing them away. It's neat to see them self align.

Search for "858 hot air" on eBay and you should find lots around $35.

 
This 'preamp' is part of my home made 5.1 audio system.

Stratus, your schematic seems to indicate that you do not use an dedicated channel steering surround decoder of some kind. Instead, you have what looks to be non-steering purely analog surround generation. Your schematic shows inputs for front Left and Right channels, plus surround Left and Right channels. However, where do those surround channel inputs come from. Is it from some kind of external surround decoder?

I ask because the usual impediment to a DIY surround preamp or DAC is the need for a channel steering type surround decoder. I'm also wondering how your non-steering solution subjectively compares to an channel steering decoder based solution?
 
Last edited:
Stratus, your schematic seems to indicate that you do not use an dedicated channel steering surround decoder of some kind. <snip>

I use one of these set to 'pass' mode though the one I have has a 3 position switch marked 2.0, 5.1, and 'pass'.

Search eBay for optical analog 5.1

5.1ch Digital Audio Decoder Optical Coaxial Toslink to Analog 6 output Converter 784099939143 | eBay

It works correctly with all the over the air networks, our cable service and streaming like Prime and Netflix,
HTPC and the BluRay player.

The TV optical out feeds the DAC. The inputs to the TV are cable box, Roku box, HTPC and Blu-ray. The PC
required a Dr HDMI in between. The TV EDID reports it has 2 channels of audio but it will pass through 5.1
if fed to it. The BluRay had to be set to pass it, also true for the Roku box. The Roku box quirk is the first
time you set it to 'auto' to pass DTS but does not pass 5.1. There is a 'night time' mode mode for earphones
that forces it to stereo. When you exit night time mode it then passes 5.1.

The Dr HDMI tells the PC (Win 7 pro) it can pass 5.1 out the HDMI connector. When go into sound setup you
get the options beyond stereo. It will NOT encode 5.1 from 6 channels but it WILL pass through pre-encoded
audio. VLC CLAIMS to be able to pass 5.1 but I have never gotten to work so I use MPC-HC which will pass
through the 5.1 and works correctly with the KeySpan RF remote.

Yes the LG TV is 'smart' and can do Amazon and Netflix but I don't like the user controls on the LG remote so
I use a Roku box.

IOW the DAC does the hard work for me and all I need to do is control volume and tone.

 
Last edited:
Help about 5.1 project

Hello Stratus46,
I am interested in the complete outline of your project.
I made a 6-channel volume control with 3 x PGA2310, based on a Chinese kit.
My purpose is not the 5.1 but the volume control of the 6 outputs of my active crossover, so it's the same purpose.
I developed the input/output inteface balanced, but the computer part of the kit is pitiful. This is why I would like, if you agree, to have the interconnection schematic between the Arduino card, your analog part and the corresponding software.
I understand many things, but some one remain unclear: PIN_SW?, Why the outputs of the encoder Bourns are wired on analog inputs arduino? which input is used to program the parameters (Ex: dB / Second)? how did you find the VOL + and VOL- codes for Samsung and LG remote controls? I hope to use a NAD remote IR control, but I don't know her codes for VOLULE +/- tec...
If you can help me it will be with pleasure.
Olivier
France (please excude my bad English:)
 
First of all your English is 1000 time better than my French.

You might find it easier to treat the PGA chips separately rather than daisy chaining them.
That would mean sending 16 bits 3 times using 3 chip selects instead of sending the same
48 bits sequentially and only 1 chip select. Your choice as it's only a minor code change.

When I first tried a shaft encoder on an Arduino the example code from Arduino Playground
used the analog inputs which I just copied and everything worked. Since there are no
conflicts I just left it as it was.

The dB/second is for MUTE mode. The PGA2310 works in 1/2 dB per step. For TV use I really
don't need that fine a resolution so I just multiply by 2 to get 1/dB per step and then limit the
control range from 0 to 99. This simplifies the display using 4 character units. The MUTE mode
ramps the volume up and down. That rate in in dB / second which I limit to 10s I.E. 10, 20,
30, 40, 50, 60, 70, 80, 90, 100 and 'instant'.

Since you can't really tell the step size by listening 10-50 dB / step in in 1 dB per update, 60 to 100
is in 2 dB per update an 'instant mode just sets the rate to 100. This allows time to send status to
the serial monitor screen.

To get the remote codes I started with IRecvDump by Ken Shiriff on GitHub but evolved to this
very simple sketch

#include <IRremote.h>
#include <IRremoteInt.h>
#include <ir_Lego_PF_BitStreamEncoder.h>

int RECV_PIN = 6;
IRrecv irrecv(RECV_PIN);
decode_results results;

void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}

void loop()
{
if (irrecv.decode(&results))
{if(results.value != 4294967295)
Serial.println(results.value);
irrecv.resume(); // Receive the next value
}
}

You then copy the received value from the serial monitor screen and replace the number
in my sketch.

You don't need the tone control code so you can just delete it but since you don't have the
hardware, it could just send the data to nowhere.

Have you built an Arduino test system for this? I have the unit I built for the 2 channel version.
It's nothing more than a blank shield board with the connectors to the other parts. 3 pin
connector for the IR sensor, 4 pin for the shaft encoder a 5 pin for the Adafruit displays and
a 10 pin to the preamp board. There are a couple of bypass caps and pullup resistors for
shaft encoder. No semiconductors. Once you have the test system you can use the serial monitor.
You'll find a pretty complete messaging system to help debugging and testing. That board will
run the little sketch for identifying the codes. I've used this for Sony, Samsung and LG remotes.
The one possible problem could come from a different modulating frequency of the IR. Most but
not all remotes use 38KHz but there are other frequencies. All this means is you might need a
different IR module for the NAD

I'm hoping you're OK with Arduino code.

Good luck

 
Help about 5.1 project

Waaoh! thanks you for these very concrete explanations.
I have compiled your code and I order now a UNO card and displays, which I will perhaps change later for a 2x16 display.
I think I understand how to find the 3 or 4 IR codes I need from my remote (preamp NAD C160) with your explanations.

For alphanumeric displays I understood how to connect them, pin A4 (I2c SDA) and pin A5 (I2c clk), tutorials are quite explicit.

So, there are 3 points that remain obscure:

-1- Warning at compilation (not blocking I guess): a constant "ABCD" -> char * seems forbidden
example: show4left ("Dim"); warning: ISO C ++ forbids converting a constant string to 'char *' [-Wwrite-strings]
I am not a specialist of C language, my latest experiences date from the PASCAL language on digital VAX (around the year 1995 ...), but I think that with little time : I will find a Warning around.
The Arduino environment seems pretty cool to use.

-2- the SPI assignment for the PGA2310 is fixed for the UNO card:
SDI = pin11
CLK = pin13

but the assignment is different in the code:
PGA_SDI = pin8
PGA_CLK = pin9
I did not understand how it can work?

-3- I do not understand what to solder (back of displays) to differentiate the right display and the left

I hope I do not overuse your time, in France helping other people is not a natural thing...
OS

PS: Google does a lot for my english ;)
 
A couple of things. The pin 11 and 13 got into the comments at the top of the file. Those go all the way
back to the 2 channel version started on October of 2016 when we first got the LG OLED TV. That was
also a Chinese module that included a controller and remote that was proprietary. Because I couldn't
get into the code to change it I simply went to the Arduino. The pin 11 and 13 were never used in any
version and were always pins 8 and 9 from the very first. Nothing like letting others read your code to
find the errors.

As for the compile issue I used Arduino 1.8.9 for most of it. I just went to 1.8.10 recently and all is OK
so I'm not sure how you're getting that error. At least in the US it's
Arduino - Home.

Then go to download software and 1.8.10 is the latest.

On the back of the I²C displays are address jumpers A0, A1 and A2. The left display (secondary) gets
the A0 jumper soldered to change its address to 1.
The first 2 lines in setup
alpha41.begin(0x70); // pass in the display i2c address
alpha42.begin(0x71)

With 3 address jumpers you should be able to use 8 I²C items though I've only used 2.

As for helping out, many in the US and UK are quite generous with their time.

Hope this helps

 
Last edited:
Help about 5.1 project

Thank you very much, I did not understand that you set the 48 bits of PGA2311 directly with lines of code, more simply doesn't exist
I thought you were using the SPI possibility of the Arduino chain.
I think I understoud (approximately) everything about your project.
Code seems easy to modify, because it has all the bases that I search.
I would like to help you so, certainly not in software ... may be in hardware for ground wiring, if you have any noises or oddities between the digital part and the analog. I know what to do for this.
I think this project, with or without LOW MID and HIGHT corrections should be on the market.
And it is not so, I don't understand why.
Still thank

PS : warnings are not importants, they are also with last version of Arduino. there are in the middle of the long text write by compiler, sometimes I don't see them...
 
"Bit banging" the data loading in this case is trivial as there is no need for a steady clock rate, just the
right number of them. The actual block is "load8vol" and is only 5 lines of active code. The rest of it
would be needed to correct the level values based on the offsets whether using SPI or not.

As far as should be on the market, it already is. If you search eBay "5.1 remote volume" you'll find
several items, right now it's 5, based on the Mitsubishi M62446 6 channel volume control chip, all less
than $50 and all with proprietary controllers. I had one of those interfaced to an Arduino and it worked
well enough. But, I wanted to do the derived center and subwoofer from the simple stereo L and R,
I wanted to go back to the PGA2311 (same as the Cirrus Logic CS33010) because it claims better
channel to channel balance, more accurate steps and more control range (127dB for PGA chips and
79 dB for the Mitsubishi) lower distortion and noise. Could I actually hear these "shortcomings"?
No but I feel better about it. Under VERY noisy conditions the Mitsubishi chip did not mute completely
though I have not tried that same noise into the new unit. Mission creep being what it is, I added
tone controls to all 6 channels which then gave me an excuse to try a KiCad project and do another
DIY thing. At the end I finally added the mute as fade up/sown and the "dim" mode to partially mute.
I can't think of much more to do to it but you never know...

I've been doing broadcast TV for almost 43 years and have been through some stubborn ground loop
issues and have beat all of them but thanks for the offer. I may take you up on something down the road.

 
Help about 5.1 project

Thank you, I dissect your software and I learn at the same time some subtleties of c ++: you treated the details with great care, I caught "headache" by following the data format (volume, trimvol, table "adjust", and your "elaborate" mechanism of the mute fade (tables of constants and slowrate and slowinc and so on).

I will try to use some of your code, I will focus on the volume and maybe a slight offset setting on each channel.
With the I2c there will be enough "pins" to control one or two triggers, an ON / OFF button and why not +/- buttons.

Chinese kits : I knew them, I bought 3 since 2014, I join some pictures of the realization around this kit, but what I did in reality is to build a cathedral ( ok: just a big church :) on a "pile of manure".
- the remote control is a crap, contacts does not last long, no volume backup when power off, no choice of the increment, CPU does not follow when we turn the encoder too fast, etc, etc ...
I join a picture of my "cathedral" and the Chinese kit, the guilty I am going to replace.

Well, it's not all that. I have to work a lot if I want to throw this Chinese kit in the trash, as soon as possible.

PS: I can not translate your last sentence, USA expression (I may take you up on something down the road) ?
OS
 

Attachments

  • 1.jpg
    1.jpg
    260.2 KB · Views: 254
  • 2.jpg
    2.jpg
    389.5 KB · Views: 231
  • 3.jpg
    3.jpg
    294.2 KB · Views: 219
  • 4.jpg
    4.jpg
    294.2 KB · Views: 214
Member
Joined 2018
Paid Member
What DAC chips are in these 5.1 optical units from Ebay etc. ? Are they any good. I would like to get rid of my Denon AVR but I do like the 5.1 for occasional film watching and then main system front end does TV aswell.

So these units dont properly put out the 5 channels and Dolby intended? Is the SW channel low passed?

Thanks
 
What DAC chips are in these 5.1 optical units from Ebay etc. ? Are they any good. I would like to get rid of my Denon AVR but I do like the 5.1 for occasional film watching and then main system front end does TV aswell.

So these units dont properly put out the 5 channels and Dolby intended? Is the SW channel low passed?

Thanks

I have no idea what DACs are used in the unit. I DO know that the last time I heard a DAC that bothered me was in a Citizen portable CD in 1989. I think you'd have a hard time finding a DAC in the last 10 years that sounds bad .

All the channels are always where they are supposed to be. The fake center _I_ generate is for plain 2 channel stereo, L and R only to use the center and sub. I include a 100Hz LPF for the sub that is only used in stereo mode. When center channel audio is detected it switches back to 5.1 mode. I don't know if UK TV shows are 5.1 but in the US it is very common for the scripted shows.

Seeing an elevated train go from left rear to right front on screen is a little better when the audio does the same.

 
Thankyou. Yes I would not want to be without my proper Dolby Digital 5.1 but my big Denon AVR is taking up lots of rack room. I wandered if one of these 5.1 units and some class d amp modules could replace it .

That is precisely what I did. Search on eBay for "TPA3116 5.1" and you'll find several types.
I used a power amp only module with no remote or controls.

5.1 TPA3116 digital amplifier board 6 channel amp board 50W*4 + 100W*2 L163-8 822933248485 | eBay

The boards like this all have a silk screen error. Notice all the '+' outputs are to the right
except for the 'MS' output which is really 'SW' upside down. The '+' output is to the right
just like the rest. As far as I can tell, the less expensive units use 1 main power input
cap rather than 2 and have 5 screws rather than 3 to hold the heatsink. Keep in mind that
100 Watt thing for the center and sub assumes you use a 2 ohm load. With a 24V supply
all 6 channels will do 25 Watts at 8 ohms and 50 Watts into 4. I used 19 Volt laptop supply
because it is completely enclosed and no worries about exposed wires. One other thing
that might surprise you is the output DC is 1/2 the power supply value. In my case that is
9.5 but it's a bridge amp so the value across the speaker is 0 but you need to be careful how
you connect test gear. You could add output caps but they would only waste space and money
with no sonic benefit.

The space occupied by this box is 203x144x68 mm. I used blue plexiglas for the front rather
than the metal plates supplied and black plastic for the back as it's easier to cut the holes.
The recess for the knob is a PVC end cap for PVC pipe cut to size and glued to the plexiglas.

I later added a USB extension from the Arduino to the back panel to GREATLY simplify firmware
updates. The HTPC in the system simply has the Arduino IDE on it for this purpose. There is
one change since the rev 7 I posted in August. Any remote keypress while the display says
HI and the audio is muted (always muted for the first 5 seconds) will remain in MUTE until a
volume up or Mute button is pressed.

 
Member
Joined 2018
Paid Member
Thanka for that. I have some class d modules. I already have a tpa 3255 powering front channels that use the AVR pre outs. I have a tpa3251 3 channel that could do the centre and surrounds. My sub is active so just feed it a signal but it needs to be an 'LF' signal.
Is the SW output from these 5.1 ebay units 'fullrange' or is it low passed?

I've read all this thread but all the arduino stuff is beyond me I'm afraid.!
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.