Introduction: Build a Motion-Activated Alarm

In this project, we will create a motion-activated alarm using Protobject, a web-based platform.

Protobject allows you to use your smartphone's camera to detect movement and trigger an alarm if the motion exceeds a predefined threshold.

You can enhance the system with additional features such as notifications, multiple cameras, and a lighting system

Supplies

  1. 1 Smartphone (used as the motion detector)
  2. 1 Computer or Another Smartphone (for emitting the alarm sound)
  3. Internet Access (for using the Protobject platform online)

Step 1: Access the Protobject Website

Open the Protobject platform at https://app.protobject.com using Chrome or any Chromium-based browser (e.g., Edge, Opera).

You can start using Protobject immediately, without the need to sign up or log in.

Step 2: Add Devices

  1. Add the Motion device by scanning the provided QR code with your smartphone. This device acts as a motion sensor using the camera to detect movement.
  2. Add the AudioPlayer device to play the alarm sound when motion is detected. You can scan the QR code with another smartphone, or click "Open in this window" if you want to play sounds on your computer.


Step 3: Program the System

How it works

  1. The prototype starts an infinite loop to remain alert to any change in movement.
  2. It uses a conditional statement to check if the detected motion exceeds a predefined threshold.
  3. If the movement is over 40, it is considered indicative of intrusion, and the alarm is activated.
  4. The alarm is activated by playing an alarm sound through a YouTube link via the AudioPlayer device.


The code is already prepared for you! You can view it in detail at this link. Comments are included to provide clarification when needed.

You can also open the project directly in Protobject to avoid manually setting it up.

Step 4: Test Your Project

Press the play button and move in front of the camera to simulate motion detection.

  1. If motion exceeds the threshold (40), the alarm will trigger, playing the sound via the AudioPlayer device.
  2. Stop the system's execution to silence the sound.

Step 5: Optional Improvements

  1. Adjust Sensitivity: Modify the threshold to fine-tune when the alarm activates.
  2. Smart Lighting: Add a Lamp component and update the code to turn on the light when the alarm is triggered.


Step 6: Congratulations!

By using Protobject's web interface and your smartphone's built-in camera, you’ve created an interactive motion-activated alarm system using only the smartphone, without the need for additional sensors or actuators.

Protobject makes it easy to experiment with automation and security projects with minimal setup.

You can further enhance this project by integrating smart lights, vibration, or sending notifications using the WriteDraw component.

Happy building!