Skip to content
Parallax Learn

Parallax Learn

  • Welcome
  • Tutorials
        • Tutorial Series head tag

          Tutorial Series
        • Tutorial Series

          The special, classroom-ready series pages are organized collections of tutorials for our most popular hardware and/or languages. The tutorials for each topic are conveniently accessible from a single page, shown in the order it is recommended that they be completed.
        • Robotics Series Head tag

          Robotics Series
        • Robotics Series

          • Artificial Intelligence
          • Cybersecurity: Radio Data tutorialCybersecurity
          • cyber:bot + Python
          • cyber:bot + MakeCode
          • Boe-Bot Tutorial SeriesBoe-Bot
          • Arduino Shield-Bot
          • ActivityBot with C TutorialsActivityBot + C
          • ActivityBot with BlocklyProp Tutorial SeriesActivityBot + BlocklyProp
          • Scribbler 3 Tutorial SeriesScribbler 3
        • Electronics & Programming Series Head tag

          Electronics & Programming Series
          • BS2 Board of Education Tutorial SeriesBS2 Board of Education
          • Propeller C-Language BasicsPropeller C Basics
          • FLiP Try-It Kit C Tutorial SeriesFLiP Try-It Kit + C
          • FLiP Try-It Kit BlocklyProp TutorialsFLiP Try-It Kit + BlocklyProp
          • Badge WX Tutorial SeriesBadge WX
          • Propeller BlocklyProp Basics and ProjectsPropeller BlocklyProp Basics
          • View All Tutorial Series »
        • Browse Tutorials
        • Browse Tutorials

          Individual tutorials sorted by robot or kit, and language.
        • By Robot or Kit
          • ActivityBot
          • SumoBot WX
          • Boe-Bot
          • Shield-Bot
          • cyber:bot
          • Badge WX
          • ELEV-8
          • ARLO
        • By Language
        • By Language

          • Propeller C
          • Arduino
          • BlocklyProp
          • PBASIC
          • Python
          • MakeCode
          • View All Tutorials »
  • Educators
  • Reference
  • Downloads
  • Home
  • All Courses

Build Your Own Door Alarm Project

Curriculum

  • 1 Section
  • 2 Lessons
  • Lifetime
Expand all sectionsCollapse all sections
  • Build Your Own Door Alarm Project
    2
    • 1.0
      Build and Test the Alarm
    • 1.1
      Customize the Final Program

Build and Test the Alarm

Schematics and Building the Circuits

The figures below provide the schematic and wiring diagram for the door alarm project. 

Figure 1 – Door Alarm Schematic

Figure 2 – Door Alarm Wiring Diagram

If you take a look at the wiring diagram (Figure 2) above, you may notice that the Parallax Serial LCD is mounted to the board using 90-degree universal mounting brackets.  These are are not required for the project; however, if you would like to use them to mount your Serial LCD, please use the optional mounting bracket parts and following assembly diagram:

Figure 3 – LCD Mounting Assembly

Testing the Circuit

Before continuing, it’s always a good idea to check the wiring for any errors.  This will help save valuable troubleshooting time as you will already know that each component is connected correctly. 

  • Run TestAlarmCircuit.bs2 and verify that the following occurs:
    • The piezospeaker emits a tone
    • The LEDs turn on
    • The echo time of the Ping))) sensor is displayed on the Serial LCD
' TestAlarmCircuit.bs2
' Checks that each aspect of the alarm circuit is working.

' {$STAMP BS2}
' {$PBASIC 2.5}

time      VAR   Word
counter   VAR   Byte

SEROUT 11, 84, [22, 12]          ' Initialize the LCD
PAUSE 5

FREQOUT 14, 500, 2000            ' Play a tone

DO
  PULSOUT 15, 5                  ' Get echo times
  PULSIN  15, 1, time

  HIGH 13                        ' Turn LEDs on
  HIGH 12

  ' Display echo times on LCD
  SEROUT 11, 84, [128, "time = ", DEC5 time]

  PAUSE 200
LOOP

Before moving on, test the circuit in the area you want to be monitored by the alarm device and make a note of the echo time of the Ping))) sensor when nothing is in its way.  Then, when you program the alarm later, you can tell it to activate if the echo time is less than the unobstructed distance of the area you are monitoring.


Printer-friendly version
Customize the Final Program
Next

DISCUSSION FORUMS | PARALLAX INC. STORE

About | Terms of Use | Feedback: learn@parallax.com | Copyright©Parallax Inc. 2024

© 2026 Parallax Learn • Built with GeneratePress