What I need must be such a common thing, that I thought I'd ask the PIC
list's assembled wisdom before I set out to possibly re-invent the wheel.
I'm using a 16C84 for an alarm controller, and I'd like to use the PIC to
also generate a "siren" waveform (to be externally amplifed), rather than
build that function in separate hardware.
The other approach to keep cost low would be to use a dedicated "siren
sound" IC, but I haven't found a commercial one yet. I do know that they
exist as tiny COB (chip on board) modules in cheapo personal alarms, but
does anyone know of any sources for them... Digikey lists some COB modules
that generate melodies such as "happy birthday" etc, but can't supply one
for a siren sound.
Basically, what the siren waveform needs to be is as follows:
1. a frequency modulated square wave output, (ie: *not* being amplitude
modulated, should make it easier to do)
2. output waveform is centered on 3 kHz.
3. waveform should sweep back and forth between say 2500 and 3500 Hz, at a
rate of 15 Hz or so.
A routine with settable parameters for the frequency deviation (sweep) and
sweep rate would be ideal, to optmize the "effectiveness" of the sound
produced ... the trick is to resonate with the output transducer. Of
course, armed with the basic routine, I could (and would) add the settable
parameters.
Many thanks in advance for any help that may come forth.
....Gregg
On Wed, 9 Oct 1996, Gregg Kricorissian wrote:
[...]
> Basically, what the siren waveform needs to be is as follows:
>
> 1. a frequency modulated square wave output, (ie: *not* being amplitude
> modulated, should make it easier to do)
>
> 2. output waveform is centered on 3 kHz.
>
> 3. waveform should sweep back and forth between say 2500 and 3500 Hz, at a
> rate of 15 Hz or so.
>
> A routine with settable parameters for the frequency deviation (sweep) and
> sweep rate would be ideal, to optmize the "effectiveness" of the sound
> produced ... the trick is to resonate with the output transducer. Of
> course, armed with the basic routine, I could (and would) add the settable
> parameters.
I should think (since it sounds like you're using a piezo transducer)
that the more 'European' alarm (Hi-Lo frequency switching rather than
sweeping) would be better... That way you can target two "sweet spots"
in the audio band where the transducer will give you the best output.
Coding it is even *easier*, since it's just two toggle-loops nested
in an overall hi-lo switching loop...
Something important to remember though is that you don't want to
leave a DC bias sitting on the piezo! Either drive it through
a capacitive coupling or make sure you set both sides to the same
potential before going on to do other things.
My "Frosty the Snowman" code will do exactly what you want (although I don't
know if it will get the frequency range that you want) with regards to
changing the output frequency.
>Howdy,
>
>What I need must be such a common thing, that I thought I'd ask the PIC
>list's assembled wisdom before I set out to possibly re-invent the wheel.
>
>I'm using a 16C84 for an alarm controller, and I'd like to use the PIC to
>also generate a "siren" waveform (to be externally amplifed), rather than
>build that function in separate hardware.
>
>The other approach to keep cost low would be to use a dedicated "siren
>sound" IC, but I haven't found a commercial one yet. I do know that they
>exist as tiny COB (chip on board) modules in cheapo personal alarms, but
>does anyone know of any sources for them... Digikey lists some COB modules
>that generate melodies such as "happy birthday" etc, but can't supply one
>for a siren sound.
>
>Basically, what the siren waveform needs to be is as follows:
>
>1. a frequency modulated square wave output, (ie: *not* being amplitude
>modulated, should make it easier to do)
>
>2. output waveform is centered on 3 kHz.
>
>3. waveform should sweep back and forth between say 2500 and 3500 Hz, at a
>rate of 15 Hz or so.
>
>
>A routine with settable parameters for the frequency deviation (sweep) and
>sweep rate would be ideal, to optmize the "effectiveness" of the sound
>produced ... the trick is to resonate with the output transducer. Of
>course, armed with the basic routine, I could (and would) add the settable
>parameters.
>
>Many thanks in advance for any help that may come forth.
>....Gregg
>
>
Do you ever feel like an XT Clone caught in the Pentium Pro Zone?
> I'm using a 16C84 for an alarm controller, and I'd like to use the
> PIC to also generate a "siren" waveform (to be externally amplifed),
> rather than build that function in separate hardware.
>
> Basically, what the siren waveform needs to be is as follows:
>
> 1. a frequency modulated square wave output, (ie: *not* being
> amplitude modulated, should make it easier to do)
>
> 2. output waveform is centered on 3 kHz.
>
> 3. waveform should sweep back and forth between say 2500 and 3500
> Hz, at a rate of 15 Hz or so.
>
> A routine with settable parameters for the frequency deviation
> (sweep) and sweep rate would be ideal, to optmize the
> "effectiveness" of the sound produced ... the trick is to resonate
> with the output transducer. Of course, armed with the basic
> routine, I could (and would) add the settable parameters.
Gregg:
Try something like this... I'm making it up as I go along, so of
course it hasn't been tested or even assembled, but it should work
fine:
Note that this routine doesn't sweep "back and forth"; it only
sweeps up from 2500Hz to 3500Hz. If you NEED a back-and-forth
sweep, you can replace the "DECF FREQ" with a "MOVF DIRECTION,W /
ADDWF FREQ" combination and toggle DIRECTION between 01 and FF just
before the "GOTO BEGIN". I wouldn't bother... I think you'll find
that it sounds fine as-is.
As written, of course, the above program will generate the siren
tone forever; you'll probably want to wrap another loop around it to
limit the siren time.
Finaly, you may care that the sweep isn't linear, since each
frequency between STARTF and ENDF is generated for a constant number
of PERIODS, rather than a constant TIME. Again, I don't think
this'll be a problem... If it is, you can compensate by adding a
FREQ-dependent number to TIMER between "DOFREQ:" and "EDGE:".
> Rick Miller <.....rickKILLspam.....DIGALOGSYS.COM> wrote ...
>
> >[ ... ]
> >
> >Something important to remember though is that you don't want to
> >leave a DC bias sitting on the piezo!
>
> Why? Do you think a constant DC bias will damage a piezo?
Yes.
Rick Miller, Design Engineer, Digalog Systems, Inc.
>What I need must be such a common thing, that I thought I'd ask the PIC
>list's assembled wisdom before I set out to possibly re-invent the wheel.
>
Some say there's nothing wrong with that as long as you "learn" something.
>> >Something important to remember though is that you don't want to
>> >leave a DC bias sitting on the piezo!
>>
>> Why? Do you think a constant DC bias will damage a piezo?
>Yes.
>Rick Miller, Design Engineer, Digalog Systems, Inc.
I have designed many circuits using piezos that generate
ultrasound in the MHz range. They frequently have several hundred
volts of DC applied by the driving circuitry with no ill effect.
Piezos are made from the same kind of stuff ceramic capacitors are.
In fact some ceramic caps actually can be used as beepers. Ceramic
caps are unpolarized and so will respond equally to both positive and
negative voltages resulting in a frequency doubling effect.
Piezos are made by polarizing a crystal with a high voltage. The
crystal retains the electric field internally and then is able to
respond linearly to externally applied voltage by changing its dimensions.
The only damage you can do is to apply a voltage greater than the
original polarizing voltage (about 1000 volts for ultrasound crystals)
which can depolarize the crystal making it non-linear. Its analogous
to demagnatizing a permanent magnet with too strong an external
field.
Perhaps beeper piezos are polarized at voltages lower than 1000 but the
important thing is that the peak applied voltage (either AC or
DC) should not exceed the polarization value. Constant DC below this
level is harmless.
Eric
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
| Eric Strauts |
| TEEM Electronics |
| Park Ridge, IL 60068 |
| Email: EraseMEestrautsspam_OUTTakeThisOuTix.netcom.com |
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
>>
>>Piezos are made from the same kind of stuff ceramic capacitors are.
>>In fact some ceramic caps actually can be used as beepers.
>Sounds interesting. You mean in a useful manner ? What types ?
I have actually heard sounds coming from ceramic capacitors in a
power supply circuit. A quick test using some parts in my junk box
attached to a signal generator revealed no obvious beeper candidates.
Barium Titanate also known as X7R is used in both piezoelectric
devices and capacitors. Any sound you hear would probably be from the
radial resonant mode where the crystal vibrates like a ripple in a
pond from the center outward to the edges and back. The frequency
depends mostly on the diameter.
In the thickness mode you are more likely to generate ultrasonic
energy because the resonant frequency For a 2mm thick capacitor
would be roughly 700kHz.
Eric
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
| Eric Strauts |
| TEEM Electronics |
| Park Ridge, IL 60068 |
| Email: estrautsspam_OUTix.netcom.com |
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
>
> On Thu, 10 Oct 1996, Kevin Krauel wrote:
>
> > Rick Miller <@spam@rickKILLspamDIGALOGSYS.COM> wrote ...
> >
> > >[ ... ]
> > >
> > >Something important to remember though is that you don't want to
> > >leave a DC bias sitting on the piezo!
> >
> > Why? Do you think a constant DC bias will damage a piezo?
>
> Yes.
>
Could you please elaborate, and give some details on why?
Frankly I'd much rather beleive the pezio manufacturers manual,
which indicates constand DC is not a problem, that and my knowledge
of the physics of these devices.
> Rick Miller, Design Engineer, Digalog Systems, Inc.
>