Searching \ for 'Siren from PIC' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: massmind.org/techref/microchip/devices.htm?key=pic
Search entire site for: 'Siren from PIC'.

Truncated match.
PICList Thread
'Siren from PIC'
1996\05\28@091353 by Cobus deBeer

flavicon
face
Hi everyone

Someone posted a question on how to drive a speaker from a PIC for use as a
siren or alarm output.  I have designed an alarm which has been in
production for 18 months and we use the following:


                             ____ 8 Ohm Speaker to 12V
                 ____      |/  |
pin -> >--------|    |-----|\_|/
                 ----      |  |\
                 3k9            \___
                         BD681      |
                                    |
                                   GND

The BD681 is an NPN darlington and in our application requires no heatsink.
We use a low cost horn speaker and it is very loud.

I use the following code for a simple beep.

beep
  movlw    d'30'
  movwf    beep_count

beep_loop
  bsf      Port_B, SIREN_OUT
  call     delay_1ms
  bcf      Port_B, SIREN_OUT
  call     delay_1ms
  decfsz   beep_count, same
  goto     beep_loop
  return

;
; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
;
I use the following code for a bee-bah when the car is locked.  The code is
written for a PIC16C84 running at 4MHz.

short_beep1
  clrf     beep_count_1
  movlw    D'142'
  movwf    tone
  goto     short_beep_loop

short_beep2
  clrf     beep_count_1
  movlw    D'190'
  movwf    tone

short_beep_loop
  bsf      Port_B, SIREN_OUT
  movf     tone, w
  call     noise_delay
  bcf      Port_B, SIREN_OUT
  movf     tone, w
  call     noise_delay
  incf     beep_count_1, same
  movf     beep_count_1, w
  addlw    0xf6
  btfss    STATUS, CARRY
  goto     short_beep_loop
  bcf      Port_B, SIREN_OUT
  return
;
; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
;
noise_delay
  movwf    noise_counter

noise_delay_loop
  nop
  decf     noise_counter, same
  movf     noise_counter, w
  btfss    STATUS, Z_bit
  goto     noise_delay_loop
  return
;
; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
;

lock_car
  call     short_beep1
  call     delay_400ms
  call     short_beep2
  return

The tones sound quite good. A lot can be achieved by modulating the delay
between taking the output pin high and taking it low.

Subjectively the beep sounds louder when the length of the beep is
increased. As the frequency is increased the tones sound softer.

Be very sure to set the output pin low at the end of each tone because the
current through the speaker is limited only by its series resistance and it
dies if the transistor is left on.  The transistor also dies.

We use the CCS compiler to prototype the more complex sounds and then
disassemble the code and hand optimize it before including it in the final
product.

Hope this is of some help.

Regards
CdB

1996\05\28@120106 by Wireless Scientific

flavicon
face
At 3:15 PM 5/28/96, Cobus deBeer wrote:
>Hi everyone
>
>Someone posted a question on how to drive a speaker from a PIC for use as a
>siren or alarm output.  I have designed an alarm which has been in
>production for 18 months and we use the following:
>


                                  +12V
                             |----|
                            __    _
                            /\   | |/    speaker
                             |   |_|\
{Quote hidden}

Cobus and others.

Above is a better solution to driving speaker with a darlington pair or
transistors in general. Remember that the current in an inductor doesn't
change instantanously. When you switch the transistor on and off, you are
basically changing the output impedence from low to high which allows
current to flow or not to flow. It's the high impedence state that the
problem. With the speaker inductance, when the transistor goes from on to
off, the impedence goes to low to high but the current still flows. This
inductive current going through the now high impedence will generate a high
voltage across the collector/emitter junction. Depending on the transistor,
you may exceed operating conditions.

By placing a diode across the speaker, you allow for a current path for
this inductive current when the transistor is off. The current will
dissipate quickly and not affect your sounds. Note the diode doesn't
conduct when the transistors are on.

Hope this helps.

craig
ps. Driving a speaker from a digital output is the first lesson I learned
in EE165 15 years ago.




________________________________________________________
Dr. Craig Hollabaugh
Wireless Scientific, Inc.
1890 South 14th Street
Building 100, Suite 105
Amelia Island, FL 32034
904 261 6977
904 261 2129 fax
spam_OUTwsciTakeThisOuTspammagic-net.net

Or you might know me as
Dr. Craig Hollabaugh
Analog Microelectronics, Georgia Institute of Technology
.....hollaKILLspamspam@spam@monique.adgrp.gatech.edu

or

Dr. Craig Hollabaugh
Aerospace Department, University of Texas, Austin
hollaspamKILLspamcfdlab.ae.utexas.edu

More... (looser matching)
- Last day of these posts
- In 1996 , 1997 only
- Today
- New search...