Go Down

Topic: Better understanding of filter/values for (best) audio output? (Read 5626 times) previous topic - next topic

xl97

I am making another stab at trying to understand low-pass filters/audio stuff....

instead of just following schematics, or copying other open source schematics or .brd file..etc....

I have blindly changed values while testing, but it was a true understanding...

I'd like to get a better understanding (IN LAYMEN TERMS) of if raising/lowering this resistor 'here'.. it does/effects this in the output..etc..

(not looking for long big equations or long articles on who invested what and how to calculate things... yet!) ;)

I have a project, SMD board, that I removed some of components and soldered in wires with female, dupont connectors on the other end...  so I can easily swap out components/values and test things out..



Here is a snippet of the schematic that applies to the DAC >> AMP >> SPEAKER outputn..

the components circles in RED and the components I can change for testing.. and what the current values I am testing with are..

the components in BLUE are another filter on the back-end...  but I havent messed with them ever.. (but can/will if it means getting the best audio I can from this project)


R5/R6 I have a POT wired in so I can dial to whatever.. then measure it and use hard valued resistors...

right now I am getting 'decent' audio.. its not bad...  but I 'feel' it could be better with a true understanding instead of randomly messing about.. :)


GOAL:

* best quality and volume I can achieve  (fought with volume, muted/muffled sounds, no lows, no highs)
* best filtering for external NOISE  (forward thinking about still being able to use my board to PWM leds..so filtering for outside/external noise from leds or something, heard through audio/speaker)

*NOTE: using hobby speakers, un-powered, 1-2watt / 8 Ohm speakers



(clean version)


xl97

bump..

and just talking it out I guess..

so.....


R8 & C18 = LOW PASS FILTER

C21 & R6 = HIGH PASS FILTER

(R5 is added in for volume control/setting)


what part is R7 & C15 playing in this schematic then?  another filter on the output..yes?  confused on how much IMPACT these have on the overall results/audio output?

same question for C17?  seems to be a coupling cap?  (I'll have to look up what PIN6 is on the LM386 amp datasheet off the top off my head I dont recall..:P )


talking to someone else, they mentioned: corner frequency  etc..

which I didnt understand though?


thanks for any advice/feddback/discussion.. :)



CrossRoads

Attach the schematics as .pngs or .jpgs, I can't see them as links or whatever you used.
(Reply, Additional Options, browse to your locally stored file).
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

sorry..

I used the IMG tags supplied by the tool bar..  (not sure why not working? maybe too big?)

anyways.. you are familiar with this schematic....

I just want to come back to it, finally, and work on understanding the filter stuff better..

as mentioned, I have fooled around with some of the values.. and have a decent sound out of it..

but with TRUE understanding, I think it can be better, already is better than stock Waveshield IMHO..


R8 & C18 = LOW PASS FILTER  - [blocks high freqs, allows lows through]

C21 & R6 = HIGH PASS FILTER - [blocks low freqs, allows highs through...also has R5 as voltage divider for volume..currently pot in place for testing, removed, and metered values]


regurgitating info elsewhere..

corner frequency (f=1/(2*pi*R*C)

not sure HOW to add int eh values fr R & C though?

was told I get 1.59khz which is kaka.. less than phone with is 3.4khz..etc.

(most of the equation and corner freq stuff went over my head...whoosh)  haha..

my goal here is improve this for sound quality and better/best PWM noise blocking as I can get

(some other suggestions on the PWM noise was to run PWM at diff freq, but not sure how that is even approached... one step at a time I guess) :)



discussion, probably totally wrong.. but.


ok.. so for LOW PASS FILTER:  R8 & C18

R8: is I INCREASE value of the resistor. it cuts of the HIGHER freq the higher I go in R value...correct?
what purpose/function does the CAP play then?  going lower/higher?

Is there a rule/relationship between R8 & C21 values?  (ie: the higher R8 is the lower C21 should be? or vice versa?)


Not sure if R7, C15 & C17 even have a part in all this?  and should be equally changed out, tweaked for best/better performance?


thanks!

CrossRoads

(not working because whatever they were is blocked for me)

R8/C18 are low pass filter to block high frequency switching noise from the DAC output.

C21 lets 0-5V signal settle at the level set by R5/R6. You could make it bigger so it lets more signal thru, like a 10uF, 47uF.
R5/R6 are a voltage divider  to  bring the signal level down so the gain of 20 in the LM386 does not create a clipped signal.
C15/R7 provide LM386 gain stability or something like that per its datasheet.

If you want better sound quality, you can try making a 2nd order lowpass filter vs 1st order, and increasing the DAC loading frequency. (its not PWM)
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

thanks Crossroads-

I'll try a higher C21 value

I still have some of the questions from the previous post..  :)
Quote

R8: if I INCREASE value of the resistor. it cuts of the HIGHER freq, the higher I go in R value...correct?
what purpose/function does the CAP play then?  going lower/higher?


I understand that R8 and C18 are the 'low pass filter', trying to grasp the purpose/function of each part in that combo..

values:
low R / low C
low R / high C
high R / high C
etc..etc..


Also what do you mean by this:

Quote

...You could make it bigger so it lets more signal thru...


do you mean as in more 'volume'?


(maybe Im getting to old for this?  LOL..  I have such a hard time with audio and DAC's & amp's..etc)

as usual, your experience is appreciated..

thanks!





CrossRoads

Yes, bigger, more signal.  At that point not much current is flowing, so it may not make much dfference.
R8/C18 make the low pass filter.
http://sim.okawa-denshi.jp/en/CRlowkeisan.htm
The resister limits the amount of current that can charge up the cap when voltage is rising, the cap discharges as the voltage drops. The cutoff frequency is 1/(2*Pi*R*C) which is the frequency where the output will be 1/2 the input.

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

so if it playing 22k files.. I should be using/at 11k for the filter? (half?)   :smiley-eek-blue: :smiley-red:

I go the link...and use the calc...

putting the values I am using now  10k/10nF

I get this as result:

Cut-off frequency
fc = 1591.54943092[Hz]

but Im not sure what my target number is that Im shooting for?

do I divide that number or something,  its in Hz?

thanks...

MarkT

AFAICT the whole circuit around the opamps is an active filter, possibly a Sallen-Key or some such.

Alas there are no layman's terms for how such an active filter works, at the very least you
need to speak complex impedances and poles/zeroes.   Monkeying around with individual
resistor/capacitor values isn't very useful in such a circuit, you look up the component
values in a table and go with it.

[ for instance such active filters can resonate or even oscillate, something a filter made just from
R C elements cannot do ]

You _can_ change _all_ of the capacitors by the same ratio to move the cut-off frequency, ditto
the resistors.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

xl97

whooosh!...  haha..


thanks for the reply though..

I'll have to read it a few times.. to see if I can get some direction from it..

(not sure what kind of table you are referring to? that i can look up components and get values from?)


CrossRoads

First, there's no opamp - the LM386 is a selfcontained amplifier, the values connected around are to an AC signal in, to reduce the gain of the DAC, to set the LM386 gain at 20, and to stabilize the output per the LM386 datasheet.
The only filtering is the lowpass filter out of the DAC. The Ac coupling does induce some filtering.

If the DAC is being updated at 22K, then yes, filtering should be set to <=11KHz.
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

thanks..

yes.. the files are 22K audio files.

so using your link:  http://sim.okawa-denshi.jp/en/CRlowkeisan.htm

want to make sure Im doing this correct...

I entered in:  (current values)

10K (R8)    & 10nF (C18)

calculate...

I get this:

Cut-off frequency
fc = 1591.54943092[Hz]

to convert this to kHz..

I need to:
f(kHz) = f(Hz) / 1000

and I get this:  (1591.54943092 / 1000) =

1.59154943092  kHz

is that right???

that seems a FAR (far) cry from the 11kHz I am targeting....yes?


if I go DOWN on the R8..  it makes the value higher.. (but then Im letting in more high sounds..  especially @ under the 1k value (which is what I'll have to do/use)

I have input:

R8 = 1.4K
C18 = 20nF

Cut-off frequency
    fc = 11368.2102208[Hz]

which equals:  11.3682102208 kHz

correct so far?

still not fully understanding..

I dont want to be so LOW @ R8 that it lets in through high freq that make things have NOISE or junk through the speaker..

how do you know what value/threshold for R8 is TOO low to be of any value in the circuit?

(I think I had originally had 100 Ohm value in there..  didnt do any good/told hardly filtering anything out....etc)



I mean what would be the difference/better result..

R8 =  1.4K
C18 =  10nF

or

R8 =  2.8k
C18 =  5nF

both seem to give me the same Cut-off frequency:

fc = 11368.2102208[Hz]  (11.3682102208 kHz)


R8 lets the current into C18..

R8 lets low freq pass..while blocking hi freq based on value.. (higher the value the more hi freq it blocks)??

is there a 'rule of thumb' here?

ie: never used less than 1K for R.. as thats lower than any human can hear...etc??

or something?  lol


thanks!


MarkT


First, there's no opamp - the LM386 is a selfcontained amplifier, the values connected around are to an AC signal in, to reduce the gain of the DAC, to set the LM386 gain at 20, and to stabilize the output per the LM386 datasheet.


Ah, missed that ground signal (with no ground symbol...).  Not the clearest diagram in the world.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

CrossRoads

You are correct xl97 - up to you to decide if the sound quality is what you want.
Make yourself a simple excel spreadsheet to select different resistor values, find a frequency that satisfies your ear.

R8 =  1.4K
C18 =  10nF

or

R8 =  2.8k
C18 =  5nF

1/(2*Pi*R*C) , if you double R & half C, the math cancels out. So leave C alone at 10nF, play with R.
Use a 2K or a 5K trim pot, play with it till it sounds good, measure R and put in that value.
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

swapped C21 out for a 10uF cap... (you were probably right.. as I didnt notice any? difference)

I left C18 alone at 10nF

adjusted R8 from:

10K
4.7K
3.3K
2.2K
1K

and played some .wav files..

I didnt notice much difference between the 3.3K and the 1K really..

however the audio is MUCH better, loud a bit more range/tone.. than when using the 10k!


I guess I'll stick to those values for now..

couple things Id like to ask/discuss.... not sure if this sort of stuff can be solved by simple value switching on some components already in place...

1.) I can 'hear' the speaker when it powers on.. a 'click' (per se`) when the board is powered..
2.) when no audio is being played.. I can 'hear' that the speaker has power.. normal?  its not too loud where I can hear from far out..
3.) I have -not- tried to PWM any leds while playing any audio files.. previously.. I could HEAR the the 'stepping/fading' of the PWM through the speaker.. as noise/static/squealing/whining..etc..
(best I can describe it)

I have heard about 'using a diff freq to PWM at, as a solution (but no clue how practical that is or how to go about it anyways)
I have been told 'need to separate' the analog and digital lines...etc..  (but not exactly clear on that one either..  make sure any coupling caps on the along pins.. dont couple to gnd along with any digital pins?)  that must be for when getting NEW pcb's though?  not a fix for current ones..etc........right?

thanks!






Go Up