# Connecting TDA7052 with a microcontroller

I am planing to use a digital I/O off a micro-controller unit (MCU) and connect it to a TDA7052 input. The TDA7052 datasheet specifies a maximum input voltage of 0.65 V. And since the MCU output bit give either 0 or 5 V, there needs to be a interface circuit between the two. A couple of options come in mind:

1. Use PWM (pulse width modulation) with an RC filter. The PWM output's duty cycle will have to be limited (by software) to 13% ($0.13 \cdot 5\mathrm{\, V} = 0.65 \mathrm{\, V}$).

2. Use an op-amp to reduce the voltage to a max of $0.65 \mathrm{\, V}$.

Any suggestions on which method would work better? I would also appreciate it to know if there are other (perhaps better) options. I don't have the components to try them out as I am planning to order them of the web. I do want to connect the MCU to an 8 ohm speaker and NOT A buzzer.

• I've skimmed through this datasheet for TDA7052. It says that $V_{in,max}=5V$ (table on p.4). Could you post a lint to your datasheet? – Nick Alexeev Nov 27 '12 at 7:59
• @NickAlexeev lint = link :-) – Anindo Ghosh Nov 27 '12 at 8:07
• @AnindoGhosh English language is frugal when it comes to spending letters for making words. There is little information available for "CRC". Spell checkers go only so far. – Nick Alexeev Nov 27 '12 at 8:11
• I must have improperly read the datasheet. The 0.65V is the typical input handling voltage on page 6. So, it seems that 5V should be OK. Thanks for the help. – Nabil Nov 27 '12 at 9:43
• @NickAlexeev I must have improperly read the datasheet. The 0.65V is the typical input handling voltage for gain of 1.4V (page 6). So, it seems that 5V should be fine. Thanks for the help. – Nabil Nov 27 '12 at 10:32

The datasheet for the TDA7052 specifies an absolute maximum Vin of 5 Volts on pin 2. A simple voltage divider can bring the microcontroller output down below that level.

If your plan is to use a PWM signal from the microcontroller to output audio signals, then you will need to low-pass filter the microcontroller output. An RC filter used for this low pass would inherently drop the signal voltage down, so you will not need to limit the duty cycle of the MCU output. A voltage divider will also not be required.

To ensure that the resultant analog (PWM filtered out) signal does drive the amplifier into clipping, the gain control DC voltage applied to pin 4 can be limited such that the gain is just enough to obtain maximum output across pins 5 and 8, with a maximum-amplitude output of the PWM signal - Generate a 0% to 100% PWM "sine wave" at audio frequency to check this. Better yet, limit the DC volume control input to slightly below that level for some safety margin.

Though you probably know the following, just for completeness I'll mention that your PWM base frequency needs to be significantly higher than the top frequency your (presumably) audio signal is expected to span. Nyquist criteria require a bare minimum of twice the signal frequency, but for reasonable audio quality, pushing it up to 100 KHz (5 x 20 KHz) or more might be useful.

If the waveform you want to create is just a square wave you can simply connect your uC to the input pin. The chip will clip horribly, but a clipped square wave is still a square wave, so no problem. The gain input can control the gain down to -33dB, so it can still be used, although not for its full range. If you want to use the full range, place a resistor divider between th uC and the 7052 input, try 220k and 1k (for 20 mV input to the 7052).

If you want to create something else than a square wave you will haev to use some form of A/D. Aim for 20mV max output.

• Indeed, I want to create a square wave and no more. So it seems that I can directly connect the uC output to pin 2 (Vin). And use 220K and 1K for the DC gain. – Nabil Nov 27 '12 at 18:16
• Another related issue is the maximum current required from the power source. Is it safe to assume (since it can provide 1W and assuming 5V source) that 1W/5V = 200mA current should be provided by the power supply (power regulator)? If not, how to safely calculate the current requirements? – Nabil Nov 28 '12 at 8:06
• That would imply that the amplifier was 100% efficient, which is impossible. 50% is the theoretical best, for normal use I would put a factor of 2..4 on top of that for the loudest setting (which would in practice be seldom used). BUT you use a square wave, so the worse case current is U/R, where U is 5V minus staturation voltage of the two output stages (assume 0.5v each), and R is the DC (!) resistance of your speaker, assume 4 Ohm. That would result in 1A. – Wouter van Ooijen Nov 28 '12 at 8:24