VS1003 with PCB mono speakers and external speakers via 3.5mm jack

Designing hardware that use VLSI Solution's devices as the system controller for the entire design.
Berry
Senior User
Posts: 20
Joined: Wed 2019-04-03 21:25

VS1003 with PCB mono speakers and external speakers via 3.5mm jack

Post by Berry » Wed 2019-04-03 21:45

hello

I’m designing a circuit using the VS1003B-L chip with the following specs/features:
• 3.5mm aux jack that is only used to connect to external speakers and not to headphones (can be connected to stereo or mono external speakers)
• 4 Ohm speaker on PCB (mono)
• When external speakers are plugged in via the 3.5mm aux jack, audio should play through the external speakers and not through the PCB speaker
• There is no microphone used.
• A microcontroller will be used to control the VS1003 chip

I searched and went through pretty much the entire support database, including the following:
o The USB recorder example
o The “Line out, Line in and Headphone connections” (viewtopic.php?f=9&t=69)
o Various circuits by other users


I’m still not 100% clear on how to modify the reference design/examples to work for our application. I didn’t come across any example or reference design that has the following:

• 3.5mm aux jack that is meant for external speakers not headphones
• Mono speaker on PCB

My questions are:

1. Are there any reference designs for connecting the chip to external speakers through 3.5mm jack and for connecting to a mono PCB speaker at same time?

2. All of the examples that have a 3.5mm jack are meant for headphones not external speakers. In those examples, CBUF is connected to the GND pin of the 3.5mm jack. It is also noted that headphones have much lower resistance than external speakers. Similarly, in the examples, there’s a design for “line out” and for “headphone out”, but it’s not clear what to do when line out is going through a 3.5mm jack but not intended headphone, as is the case for my application. Furthermore, the reference design shows a high impedance path for line out and that CBUF is not brought out. However, all of the examples that have a 3.5mm jack have low impedance path and CBUF is connected. Also, according to some threads, headphones don't require the Sigma Delta reconstruction filter, but in our case, the 3.5mm jack is going to external speakers and not to headphones. It's not clear whether one should use the "line out" or the "headphone" reference circuits for our case, or a mix. How do I change the reference design for our case?

3. Based on my understanding after going through many threads and examples, I’ve come up with the attached schematic, could you please review and give your feedback? Are all the connections correct, are the CBUF connections correct, are the resistors and caps where they should be?

4. How do I ensure that audio only plays through the external speakers via the 3.5mm jack when connected? Audio should only play through the PCB speaker when there is no external speaker connected.


For the circuit diagram attached, as per the recommendations in other threads, for the on board mono speaker, I’ve done the following:

o Used mono amplifier and speaker in differential mode and hence removed DC blocking caps
o Didn’t use GBUF as input to the amplifier but used as input to the 3.5mm jack (which in our case will only be used to connect to large external speakers and not headphones)

Your feedback is much appreciated!

Regards,
Berry
Attachments
circuit.jpg
circuit.jpg (55.93 KiB) Viewed 259 times

User avatar
pasi
VLSI Staff
Posts: 1563
Joined: Thu 2010-07-15 16:04

Re: VS1003 with PCB mono speakers and external speakers via 3.5mm jack

Post by pasi » Thu 2019-04-04 9:58

3. First things first: NEVER connect CBUF/GBUF to the ground of the line output. Use GND.

2. There are line out terminals in viewtopic.php?f=9&t=69 (See the Line out right and Line out left and GND terminals)

4. You need a connector with plug detection, or some other method to detect the inserted plug. There are connectors that have a fourth or even fifth terminal that detach or connect when a plug is inserted. Without that kind of connector you're going to have a hard time detecting a connecting plug. I will need to do a little digging here to see how it was done in some of our (obsolete) designs.

- Edit1: This cannot be directly copied. In headphone + speaker situation, when the headphone is inserted, it detaches a terminal and the signal goes low. When headphone is not inserted, the signal is the right channel output, biased to 1.2V (due to being headphone output). The signal is converted with a transistor to logic-level for the firmware to read. Another GPIO is used to control the enable signal of the speaker amplifier, which is connected between GBUF and LEFT.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

Hannu
Senior User
Posts: 66
Joined: Mon 2016-05-30 11:54

Re: VS1003 with PCB mono speakers and external speakers via 3.5mm jack

Post by Hannu » Thu 2019-04-04 14:19

Hello!

The TPA20391 has an enable pin. With GND switching contact jack, you can connect the other end with pull-up resistor to EN pin of the amplifier. When the detect pin closes, it grounds the EN pin and audio comes out from the jack. If the plug detect pin opens the connection, use transistor to invert the signal to EN.

Also what kind of audio you have? If you have mono source, then using left and right is fine and SM_DIFF might be quite useful.
If your audio is stereo, it will sound funny if you are listening L-R.

I would take L and R and through 4k7 resistors and put gbuf to other input. TPA has typical input impedance of 24k and larger the monofying resistors are, less crosstalk there is. I just chose 1:6 output-input impedance ratio and you should still get 50+ dB channel separation. I would do some testing and tweaking.

Berry
Senior User
Posts: 20
Joined: Wed 2019-04-03 21:25

Re: VS1003 with PCB mono speakers and external speakers via 3.5mm jack

Post by Berry » Wed 2019-04-10 7:00

Pasi, Hannu, thank you for the input. Strange, I was wondering if there was an update to this thread and upon getting no email notification after a few days of posting, I thought I’d check the forum and sure enough, I saw your replies. It turns out the email notifications were automatically marked as spam by Google. It looks like some users are marking notifications as spam instead of unsubscribing, so I’ll start with myself and marked as “not spam”. If enough users do that, Google’s algorithm will re-train and start routing emails properly.

First a few things to clarify:

1. Yes, as stated in my initial post, I’ve gone through viewtopic.php?f=9&t=69 in great detail. As described earlier, my case requires that I connect the “line out” through the 3.5mm jack and hence my post. I can’t just follow the reference design as is, as the 3.5mm jack there is meant for headphones and not for “line out” (aka, going to external active speakers). Could you please advise what is the best way to connect “line out” to a 3.5mm jack, and what modifications are necessary for my circuit? Terminologies aside ("line out", "headphone out") , I want to be able to connect via the 3.5mm jack to external (mono or stereo) speakers and to on PCB (mono) speaker. However, audio will only play using either one at any given time.

2. I haven’t connected “CBUF” to ground. I’m actually well aware that this is bad as CBUF is ~1.2 V. I’ve connected CBUF to the “COMMON” of the 3.5mm jack. Apologies for the confusion, I think me labeling the “COMMON” as “GND” in my diagram is what threw you off. In my updated diagram, I've renamed that to avoid confusion.


3. Thanks for the feedback regarding the detection circuitry. I wasn’t able to find any 3.5mm jack with "common"/"GND" switch available. Everything I found has switches connected to either L or R, not "common"/"GND". For my application, I need to route the detect signal to the microcontroller and not to the speaker amplifier directly. So what I did instead is use a “SPDT” jack (“SJ-3566AN”) instead. When no plug-in is detected, pins “4” and “5” of the jack will be connected (see attached circuit). When a plug-in is detected, pins “5” and “6” will be connected. I use a voltage divider and route this signal to the microcontroller. I have another GPIO to shutdown the amplifier as required.

4. As for type of audio, it will be a mix. The audio files themselves may be stereo or mono, as it's controlled by the user. On the device itself will be 1 (mono) speaker. However, the user can connect to external stereo speakers via the 3.5mm jack. Those external speakers can be mono or stereo, depending on the user. Thanks Hannu for pointing out that "SM_DIFIF” is not a good option for my application. This is what I initially intended to use but I can see now that it would be problematic when the audio file is stereo. I suppose in my case, it’s probably best not to use “SM_DIFF” and change the connectivity for the on-board speaker so that it takes both the L and R output from the codec using a summing resistor. Is that correct?


Could you please provide feedback on this updated circuit attached?

Thanks!
Attachments
audio_circuit-Our Circuit - take 2 (1).jpg
audio_circuit-Our Circuit - take 2 (1).jpg (85.04 KiB) Viewed 227 times

User avatar
pasi
VLSI Staff
Posts: 1563
Joined: Thu 2010-07-15 16:04

Re: VS1003 with PCB mono speakers and external speakers via 3.5mm jack

Post by pasi » Wed 2019-04-10 10:16

Berry wrote:
Wed 2019-04-10 7:00
2. I haven’t connected “CBUF” to ground. I’m actually well aware that this is bad as CBUF is ~1.2 V. I’ve connected CBUF to the “COMMON” of the 3.5mm jack.
The COMMON (GND) contact is connected to ground in the amplifier you connect to the line output.

Unless your device is totally isolated (i.e. battery powered and no other external connections), it will cause masses of current drive from CBUF. Admittedly the CBUF short-circuit protection might trigger and save you, but it's not good to rely on that, as the initial current draw might break your regulator or battery.

For line output you need to have GND, DC-block capacitors to bias the signals around 0V instead of around REF / CBUF, and probably low-pass filter to get rid of the modulator noise.

It looks line you have the rest already, but you need to connect GND to the 3.5mm jack (instead of CBUF).
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

Hannu
Senior User
Posts: 66
Joined: Mon 2016-05-30 11:54

Re: VS1003 with PCB mono speakers and external speakers via 3.5mm jack

Post by Hannu » Wed 2019-04-10 10:19

Berry wrote:
Wed 2019-04-10 7:00
First a few things to clarify:

1. Yes, as stated in my initial post, I’ve gone through viewtopic.php?f=9&t=69 in great detail. As described earlier, my case requires that I connect the “line out” through the 3.5mm jack and hence my post. I can’t just follow the reference design as is, as the 3.5mm jack there is meant for headphones and not for “line out” (aka, going to external active speakers). Could you please advise what is the best way to connect “line out” to a 3.5mm jack, and what modifications are necessary for my circuit? Terminologies aside ("line out", "headphone out") , I want to be able to connect via the 3.5mm jack to external (mono or stereo) speakers and to on PCB (mono) speaker. However, audio will only play using either one at any given time.
The differences between line out and headphone outs are simple. Line-out doesn't have DC offset so the signal is going around ground level. Blocking the DC level is done with the 10 uF capacitors. Because of this line-out has higher output impedance on lower frequencies. On DC it is infinite but 20 HZ will have low enough output impedance to drive the 10k input impedance of an amplifier.

Headphones are floating and the signal which comes from left or right, returns to CBUF. If there is no signal, left and right are outputting same voltage as CBUF. so there is no voltage difference and no current. Headphones float on CBUF.

Headphones are low impedance (30-600 ohm) load to compared line input impedance 10k so to drive it with high accuracy, lowest possible output impedance is desired.
2. I haven’t connected “CBUF” to ground. I’m actually well aware that this is bad as CBUF is ~1.2 V. I’ve connected CBUF to the “COMMON” of the 3.5mm jack. Apologies for the confusion, I think me labeling the “COMMON” as “GND” in my diagram is what threw you off. In my updated diagram, I've renamed that to avoid confusion.
What if the active speakers, which you connect to the plug has same ground as the VS1003 board? And it brings its ground to input connector common? Then you have GBUF connected to ground and the audio will be broken.

Currently you are removing the DC offset left and right. They are referenced to ground. The GBUF on the line out jack common is adding the 1.2 volt DC offset. The active speakers see -1.2V DC offset in signals to the common and all the high frequency noise there is in GBUF will be summed to your input signal and may be aliased down to audible frequencies in the amplifier.
3. Thanks for the feedback regarding the detection circuitry. I wasn’t able to find any 3.5mm jack with "common"/"GND" switch available. Everything I found has switches connected to either L or R, not "common"/"GND". For my application, I need to route the detect signal to the microcontroller and not to the speaker amplifier directly. So what I did instead is use a “SPDT” jack (“SJ-3566AN”) instead. When no plug-in is detected, pins “4” and “5” of the jack will be connected (see attached circuit). When a plug-in is detected, pins “5” and “6” will be connected. I use a voltage divider and route this signal to the microcontroller. I have another GPIO to shutdown the amplifier as required.
Here is VS1010 developer board schematics:
http://www.vlsi.fi/fileadmin/products/v ... ev1_50.pdf
On page two there are headphone and line out with headphone detection connection using 4-way jack. Your plug detection would work.There is however a catch. If user plugs some headset with microphone the second ring would connect the microphone between plug detect and ground. In your application this might be non-probable scenario.

Your R38, R39, C1 and C2 are good don't change them. On VS1010 it was wanted to get higher frequencies out (DAC running 96kHz) so the frequency of the low pass filter was set to higher. (R50,R51,C55,C56)
4. As for type of audio, it will be a mix. The audio files themselves may be stereo or mono, as it's controlled by the user. On the device itself will be 1 (mono) speaker. However, the user can connect to external stereo speakers via the 3.5mm jack. Those external speakers can be mono or stereo, depending on the user. Thanks Hannu for pointing out that "SM_DIFIF” is not a good option for my application. This is what I initially intended to use but I can see now that it would be problematic when the audio file is stereo. I suppose in my case, it’s probably best not to use “SM_DIFF” and change the connectivity for the on-board speaker so that it takes both the L and R output from the codec using a summing resistor. Is that correct?
This one is about where to put the complexity. Complexity can be on pcb or on the MCU software.

Using SM_DIFF would be possible now that you have the plug detect. Set it on when using internal speaker and off when using line out. Benefit of this is that there is no crosstalk on line out.

The resistor summing should work, give some crosstalk in line out and it could be used with simple transistor cicruit like in the VS1010 developer board. But now that you control the internal amplifier with MCU, you can control the summing in software too.

Could you please provide feedback on this updated circuit attached?
Connect the line-out common to ground, not GBUF, use SM_DIFF and original circuit for TPA amplifier. Write line-out jack detect software.

Berry
Senior User
Posts: 20
Joined: Wed 2019-04-03 21:25

Re: VS1003 with PCB mono speakers and external speakers via 3.5mm jack

Post by Berry » Fri 2019-04-12 7:10

Thank you Pasi for the feedback and Hannu for the detailed explanation and insights! I understand this a bit better now. Please let me attempt to summarize your points:

• Connect “COMMON” of line out to “GND” (good catch, I didn’t think of that indirect short) to avoid grounding CBUF
• Have 2 options for amplifer inputs:
o Option 1: Remove summing circuit and change back to original circuit for the amplifer inputs. Then use use SM_DIFF when no external speaker plugged in, and turn off SM_DIFF when external speaker plugged in. This option is best as it reduces crosstalk.
o Option 2: Keep amplifier inputs as is (with summing circuit in place) and use SM_DIFF when no external speaker plugged in, and turn off SM_DIFF when external speaker plugged in. There will be some crosstalk onto line out due to summing resistors at input of amplifer.


Are the above points correct?

I’ve updated the circuit by following option 1 above and connecting “COMMON” of line out to GND. Is that correct? (I've also removed the 1M Ohm resistor on the switch jack pin #6, as I don't think that's needed)

We'll be testing out the values and tweak them after first PCB, but would just like a good starting point for first PCB and will tweak from there onwards.



Also, Hannu mentioned “ If user plugs some headset with microphone the second ring would connect the microphone between plug detect and ground”. I didn’t quite understand that comment. For my application, we don’t use the microphone function at all, but of course users may still use a cable with a microphone ring. Is the concern that plugging in a 3.5mm plug with a microphone ring may mess up the line out circuit? Let’s say a microphone is connected to terminal 4,5, or 6 of the SJ-3566AN plug. Based on my understanding, microphone impedance is usually low (<1kohm) and if that’s the case, it’s quite negligible compared to the resistors currently used for the switching jack and wouldn’t change threshold levels. I’m not sure if I’m missing something.


Thanks again for your help!
Attachments
audio_circuit-Our Circuit - take 2 (1).jpg
audio_circuit-Our Circuit - take 2 (1).jpg (81.72 KiB) Viewed 210 times

Berry
Senior User
Posts: 20
Joined: Wed 2019-04-03 21:25

Re: VS1003 with PCB mono speakers and external speakers via 3.5mm jack

Post by Berry » Mon 2019-04-15 18:26

Hi Hannu , Pasi

Just wondering if you can give your feedback on my last post?

Thanks!

Hannu
Senior User
Posts: 66
Joined: Mon 2016-05-30 11:54

Re: VS1003 with PCB mono speakers and external speakers via 3.5mm jack

Post by Hannu » Tue 2019-04-16 11:34

I don't notice any particular problem anymore. I would go to layout design and prototyping.

Berry
Senior User
Posts: 20
Joined: Wed 2019-04-03 21:25

Re: VS1003 with PCB mono speakers and external speakers via 3.5mm jack

Post by Berry » Tue 2019-04-16 20:46

Great, thanks Hannu. One other question I was going to ask, is that I noticed (on the VLSI Solutions website) some of the reference designs with 3.5mm jack have back to back Zener diode (MG054S05X150DP) on the 3.5mm jack terminals and others don't. I understand this is for ESD protection, but I'm curious to know how critical this is and if it's expected to cause any distortion to the audio signal?

Post Reply