Shop OBEX P1 Docs P2 Docs Learn Events
Simple Car Alarm — Parallax Forums

Simple Car Alarm

ArchiverArchiver Posts: 46,084
edited 2004-01-14 05:35 in General Discussion
Whats up,

Im using the BS2 to complete a project at school and im having a
little trouble coding my alarm portion of the code. Its just a
basic alarm that reads two magnetic door sensors and sets off a
siren if activated. Has anybody had any experience in an automotive
application for such an alarm?? Im using the Linx 5-channel Rf key
fob and reciever setup that plugs in my education board. Any help
on the alarm coding would be greatly appreciated.
Thanks
Derek
Atl, GA

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-01-14 05:20
    Hey sounds like a cool project
    Here maybe some help
    Lets assume you connected the Linx outputs 1 through 5 acordingly to inputs
    0 through 4 of the stamp (we will only use Input 1 and 2 for now, but there
    all connected)
    and your magnetic switch Input 5 of the stamp
    and for fun lets connect an LED to output 6 for an alarm decoration
    and last but not least the siren. Use output 7 for the siren. carefull we
    need a relay to drive a siren. simplest way for this
    is to connect a 1 Kohm resistor to the base of an NPN transistor (i use
    2N2222). connect one side of a 5v relay to a Regulated 5V power supply NOT
    Vdd !! Vcc will work in this case. connect the other side of the relay to
    the collector of the NPN transistor. and connect the Emitter to ground of
    the regulated 5V and to Vss. you can see this Here
    www.turbodeuce.com/images/bs2_to_relay.jpg the picture shows 12v relay but
    the same design can be used if you switch a 5vdc realy and 5vdc power
    supply.

    '(stamp bs2)
    LED Var OUT6
    Siren Var OUT7
    Delay Var Word

    Main
    If IN0 = 1 then arm
    GOSUB LED_Status
    GOTO Main

    Arm
    IF IN5 =1 then Alarm
    IF IN2=1 then Disarm
    Delay = 500
    GOSUB LED_Status
    GOTO Arm

    Disarm
    Delay = 150
    GOTO Main


    LED_Status
    Pause Delay
    HIGH LED
    Pause Delay
    LOW LED
    Return

    End Of
    Program

    Hope this helps. Good luck with your alarm...


    Gary Denison
    Kyocera Wireless Corp
    GaryD@k...




    Original Message
    From: "djbradley32" <djbradley32@y...>
    To: <basicstamps@yahoogroups.com>
    Sent: Tuesday, January 13, 2004 3:34 PM
    Subject: [noparse][[/noparse]basicstamps] Simple Car Alarm


    > Whats up,
    >
    > Im using the BS2 to complete a project at school and im having a
    > little trouble coding my alarm portion of the code. Its just a
    > basic alarm that reads two magnetic door sensors and sets off a
    > siren if activated. Has anybody had any experience in an automotive
    > application for such an alarm?? Im using the Linx 5-channel Rf key
    > fob and reciever setup that plugs in my education board. Any help
    > on the alarm coding would be greatly appreciated.
    > Thanks
    > Derek
    > Atl, GA
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Yahoo! Groups Links
    >
    > To visit your group on the web, go to:
    > http://groups.yahoo.com/group/basicstamps/
    >
    > To unsubscribe from this group, send an email to:
    > basicstamps-unsubscribe@yahoogroups.com
    >
    > Your use of Yahoo! Groups is subject to:
    > http://docs.yahoo.com/info/terms/
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2004-01-14 05:35
    I forgot To Activate the Alarm Sorry !!! Here is the revised Program


    '(stamp bs2)
    LED Var OUT6
    Siren Var OUT7
    Delay Var Word
    Timer Var Byte

    Main
    If IN0 = 1 then arm
    GOSUB LED_Status
    GOTO Main


    Arm
    IF IN5 =1 then Alarm
    IF IN2=1 then Disarm
    Delay = 500
    GOSUB LED_Status
    GOTO Arm

    Disarm
    LOW Siren
    Delay = 150
    GOTO Main

    LED_Status
    Pause Delay
    HIGH LED
    Pause Delay
    LOW LED
    Return

    Alarm
    HIGH Siren

    Loop
    Timer = Timer + 1
    IF IN2=1 then Disarm
    if timer = 60 then Siren_off ' this will ensure the alarm will
    shut off after 60 Sec. You must hold Disarm button 1 sec to Disarm Alam.
    Pause 1000
    GOTO Loop

    Siren_off
    LOW Siren
    GOTO Arm

    ___________End of program____________________

    Sorry About that
    Good luck

    Gary D
    Kyocera Wireless Corp.
Sign In or Register to comment.