Shop OBEX P1 Docs P2 Docs Learn Events
How to tame the screech — Parallax Forums

How to tame the screech

HollyMinkowskiHollyMinkowski Posts: 1,398
edited 2011-05-05 10:29 in General Discussion
I have a really simple project that uses a pretty limited
uC. I don't have any code space left and I don't want to
rewrite the thing but I am driving a small speaker from
a single pin to create a simple audio alarm signal with
different beeping patterns as a telltale. I'm using a 3904
as a cheap amplifier of the square wave pulse signal.

The screeching square wave tone sounds just awful! It really
sets your teeth on edge :-(

Is there some simple way I can at least smooth out that
square wave signal a bit to make it less painful? If it could
sound just a bit more like a nice pure sine wave that would be
sweet.

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-05-04 15:38
    You can add a lowpass filter either before, or as part of, the transistor amplifier. For examples see:

    -Phil
  • Bob Lawrence (VE1RLL)Bob Lawrence (VE1RLL) Posts: 1,720
    edited 2011-05-04 15:44
    Add a filter. With a passive one you would loose some gain. You could add an op-amp and design an active filter with this TI Active Filter design software: http://focus.ti.com/docs/toolsw/folders/print/filterpro.html

  • HollyMinkowskiHollyMinkowski Posts: 1,398
    edited 2011-05-04 16:34
    Thanks guys, I will try to construct and add a filter and see what happens :-)

    Hmmm, I was just thinking about how simply adding a capacitor across the
    output of a power supply smooths out the ripple... I wonder if that would take
    a bit of the edge off this screeching tone generator of mine. Seems like it
    might also lower the volume too though, when I get back to where my workbench
    is I will try these things out.

    I'm stuck here in a hot room arguing with fools for a day or two, someone rescue me ;-)
    The drone of my hot air station blowing would be a welcome relief from these guys...and
    it's breath would be sweeter too..LoL
  • Mike GreenMike Green Posts: 23,101
    edited 2011-05-04 16:42
    A power supply filter capacitor is just a low pass filter with the internal resistance of the transformer and rectifier providing the resistance. Try a variety of values just for fun and see what audible results you get. Remember that a small speaker will have poor low frequency response and will emphasize the undesirable higher frequencies, so you'll need a lower cut-off and faster roll-off than you would need with a larger speaker with a broader response.
  • HollyMinkowskiHollyMinkowski Posts: 1,398
    edited 2011-05-04 16:56
    Can't wait to try the simple filters out.
    The speaker I'm using is a real small one that was probably
    designed for a kids toy of some sort. It has a white plastic
    cone and a really tinny high pitch sound. (they were cheap, what can I say :-)

    Maybe changing the frequency of the pulses and the addition
    of a simple filter can combine to find audio goodness.

    No idea why I didn't think of just trying a freq change to see what that
    would do. I'm at 700/sec now...perhaps 300-500 would be kinder to the
    ears.
  • Spiral_72Spiral_72 Posts: 791
    edited 2011-05-04 19:23
    If you use a resistor and cap, it'll round the corners of the square wave nicely.... then another cap to filter DC and you should have a crude sine wave with big fat peaks and a high slope on the EDIT[ zero crossing] transition.

    It'll make a more pleasant tone and it don't look too bad on an o-scope either.
  • HollyMinkowskiHollyMinkowski Posts: 1,398
    edited 2011-05-04 21:51
    Spiral, thanks..I will try that and see what it looks like on a scope too.

    BTW, whenever I look at your avatar I always blink when the mean little stick man
    pokes the unlucky little stick man ..LoL
    :-)
  • Spiral_72Spiral_72 Posts: 791
    edited 2011-05-05 10:29
    Also, Jameco and the like has beepers with a built in oscillator at varying frequencies. I think you're stuck with one frequency though. I might recall beepers for dual-tone, but you'll have to check. That's too easy though :)
Sign In or Register to comment.