Go Down

Topic: General question(s) about 'dirty' lines & isolation (Read 2065 times) previous topic - next topic

xl97

Hey group...

I have a question about what I believe is dirty/noisy lines.. and how one goes about isolating things to get rid of noise..etc


Im not sure how much of this is a 'timer' issue and how much is 'noise/interference'.. so I'll explain whats happening...and be educated. :)

I have a custom board, more or less a tiny (all smd) Arduino/Waveshield merged board.. (runs all WaveHC sketches..etc..etc.....& functions just like WaveShield)

I am experimenting with code some code and attempting to learn more about the FSM (Finite State Machine) type approach to doing multiple things at once in your code.. (instead of do one thing now.. wait till done.. do next thing..etc)..sorta like an advanced blinkWithoutDelay in my mind..

anyways...

what I  was (am) attempting to do was play a simple audio file, in continuous loop (seamless/gapless playback).. and PWM fade an LED up & down, all without skipping a beat.
I believe I have accomplished that, but am having some 'issues'.. both with performance and quality.


1.) I understand the WaveHC/Waveshield uses Timer1 for its audio playback capabilities..  (I think I was told that means now PWM on pin9 now?)  <--- but I have read other posts/comments about other PWM pins and timer issues..in conjunction with the WaveHC/Shield..


So this might be a reason for some of the problem(s)?

I play my audio file in a loop.. and I test using pin 3, 5 or 6...

pin3 makes the fade look insanly choppy..and blinky.  More like a 'sputter'..in random intervals..(no rhyme or reason)

pin 5 fade IN perfect.. but fades OUT choppy..sputtering, but in a pattern..and eventually fades out..and then again, fades in smooth.

pin 6 fades IN & OUT perfect.. but I hear this 'whine' in the speaker from the audio output now..??


So I guess Im looking for some discussion from the more experienced members here??

Anyone play with the WaveShield and experience this stuff? (could just be hardware on my custom board..and WaveShield itself does NOT behave like this)..

Anyone have some good links/tuts (for a beginner like myself) to read up on isolation and clean signals for audio/pwm?

Thanks guys..  :)






oric_dan

Sounds to me like the following info may be of use,

http://en.wikipedia.org/wiki/Sampling_frequency

http://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem

http://en.wikipedia.org/wiki/Nyquist_frequency

http://en.wikipedia.org/wiki/Anti-aliasing_filter

http://en.wikipedia.org/wiki/Reconstruction_filter

http://en.wikipedia.org/wiki/Digital_signal_processing


Docedison

That and some better power supply bypassing... The Bypassing would be the faster of the two methods and likely less expensive too.

Bob
--> WA7EMS <--
"The solution of every problem is another problem." -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

xl97

Thanks..

I guess I dont understand the links??  (maybe just missing the connection?)  :)

I have filtering....and the audio play back is fine.. there is just some noise somewhere..  (that and the Timer issues too?)

here is the schematic of my DAC/AMP..etc..




thanks


dhenry



Nantonos


The design around the opamp is all wrong.


There is a 'because' missing from your sentence, assuming you intended it to be helpful.

xl97

Im just trying to get a better understanding.. (a true understanding)..  :)   

instead of relying on others, and/or just copying/pasting/merging portions of different schematics.. until tings work out. :)


Im not as advanced as many of you here.. so links that talk about higher level approaches/works/theories doesnt give me the foundation to make those articles useful yet..


As far as "all wrong"..... as in, your saying it wont work?

Well it woks.. this is a 'done' project.. pcb's ordered, stencil ordered.. and a few boards even made already..

WaveHC sketches all seem to work/play..etc..

its just now that I am expanding on its uses, I am finding other things that I wanted to address.. such as the NOISE....(I think thats correct to call it?)

-AND-

(not that this is really a hardware problem.. but the use of the TIMER by the WaveHC lib/WaveShield for audio playback and its effect(s) on other PWM pins....etc)

I dont want to fight.. I am hoping someone who has been down this road before can share their ideas and have a nice, friendly discussion on it..  thats all.

:)






oric_dan

#8
Nov 16, 2012, 06:52 pm Last Edit: Nov 16, 2012, 07:03 pm by oric_dan(333) Reason: 1
Quote
I guess I dont understand the links??  (maybe just missing the connection?)


You said audio sampling, and a major source of "noise" and distortion is actually related to sampling
issues, and proper anti-aliasing filtering, and not simply noise in the electronics. It takes a fair amount
of digging to understand all that, but after all, if you're gonna play with sampled systems, you should
get into the theory too.

Quote
The design around the opamp is all wrong.


Jeesh, it's an LM386 integrated audio amp, and NOT an opAmp, and the ckt looks about right [although
I didn't check the d/s myself]. Actually, those amps tend to be a little noisy when operated in digital
systems.

BTW, I think C18 should be 0.01uF [10 nF] and not 100nF, which gives a low-pass frequency at approx
318 hz. C18 = 10nF will move it up to 3180 hz.

xl97

(I said audio sampling?)..

I dont even 'try' to mess with whats 'under the hood' as far the BASE WaveHC code.. that applies to the SD/Audio sampling (DAC communication..etc)..

I just trust that someone (much) more smarter than myself did things correctly? (and since its been out for a LONG time.. others would have noted/fixed the lib?)

I agree.. I need to understand it all.. I just need steps at a time..
reading some of the stuff was just over my head.. I need a better/easier foundation to build on I think

Thanks!

oric_dan

Quote
(I said audio sampling?)..


Looking back, you said 'timer issue', but anything involving a microprocessor and audio is about
sampling and antialiasing is always an issue. Poorly filtered signals are very noisy and horrendously
distorted. A .WAV file is a sampled signal stored in digital format.

xl97

got it...

so,..assuming the ode/sampling is all correct  (fat16lib wrote the library, so Im assuming its on the up and up..and pretty lean/mean code)

that leaves me back at 'hardware' related and doing more about the filtering...yes?


without causing a fight on the boards here.. I see the image/schematic posted really hasnt been commented on.. on how to apply (or change) for a fix? better filtering..etc..

I hear its 'all wrong'.. but how?  is it really even wrong??

I thought I had filtering both before and after?..

thanks!  :)


oric_dan

Quote
BTW, I think C18 should be 0.01uF [10 nF] and not 100nF, which gives a low-pass frequency at approx
318 hz. C18 = 10nF will move it up to 3180 hz.


I calculated that wrong before. I used only 5K in the computation. R equivalent should be more like
R = (5K || (5K+5K)) = 3.3K, so

F3db = 1/(2*pi*3.3K*100nF) = 477 hz
F3db = 1/(2*pi*3.3K*10nF) = 4770 hz

oric_dan

Quote
without causing a fight on the boards here.. I see the image/schematic posted really hasnt been commented on.. on how to apply (or change) for a fix? better filtering..etc..

I hear its 'all wrong'.. but how?  is it really even wrong??


As I said, Zeus got it wrong again. I don't know about the DAC specifically, but as I said, the LM386 ckt
looks hooked up ok [assuming it's per the datasheet which I haven't checked].

This all takes a bunch of playing around = hard to do long-distance. It may need some more bypass filtering,
plus larger electrolytics on the power supply. You might try a small value R [10 ohms] in series with the Vcc
line to L386, and then add a 47uF cap there.

But I think it's more likely an anti-aliasing problem, ie the relationship between the output data sampling rate
from the uC into the DAC and the cutoff frequency of the low-pass filter on the input to the LM386 [ie
R5,R6,R8,C18].

With such as a simple 1st-order low-pass filter like you have, the output data sampling rate must be many times
higher than the cutoff frequency of the low-pass, else you'll hear a lot of hash. Anti-aliasing filtering is a
profession in itself.

This is why I said you really need to learn something about the theory behind what you're trying to do.
You're getting a lot of highly-paid help here for free, after all.





xl97

hi--

sorry.. since the schematic was done.. I have since went in and updated/changed some values..

I put in a pot to dial in both the R8 value (then metered it.. and put in closest resistor)

I also did the same for both R5/R6.. used a pot.. till it volume was 'ok' to my ear.. then metered the pot..replaced with static resistors:

values used in board that was made:

R5 = (47k updated)
R6 = (4.7k updated)
R8 = (100 ohm updated)

Go Up