Alarm System

This is an example how to use a State Machine for an Alarm System. Learn more about a State Machine.

It has three inputs:
  • Key switch
  • PIR
  • Contact on the exit door
The outputs are
  • Siren
  • Buzzer
  • Led
When the alarm is enabled, the user has 20 seconds to leave the house. When entering the house the contact of the exit/entry door is triggered and the user has 20 seconds to disable the alarm.



The schematic is quite simple due to the State Machine, if it was made with logic ports it had required a lot of symbols. Here an explanation with the simulator how it works in detail.

To explain how the scheme works it is loaded into the simulator: how to use the simulator

Using the state machine

  1. The state machine starts in Alarm off.
  2. When the key is turned (input key switch) the signal GoOn is high and the status diagram goes to state PreArmed.
  3. The signal PreArmed activates the buzzer.
  4. PreArmed triggers timer and after 20 seconds ARM is active.

  5. In status ARMED there are three possibilities:
    • GoOff by the key result: AlarmOff
    • Exit-Entery user has triggered the entry result: PreOff
    • PIR result: Alarm

  6. When the PIR is triggered, the status runs to Alarm and the Siren and AlarmLed will be activated.
  7. The alarm also starts a timer to end the alarm. The system returns to ARMED.
  8. After an alarm the system is back in ARMED and the AlarmLed stays on to let the user know there was an alarm.
  9. The exit-entry is triggerd when the user enters the house. A 20 sec. timer is started. If the alarm is not turned off with the key the siren will be enabled.

Download

Alarm_System.zip
Prepared for devices: ST6260C ST7FLite10 PIC16F88 PIC16F876 other devices can be used by reconnecting I/O pins.