0
\$\begingroup\$

I'm trying to control audio level/gain (from line or amplified signal) using an Arduino. I do not want to use SPI, for this project I can only use the PWM outputs, thus I do not want to use a digital pot. I found some related questions here, but they do not fully explain how this approach applies to audio applications.

From the PWM I know I can use a low pass filter, but I want to save time and space using a DAC chip. One option is the TDA1543 (http://www.docethifi.com/TDA1543_.PDF).

So my questions are:

  1. How do I connect the PWM and audio in/out using the DAC TDA1543?
  2. Will this approach work as an audio pot controlled by PWM or is there a more straightforward option?

The TDA1543 has 8 pins:

1: bit clock input

2: word select input

3: data input

4: ground

5: voltage

6: left channel voltage output

7: reference voltage output

8: right channel output

Where do I connect the PWM, and audio in and out? I believe I also need to indicate the resistance somehow or add resistors such as in a 10K pot (amplified) or 100K pot (line).

Any help will be very much appreciated!!

\$\endgroup\$
  • \$\begingroup\$ You need something like a microcontroller in the middle to provide the "digital" to the DAC \$\endgroup\$ – Scott Seidman Jun 17 '16 at 11:06
  • \$\begingroup\$ What makes you think that the TDA1543 does accept PWM do do anything with it? \$\endgroup\$ – PlasmaHH Jun 17 '16 at 11:07
  • 1
    \$\begingroup\$ What you want to do with the TDA isn't possible. \$\endgroup\$ – pgvoorhees Jun 17 '16 at 11:07
  • \$\begingroup\$ A DAC is supposed to convert PWM to analog, isn't it? \$\endgroup\$ – Chu Jun 17 '16 at 11:08
  • 2
    \$\begingroup\$ No, a DAC converts a digital word to an analog signal. You need to first convert the PWM to a digital word \$\endgroup\$ – Scott Seidman Jun 17 '16 at 11:13
4
\$\begingroup\$

To control audio signal gain with a PWM channel, simply connect the audio input and ground to the inputs of an analog SPDT switch, and connect the PWM signal to the switch's control input.

The output is fed to a low pass filter with a corner frequency somewhere between the top of the audio band of interest (say, 20kHz), and the PWM switching frequency (say, 100kHz). For cleanest waveform, a corner frequency of just over 20kHz - or a high order brick wall filter as used in early CD players.

\$\endgroup\$
  • \$\begingroup\$ Hi again, do you think these pieces are good for this: Spdt Vert 09-03290-01: ebay.co.uk/itm/EAO-Slide-Switch-Spdt-Vert-09-03290-01-/… Low Pass SOT-323-6: ebay.co.uk/itm/… Or do you recommend others? \$\endgroup\$ – Chu Jun 17 '16 at 16:26
  • \$\begingroup\$ No. That is a slide switch, not an analog FET switch, and a 1GHz filter, not 20kHz. \$\endgroup\$ – Brian Drummond Jun 17 '16 at 17:11
  • \$\begingroup\$ Ah when you said SPDT I didn't think it could be a transistor.. Now it makes much more sense! Sorry, I'm still learning the basics of electronics. So this would work then: ebay.co.uk/itm/… \$\endgroup\$ – Chu Jun 17 '16 at 17:30
  • \$\begingroup\$ And how about the low pass filter, should I get the whole module with an amplifier? I couldn't find a small unit for 20kHz yet, only things like this: ebay.co.uk/itm/… Do you think I can find something better? \$\endgroup\$ – Chu Jun 17 '16 at 17:31
  • 1
    \$\begingroup\$ Picking components or modules at random isn't going to work, sorry. \$\endgroup\$ – Brian Drummond Jun 17 '16 at 17:37
3
\$\begingroup\$

You want something like this chip that converts pwm to an analog signal http://www.linear.com/product/LTC2644

enter image description here

\$\endgroup\$
  • 1
    \$\begingroup\$ Thanks, but this chip looks a little bit complicated and expensive (around £6 in the UK). I will try Drummond's solution first. Thank you for your answer anyway! \$\endgroup\$ – Chu Jun 17 '16 at 13:50
2
\$\begingroup\$

Why don't you want to use SPI? What are your real constraints? What is the context of what you're trying to build?

Where do I connect the PWM, and audio in and out?

There is no audio in connection and no PWM in connection. The device takes 3 digital pins of input in I2S format, and outputs a voltage. This is not on its own sufficient to control a line level signal. What you want is a programmable gain amplifier of some sort.

It ought to be possible to use PWM into an analog low-pass filter with a large time constant to drive a voltage-controlled amplifier. You'd need to select a suitable VCA chip.

\$\endgroup\$
  • \$\begingroup\$ Thanks, I can't use a SPI because I'm using Maxuino to control the arduino, and it doesn't support SPI. I will have a look at VCA chips. \$\endgroup\$ – Chu Jun 17 '16 at 11:44
  • \$\begingroup\$ Brian Drummond's solution electronics.stackexchange.com/a/241480/2228 is intriguingly simple, provided you get the filters right and use high-frequency PWM. \$\endgroup\$ – pjc50 Jun 17 '16 at 12:24
0
\$\begingroup\$

schematic

simulate this circuit – Schematic created using CircuitLab

There are ways to do this with Analog switches ('4066) but may inject noise pulse injection and depends on circuit impedance and switching rate above 20kHz, Nyquist filtering etc.

Generally Digital Pots are harder to emulate with low distortion with discrete parts unlike PWM used in class D,E PWM relies on Switching rate half-bridge and filtering

\$\endgroup\$
0
\$\begingroup\$

Although there are various clever ways to implement a variable gain amplifier, you may have trouble finding the best one and implementing it if your knowledge of analog circuits is limited.

How fast do you need to be able to change the volume? One solution to this problem is to employ a digital potentiometer. Here is one example.

It is basically a resistor who's value can be programmed over a serial interface. If you drop one of these into a simple feedback amplifier, you can adjust the gain by programming the resistor according to the laws of the op-amp configuration.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.