Help in choosing audio amplifier

Thread Starter

davyvr

Joined Jul 27, 2015
6
Hello everyone,

I have been looking for about 2 days for a good way to generate sound from a biased square wave, using LTSpice to simulate everything, but I keep seeing high distortion or low efficiency. Since I'm quite unexperienced in this field I decided to post my question here, to make sure I get the basics right.

So at the start I have a pulse wave between 0 & 5 volts, with a fixed frequency (only one tone at a time). I could send this straight into a speaker, but then I would get a 2.5V DC bias into that speaker (not good as far as I read), high distortion because of the square wave, and most importantly , not enough power. My source delivers 10 mA and I need 600mA for the speaker (4 Watts, 8ohm). So I need to double the voltage (5V p-p instead of 2.5V) and a higher current. I have 5V, 9V and 24V available.

I've found some amplifier circuits online, but they all have problems:
1) http://bryanduxbury.files.wordpress.com/2012/01/amplified.png?w=400&h=183
has no DC bias compensation so not good for the speaker. A capacitor in series with the speaker doesn't work here. (correct me if I'm wrong)

2) http://www.electronics-tutorials.ws/amplifier/amp31.gif?81223b
Speaker between Vou and 0V would work, if the resistors in series with the transistor are very low (I need 5V over the speaker). Result: high power loss (easily 70%). Since I'm working on batteries I want to avoid this dissipation of 5-6 watts.

3) http://forum.arduino.cc/index.php?topic=66637.15
Same problem as 1 I think: DC current through speaker. (correct me if I'm wrong)

4) http://www.electronics-tutorials.ws/amplifier/amp47.gif?81223b
Could work, but has some disadvantages which were solved by this one:
http://www.ibiblio.org/kuphaldt/electricCircuits/Exper/05320.png
They both work fine with AC signals 0.5Vp-p I suppose, but again. Mine is 2.5V p-p. So I need to lower it through voltage division, and at the same time low-pass filter it (remove distortion square wave) and high pass filter it (to remove DC bias). This contradicts. And if I want 15kHz to pass I can't get a sine wave out of 2kHz with the same low pass filter.

5) So I thought: if I have to go to 0.5V p-p anyway, why shouldn't I use an amplifier chip, like a TI LM384. This simplifies my work. But even then I still wonder how I can get from 0 - 5V pulse to -0.5 - +0.5V sine wave in the complete 2kHz - 15kHz spectrum. And do I have to do this before or after the amplification? I think in case of a chip I need to do it before. But is that the best choice?

6) Perhaps I'm going too far? Is a DC current really a problem? Do I really need a +- sine wave or will my speaker also sound OK with a square wave?

Here I got a bit lost... Can anyone point me in the right direction?

Thanks a lot for anyone who can help!

Kind regards,
Davy Van Rossem
 

MikeML

Joined Oct 2, 2009
5,444
Getting rid of the DC component in a square wave is simple; just put a dc blocking capacitor between the source and the load. Most audio amplifiers have such a blocking capacitor both at their input and output, so that they do not pass the "DC component" anyway.

A complication comes if you are "gating" the square wave on-off in bursts. It is possible to overcome this with a bit of effort.

What is the source? Is it some sort of microprocessor? Can you reprogram it? Do you have extra port pins available?

What is the goal of "filtering" the squarewave? Is it just to make it sound more pleasing to the ear? How pure? What is the range of the frequencies (lowest to highest) of the tones?
 
Last edited:

Thread Starter

davyvr

Joined Jul 27, 2015
6
Getting rid of the DC component in a square wave is simple; just put a dc blocking capacitor between the source and the load. Most audio amplifiers have such a blocking capacitor both at their input and output, so that they do not pass the "DC component" anyway.

A complication comes if you are "gating" the square wave on-off in bursts. It is possible to overcome this with a bit of effort.

What is the source? Is it some sort of microprocessor? Can you reprogram it? Do you have extra port pins available?

What is the goal of "filtering" the squarewave? Is it just to make it sound more pleasing to the ear? How pure? What is the range of the frequencies (lowest to highest) of the tones?
The source is indeed a microprocessor (Arduino), and the goal is to play a melody using the high frequency output pins. So I think I would need something in the range of 2-15kHz. And indeed, I'm afraid that a pure square wave would sound a bit unpleasant to the ear... I haven't tried it yet though.
 

MikeML

Joined Oct 2, 2009
5,444
The source is indeed a microprocessor (Arduino), and the goal is to play a melody using the high frequency output pins. So I think I would need something in the range of 2-15kHz. And indeed, I'm afraid that a pure square wave would sound a bit unpleasant to the ear... I haven't tried it yet though.
Are you saying that the melody will be never have a tone less than 2kHz? This is going to sound like the little singing birthday cards that play "happy birthday" when you open them...

You left a lot of my questions unanswered...
 

Thread Starter

davyvr

Joined Jul 27, 2015
6
Are you saying that the melody will be never have a tone less than 2kHz? This is going to sound like the little singing birthday cards that play "happy birthday" when you open them...

You left a lot of my questions unanswered...
I thought that it would be enough, maybe I need to go down to 1kHz, I'm not sure of this yet.

I cannot reprogram the microprocessor but I have several pins available if needed (I think 8 must be possible).

The link you showed me creates a MIDI signal but this is not really what I need. I want to drive an 8ohm speaker directly.
 

MikeML

Joined Oct 2, 2009
5,444
I thought that it would be enough, maybe I need to go down to 1kHz, I'm not sure of this yet.

I cannot reprogram the microprocessor but I have several pins available if needed (I think 8 must be possible).

The link you showed me creates a MIDI signal but this is not really what I need. I want to drive an 8ohm speaker directly.
You want to build your own MIDI system.
 

AnalogKid

Joined Aug 1, 2013
11,042
There are a zillion small audio amplifiers available on ebay for cheap. If building one from scratch is part of the fun, we can help with that. but if you just want a working output for your speaker, go ebay. Look for ones using the LM386 chip.

ak
 

Thread Starter

davyvr

Joined Jul 27, 2015
6
If you can't reprogram it then how will you get it to generate the sound you want? :confused:
Sorry, perhaps a wrong expression. I thought the question was if I can reprogram the way the outputs are controlled or what their output voltage is or .... I can only program when the pins go up or down and with which frequency they do this, so I can't change anything really to the conditions I stated in my first post.
 

Thread Starter

davyvr

Joined Jul 27, 2015
6
There are a zillion small audio amplifiers available on ebay for cheap. If building one from scratch is part of the fun, we can help with that. but if you just want a working output for your speaker, go ebay. Look for ones using the LM386 chip.

ak
My problem is that I have 0 - 5V signal at input, which is too much for all such chips, but indeed, I decided to just try an LM384 with a voltage divider at the input. Problem is that I tried to simulate this and that it didn't work (in LTSpice) because of the fact that my signal is not fluctuating around 0V but around 0.25V (0 - 0.5V if I divide by 10). On the other hand, I don't have a model of the LM384 so I used an opamp model, perhaps not the best simulation. I'll just try it with figure 13 out of the LM384 datasheet. Anyone has any considerations about this setup?

Another thing I decided to try (I didn't know they existed before, someone tipped me on this) is an UM3482 melody generator chip. Hard to find, I had to go to Alibaba, but nevertheless I ordered some. It might be the easiest solution. Again, if anyone has any experience / considerations, please share this. :)
 

AnalogKid

Joined Aug 1, 2013
11,042
The LM3xx series of audio power amplifiers are not like other opamps. Eventhough they run on a single power supply instead of two, then handle inputs that go above and below ground if you add an input coupling capacitor. Most small audio amp assemblies have both input and output coupling capacitors and a gain control, so they can handle the signal you describe in post #1 with a 9 V power source. 12 V would be better, but 9 V sould get there. The LM386 datasheet has lots of applications information explaining how it works.
ak
 
Top