Shop OBEX P1 Docs P2 Docs Learn Events
Sound Question — Parallax Forums

Sound Question

HumanoidoHumanoido Posts: 5,770
edited 2009-05-20 20:08 in Accessories
What is the best and most simple way to:
1) get a better sine wave from a piezo speaker?
2) can a Sound Pal help?

Comments

  • FranklinFranklin Posts: 4,747
    edited 2009-04-25 16:19
    Filtering and smoothing are what you want to do to the input.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • LeonLeon Posts: 7,620
    edited 2009-04-27 18:27
    If you put a sine wave into a piezo speaker, it should generate something like it. What are you getting out of it?

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-04-27 21:49
    humanoido,

    2) The SoundPAL drives its speaker with square waves.

    Do you want to be able to control the pitch? If so, with a micro, with a potentiometer, or ...? If with a micro, which one?

    -Phil
  • HumanoidoHumanoido Posts: 5,770
    edited 2009-04-29 10:23
    I want to know if a better/cleaner wave form can be created. The project is to cancel out the waveform with another equal but opposite wave using two piezos and software. So far there are some residuals that must be eliminated.

    I was trying to get pure sine waves, but I like the idea of using two square waves instead to accomplish this if the two piezos put out similar waves. This would all be under software control to set the pitch/vary frequency. The piezos are on a basic stamp, each on a pin.

    Is there a database of pbasic sound programs that create various waveforms? If not, what is the cleanest and most stable method for programming sine and square waves using piezo speakers?

    Is it better to use two soundpals to accomplish this?

    humanoido
  • LeonLeon Posts: 7,620
    edited 2009-04-29 11:10
    Try putting the square waves through a low-pass filter.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • ElectricAyeElectricAye Posts: 4,561
    edited 2009-04-29 15:27
    Bear in mind that any point source of vibration is going to generate a field of interference patterns all around it whose shapes and intensities are affected by whatever its waves might be reflecting off of. You might be able to achieve a localized region where two opposing waves might destructively interfere, etc, but generally speaking you might also get standing waves, etc. from reflections of all sorts. Even the piezo itself is likely to radiate with a pattern of interferences generated by reflections from its mount, etc. Trying to eliminate all residuals through software might be impossible. You might need to add some sound absorbers here and there.

    cheers,
    Mark
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-04-29 15:29
    The waveforms emitted by the Stamp's FREQOUT command are actually duty-mode (similar to PWM) sine waves. When filtered through a simple RC network, the waveforms will be sinewaves. Because the SoundPAL uses an RC timebase for its frequency-generating micro, no two will produce exatly the same frequencies, so you would have a problem trying to get them to cancel.

    -Phil
  • HumanoidoHumanoido Posts: 5,770
    edited 2009-05-03 13:36
    Phil said...
    Because the SoundPAL uses an RC timebase for its frequency-generating micro, no two will produce exatly the same frequencies, so you would have a problem trying to get them to cancel.
    We used trimmer capacitors in the past to adjust the capacitance, much like adjusting the resistance using a variable potentiometer. Why not use a variable pot and a trimmer capacitor for the RC circuit and calibrate it to match the second RC circuit? (since resistors are 5 to 10 percent in error and capacitors are 20%)

    humanoido
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-05-03 15:50
    The RC circuit is built into the micro. There's no way to access it.

    -Phil
  • HumanoidoHumanoido Posts: 5,770
    edited 2009-05-06 02:40
    How about doing an incremental tweak of frequency using just the software?

    humanoido
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-05-06 03:53
    The SoundPAL firmware provides a frequency resolution of one semitone, which is too coarse for tuning one to another without a high probability of dissonance. Of course, if you buy enough of them, you will probably find two that match closely enough. smile.gif

    -Phil
  • HumanoidoHumanoido Posts: 5,770
    edited 2009-05-15 08:09
    re: SoundPal

    Thanks Phil, ok, that's one idea to get two within range,
    but those things are really loud even after removing the cone.
    Is there a way to turn down the volume using software?

    I read where a voltage increase will flex the piezo with more
    force resulting in greater amplitude and louder volume.
    How about reducing the voltage to decrease volume?

    humanoido

    Post Edited (humanoido) : 5/15/2009 8:16:24 AM GMT
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-05-15 08:29
    You can run them at 3.3V for lower volume. A piece of tape over the hole will probably work even better. BTW, the speaker is electromagnetic, not piezo.

    -Phil
  • HumanoidoHumanoido Posts: 5,770
    edited 2009-05-15 19:42
    Thanks Phil,
    This indicates a software program can control the volume
    which is exactly what this project needs. A piece of tape
    will work fine. Also, it's very useful to move the volume up
    or down, depending on requirements. How did you know
    the speaker was electromagnetic and not piezo?
    humanoido
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-05-15 20:27
    humanoido said...
    This indicates a software program can control the volume which is exactly what this project needs.
    No, not really, unless you can control the supply voltage with software. Even then, below a certain level, the onboard AVR will experience brownout and quit. Moreover, its I/O level will not be adequate to produce a logic "high" for the BASIC Stamp from its built-in pull-up.
    humanoido said...
    How did you know the speaker was electromagnetic and not piezo?
    It's what I specified when I did the design. A piezo that small would not be loud enough.

    -Phil
  • HumanoidoHumanoido Posts: 5,770
    edited 2009-05-20 20:08
    I see. It works a bit different from a Piezo speaker
    since its already interfaced to the Tiny processor and
    the stamp is just sending serial commands. I have
    noted the system has not avoided the effects of some
    frequencies being louder than others, which is the
    basis of the Virtual Volume Control code for Penguin
    Robot.

    humanoido
Sign In or Register to comment.