Go Down

Topic: Help understanding the difference in approahces in these audio/amp schematics? (Read 8438 times) previous topic - next topic

xl97

Hey gang..

In an effort to understand.. and not just 'follow' a schematic..

I have a question between these two 'amp' layouts.. (its a 2-parter!)    :D




and here is another diagram/schematic I have of an LM386 amp being used in audio output..etc  (this is a PIC based project though, no DAC I believe it was direct PWM output from pin)... not sure if that matters though for this question??



I see some differences...

1.) There is an area on my schematic where pins 4 & 5 are connected by resistor (R7) & a cap (C15)..but this is NOT on the PIC based schematic..  Im not sure of its 'use'...

(which is part of the schematic/questions I had help on)




thanks!!   :)


Grumpy_Mike

Well the first circuit has a fixed volume control at half the output.
Also it also has a low pass filter on the output, often used for stability.

Both have a low pas filter on the front end.

Quote
I believe this is help dial in the filter/range for the audio

No it is just volume. That might explain the difference in quality you might be experiencing.

CrossRoads

The 2 circuits are the same, the arduino design has extra filter on the LM386 output, you can leave it off and see how it affects performance.
LM486 pin 4 connects to Gnd, it is just covered by the text next to it.
Wire in the pot as discussed for volume adjustment.
If you can then remove it without changing anything, you can measure from 1 leg to wiper, and the other leg to wiper, for values to use at R5/R6.
Or just leave the pot there with some hot glue to hold its settings.

Using this RC filter calculator
http://sim.okawa-denshi.jp/en/CRlowkeisan.htm
The 2nd design has a cutoff of 1.59KHz, so it will sound muddy.
The 1st design has a cutoff of 318 Hz, so will sound really muddy.
As mentioned, solder a 100 ohm resistor across R8 to lower that resistance to 98 ohm (R = 100*5000/(100+5000) = 98),
raising the bandwidth cutoff to 16.2KHz.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

xl97

Hey guys-

ok.. I'll get to stacking that smd resistor tonight... (maybe I'll just try to replace it for a 100ohm instead of stacking, which would give me: 15915.4943092[Hz]/15.9[Khz])


Id like to understand (in an easy fashion that I can understand...hahaha) more about the Khz cut-off..etc....

and what target ranges should be..etc.

I see how you got the values from both designs using the calc/link, but would also like to learn/read on knowing that 16.2Khz range would be best...etc..

sound/audio is a whole new world to me.. so learning a bit more about cut-off ranges would be helpful... going higher does what.. going lower does this..etc..  (just a basic overview?)

getting back to the project (board) at hand though..


Thanks





CrossRoads

Experiment!
Human hearing is limited to 20KHz.
Telephone quality has been typically 4 KHz.
Find a happy range in the middle.
You can play with R8 as you described using 1 and leg and the wiper, leaving the other disconnected.
You can change C18.
Plug the values into the calculator, see what makes sense.  There is more than 1 way to arrive at the same cutoff frequency.
For example, 100 ohm/100nF yields
Cut-off frequency
    fc = 15915.4943092[Hz]

as does 500 ohm/20nF
Cut-off frequency
    fc = 15915.4943092[Hz]

as does 5000 ohn/2000pF

What parts do you have on hand to test with?

The cutoff frequency with this filter is the place where that frequency will be 1/2 what it was with no filter (or, 3dB (decibals)down).


You can also use the bottom calculator on the page, plug in the cutoff frequency with a known capacitor, let it solve for the resistor.
For example, 100nF, 12KHz => 130 ohm.

Use 1K pot, should get you down to 1.6K at one extreme, and 15.9K as you get down to 100 ohm, to effectively unfiltered as you go lower.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

xl97

ok.. so maybe I'll just try a pot tonight instead.. and that way I can 'experiment' on what sounds good/best..

also sounds like I really dont have to change out C18 at all.. and plying with R8 is enough to give me any range Id need.

*good to know I can leave the other leg on the pot floating.*  I'll use a 1k pot tonight as suggested.

When you say hearing is limited to 20khz?.. do you mean we cant hear above that?

Telephone quality is 4Khz? (can you expand on this? it can pick up as low 4Khz stuff?)



I have a lot of parts to play with..(in some fashion or another). caps/resistors/pots..odds & ends..etc   I have been slowly buying 'kits' of components with a variety of values/sizes/ranges..etc


thanks!

CrossRoads

From Wikipedia:
"Humans
An audiogram showing typical slight hearing variation.In a human, sound waves funnel into the ear via the external ear canal and hit the eardrum (tympanic membrane). Consequently the compression and rarefaction of the wave set this thin membrane in motion, causing the middle ear bones (the ossicles; malleus, incus and stapes) to move. The number of sound pressure level vibrations (sonic waves) per second denotes the frequency. Infrasonic (below hearing), sonic (aural), and ultrasonic (above hearing) frequencies are measured in Hertz (Hz); one Hertz is one cycle wave (or singular pressure wave in audionics) per second.

>>  Specifically, humans have a maximum aural range that begins as low as 12 Hz under ideal laboratory conditions,[3] to 20,000 Hz in most children and some adults, but the range shrinks during life, usually beginning at around the age of 8 with the higher frequencies fading.<<

Inaudible sound waves can be detected (felt) by humans through physical body vibration in the range of 4 to 16 Hz. There is a difference in sensitivity of hearing between the sexes, with women typically having a higher sensitivity to higher frequencies than men.[4] The vibrations of the ossicular chain displace the basilar fluid in the cochlea, causing the hairs within it, called Stereocilia, to vibrate. Hairs line the cochlea from base to apex, and the part stimulated and the intensity of stimulation gives an indication of the nature of the sound. Information gathered from the hair cells is sent via the auditory nerve for processing in the brain."

"Commercial bandwidth is a term for the regular capacity of the telephone network required for intelligible speech. It was defined as 300 hertz to 3,400 hertz, although the modern PSTN is theoretically capable of transmitting from 0 Hz to 7,000 Hz using ISDN[1]."
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

laserguy

Well, I think I see what may be a problem with your circuit!

You've got the VRef input (pin 4) on the MCP4921 tied (via R9) to 5V.  On this device, that is going to result in virtually rail-to-rail output, so about 5V peak-to-peak.

Compare that to a typical "Line Input" signal of what, less than half a volt peak-to-peak?  So more than 10x a typical audio signal?

You are then inputting that into your LM386 amp, which is only running at 5V (compared to 9V on that other schematic).  That chip is spec'd to provide a voltage amplification of between 20x and 200x (configured with pins 1 & 8 disconnected like you have it, I believe the voltage gain is auto set to 20x). But with a supply voltage of only 5V, that chip is incapable of even outputting 5V peak-to-peak, let alone amplifying beyond it!

Does it sound REAL LOUD and distorted?

I believe the problem may be the DAC over-driving the input of the LM386, causing clipping and thus severely distorting your audio signal!

The solution is simple - leave R9 in place, but add a 4.7K - 8.2K resistor (optimum value depending on output load you are placing on LM386, see below) between VRef (pin 4 on the DAC) and GND.  This will lower VRef to between about 0.225V to 0.379V.

Given that you are running the LM386 on only 5V, that is still perhaps around twice what we need.  But R5 & R6 in your circuit form a voltage divider that then nicely divides that signal for you by 2!

But before I get to calculating that resistor's value, some programming notes on the MCP4921, that could also be contributing to the problem -

If you are running VRef at 5V, you cannot use Buffered Mode, as this requires that VRef be less than Vdd.

If you are running a VRef > 2.5V, then the NOT GA Gain Select Bit (bit 13) must be set to 1 (Gain=1x).  Otherwise, the internal op-amp will attempt to amplify the signal beyond 5V, causing clipping/distortion inside the DAC chip itself! (Even when running the DAC with the extra resistor, you still want to have this bit set to 1, else the output voltage doubles!)

Are you remembering to set that bit when you write to the DAC? (Combined with the NOT SHDN bit, I think you might be able to do this simply by OR'ing the desired DAC (word) value with 0x300000)

Anyways, for maximum volume without distortion, the best resistor value to place between VRef (pin 4 on the DAC) & GND, depends on what kind of load you are putting on the output of the LM386.  With only a 5V supply to the device, looking at the max. output voltage swing here (top-right chart on pg 5) -

http://www.ti.com/lit/ds/symlink/lm386.pdf

Magnifying that rough graph, @Vs = 5V, depending on the load you place on the output, it looks like you get a maximum peak-to-peak output of between ~2.5V (for driving say a 4 ohm speaker), ~3.15V (for 8 ohm load), ~3.4V (for 16 ohm load), up to a max. of ~3.8V (for RLoad = infinity).

In order to avoid clipping distortion, I would think you would want to keep the amplified signal below that maximum output voltage swing!

So, if you put a 4.7K resistor between VRef and GND, you would get a VRef = ((4.7K/(100K+4.7K))*5V) = ~0.225V, with a gain of 10x (20x/2), resulting in ~2.25V peak-to-peak output by the LM358 amp.

If you instead used an 8.2K resistor, you would get VRef = 0.379V, x10 gain = ~3.8V peak-to-peak output.

(You may also get a little signal loss from your low-pass filter, so YMMV, you may need to tweak the value a bit)

So, lower values for that resistor will reduce the output of the DAC, while higher values will increase the output, but may result in clipping distortion.

If you just want to drive a 4 or 8 ohm speaker, try a 4.7K or 5.1K, and see how that works!  For an 8 ohm speaker, if you want more volume, you can also try a 5.6K, 6.1K or 6.8K.

You may also want to try experimenting with just temporarily putting a 10K pot between VRef & GND, adjusting it to get the volume & sound quality you are happy with, then disconnect it, measure the resistance, and find the closest fixed resistor to use in it's place!

Another alternative option would be to increase the value of R5 to between around 130K and 220K (In this case, high resistance = lower output, and lower value = increased output, but greater chance of distortion).  But I think it would be better quality-wise to add the resistor on VRef instead.

And don't forget to set bit 13 when you output to the DAC!

xl97

WOW!..  thanks for the reply.. (Im going to have to read it over a few times!)  most was over my head!

I am using the Default WaveHC library currently for software.. and playing .wav files so I can tweak the 'results'.


I also have a 1k pot in place of R8 currently.. (1 leg floating)...

and a 100k pot in place of R5 & R6  (as shown above)..


yes originally it was LOUD & DISTORTED.. but is better with the POTS there to adjust...

nice first post.  ;)

CrossRoads

I would be under the impression the library takes care of Reference at 5V as that's what the shield the design is based on does.
http://www.ladyada.net/images/wavshield/v11/wave11schem.png
The only difference here is the choice of lowpass filter components.
Using a pot to tone down the output to overcome the gain of the LM386, brought in to provide power drive for a speaker, should do the trick.
Once the ratio needed is determined, and 100K/5K should be close, then R5/R6 can be replaced with fixed values.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

xl97

soooooo......??


continue along the path I am current going?


using 2 x pots..


1 that replaced the R8 component... (1K pot)  (pot label has 102 on it)

1 that replaced R5 & R6 components..(100k pot)  (pot label has 104 on it)


or is there issue/aspect that needs to be addressed??  (or should be?)


I was even thinking that a future board could/would be revised to have two SMD pots in place where those resistors are at now...  (kinda leaves the board 'adjustable' (so to speak)..)






CrossRoads

Putting on 2 pots could impact the really small size you were after tho.

Does look like you can get them pretty small for not very much.
http://www.digikey.com/product-detail/en/TC33X-2-104E/TC33X-104ECT-ND/612912
Doubt these are intended to be adjusted by users constantly.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

xl97

Yeah your right.. might be able to squeeze one in at the R5/R6 pads... but getting one in at the R8 pads would be difficult..

I know they arent supposed to be trimmed all the time.. (maybe just adjusted for the speaker used...some offer better base..etc)

either way that was a thought for future revisions..

I still have boards and parts here.. (and a current stencil paid for) that I need to use!  lol

So the above post?...  I dont need to do anything as suggested? or is there something in there I should be addressing?

otherwise.. at this point.. I just adjust my pots until it 'sounds' good/right to me..// then remove the pot.. meter them.. (need to read up on that process)..

and use a suitable/close resistor replacement for the values I get.....correct?

its seems the pot on R8 is turned alot to one side.. (maybe even full turn?) for it get the range of hi's in there..

At this point.. Im MUCH happier with the pots in there.. and can dial in some better sound.. than the original static values. ;)


CrossRoads

Glad its working out.
To 'meter' the pots:
Measure the R8 pot across the 2 leads you used.
Measure the R5/R6: from the leg on the R5 pad to the wiper; from the leg on R6 to the wiper.

If you need more resistance at R8, you can put a fixed resistor in series, say 56K if you have a 100K pot, then you can tweak the 100K  up some more.
If the 100K is too high, out a 100K resistor in series with the leg & wiper, then measure the combination of the 2 in series when done.

Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Go Up