Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

DAC audio output using LM386 IC amplifier

Status
Not open for further replies.

Tizana

Newbie level 6
Joined
Sep 12, 2015
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
182
hi,

I'm using an ARDUINO ZERO and i want to generate an audio signal from the DAC to a small 8Ohm/0.2w onboard speaker like this one **broken link removed**

the ARDUINO ZERO contain an ATSAMD21G18 microcontroller which will read audio .wav file from the SD card and generate audio signal to the DAC. the DAC voltage range is between 0 to 3.3V.

so my amplifier schema is based on this tutorial which uses the LM386 circuit : https://www.arduino.cc/en/Tutorial/SimpleAudioPlayer


gain LM.png

i didn't use the 10uF capacitor between the pin 1 and 8 to obtaint a gain of 20 according to the datasheet. note : normally in the tutorial they made a mistake by putting the gain 50 instead of 20 without the capacitor

so my question are :

1/ The DAC output is only a positive voltage between 0 and 3.3V so normally the audio signal from the DAC should be shifted by +1.65V in order to obtain all the + and - wave of the audio signal ? is that right ? see picture bellow :
OUTPUT DAC.png
then normally the DC components should be removed using a capacitor as high pass filter. and according to the tutorial they used a capacitor of 10uF in the output of the DAC which should remove the DC components and in this case the signal will be centered around the 0V.

so my question is how the LM386 will amplify the negative audio signal when the supply of the circuit is between GND and +Vs ? is there something wrong in the circuit ? should i remove the 10uF capacitor and just let the 250uF capacitor in the output of the amplifier remove the DC components? please refer to the picture above.




2/ here's my schema that i modified in order to match with my 0.2w speaker. i want to know if it's OK ?

ampli-audio-1.png

so the RMS value in the output of the DAC is approximately equal to (3.3V/2)/sqr(2) = 1.166V so i used a voltage divider to reduce it to 0.064V Rms.

Then in the amplifier output the RMS voltage will be 20 x 0.064V = 1.29V

SO approximately the maximum power voltage will be equal to P = U²/Z = (1.29)² / 8 = 0.2W


thx,
 

Hi,

1) DAC output:
Please read the DAC datasheet to see what's it's output signal. Where is the center, what output voktage range, frequency range, output impedance.

1) removed DC...centered around 0V.
With many single power supplied amplifier circuits the right side of the capacitor is buased to about VCC/2.
But in your case the LM386 datasheet clearely says:
The inputs are ground referenced while the output
automatically biases to one-half the supply voltage.

--> Trust the datasheet. There is nothing wrong.

2)
DAC output voltage divider.
I think it's not useful. You will decrease signal performance by ... first attenuate a signal .... then amplify a signal.
But I see the amplifier has a minimum gain of 20.
What maximum gain you need depends on:
* DAC nominal output level (I doubt that an audio DAC really uses full supply range, but it's possible)
* Amplifier power supply voltage
* recording level of the music
(All unknown to us... )

Don't calculate max gain in a way that it limits output (power) to 0.2W.
Music is not pure sine (therefore the peak-to-RMS-ratio is not sqrt(2).
And the music never is recorded to 0dB.

Klaus
 

HI KlausST,

thx a lot for your answers, :smile:

1/ so the DAC that i'm using is the DAC of the ATSAMD21G18 microcontroller in the arduino zero board. and they didn't put that much technical information about the DAC in the microcontroller datasheet, the only things they put is that the DAC output is 10-bit resolution, and it is capable of converting up to 350,000 samples per second (350ksps).

2/ yes i know that RMS value of the audio signal is not VMax/sqr(2) because it's not a sinusoidal signal. but i just estimated to make my calculations.

so the microcontroller will read a .wav audio file from sd card and then send it to the DAC output of the microcontroller. this are done with a preconfigured library available in the arduino enviroment.
in the bottom of this tutorial page you can see the code : https://www.arduino.cc/en/Tutorial/SimpleAudioPlayer


may be should i redo all the calculation with a power margin, so instead of outputting 0.2w for the speaker should i go for 0.3w ? but what happen in this case if the signal will be all the time 0.3w for a 0.2w speakers ?

regards,
 

Hi,

1)
Did you consider using oversampled output? ...to compensate for the limited resolution.

....you need an analog reconstruction filter

2)
I recommend for high gain.... it shouldn't be a problem if you calculate for 1W or even more.
I don't know why there is a 0.2W specified for the speaker. It may be because of overheat, it may be because of mechanical limitations, it may be to limit distortions. Isn't there a peak power specified?

If it will be distroyed by more than 0.2W..
Then you need music that is recorded at 0dB and the loudest passage is about pure sine, which is very unlikely.
(square wave is even worse, but even more unlikely to be called as music)
I assume that most of the music when optimally recorded (peak = 0dB) will have it's average at less than -20dB.

One additional point is, that such a small speaker isn't able to reproduce sound below some 100Hz. Those frequencies just generate much membrane movement...and thus distortion.
Therefore I recommend to use a digital high pass filter.
This reduces output power and generates more pure sound.

Klaus
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top