Introduction

Building a motion sensor alarm system with an Arduino is a great way to detect intruders and get notified instantly via email. With just a few components, you can set up a simple yet effective security system for your home or office.

In this comprehensive guide, I will walk you through the entire process of constructing an Arduino-based motion sensor alarm from start to finish. I will cover:

What You Will Need

How It Works

Assembly and Installation

Usage and Customization

By the end of this guide, you will have a fully functional motion sensor alarm system that alerts you via email whenever the sensor detects movement. Let's get started!

What You Will Need

To build the Arduino motion sensor alarm, you will need the following components:

Arduino Uno

The Arduino Uno is the microcontroller board that will run the code and control the alarm system. This versatile board can be powered via USB or a 9V battery.

PIR Motion Sensor

A passive infrared (PIR) motion sensor detects movement and changes in infrared radiation.

Breadboard

A breadboard provides a convenient way to prototype circuits without soldering.

Jumper Wires

Jumper wires are used to make connections between components on a breadboard.

Buzzer

A buzzer or piezo speaker will sound an audible alarm when motion is detected.

Resistors

Resistors limit the flow of current in a circuit.

LEDs

Indicator LEDs visually show when the device is powered on and when motion is detected.

Ethernet Shield

The Ethernet shield allows the Arduino to connect to the internet via Ethernet.

SD Card Module

A micro SD card module is used to store email credentials and the recipient address.

How It Works

Now that we have covered the main components, let's take a look at how the motion sensor alarm system works.

Detecting Motion with the PIR Sensor

The passive infrared (PIR) motion sensor is the key component that detects movement and triggers the alarm.

Sounding the Alarm with the Buzzer

When the Arduino receives a HIGH signal from the PIR sensor, indicating motion, it activates the buzzer to sound the audible alarm.

Sending Email Alerts

In addition to the audible alarm, the system can send an email alert when motion is detected.

Writing the Code

The Arduino code brings the whole system together by controlling each component.

Assembly and Installation

Now that we understand how each piece works, let's put the motion sensor alarm circuit together on a breadboard and install the code.

Connecting the Components

We will be using the Arduino Uno, so make sure it is powered off to start. Here are the steps to assemble the circuit:

  1. Insert the PIR motion sensor into the breadboard. Connect the power pin to 5V and ground pin to GND.

  2. Connect the output pin of the PIR sensor to digital pin 2 on the Arduino.

  3. Place the buzzer in the breadboard. Connect one leg to digital pin 3 and the other leg to ground through a 220 ohm resistor.

  4. Insert the green LED and connect the short leg to ground through a 10K resistor. Connect the long leg to the Arduino's 5V pin.

  5. Insert the red LED and connect it similarly to the green LED, with the long leg going to Arduino pin 4.

  6. Mount the Ethernet shield on top of the Arduino board. Connect the SD card module to the shield if using.

  7. Use jumper wires to complete all the connections between components. Double check everything looks correct.

Uploading the Code

Before powering up the Arduino, we need to upload the motion sensor alarm code to it:

  1. Open the Arduino IDE on your computer and connect the Arduino via USB.

  2. Paste the Arduino sketch code into a new sketch file.

  3. Go to Tools > Board and select "Arduino Uno". Also select the correct serial port it is connected to.

  4. Click the Upload button to compile the code and upload it to the Arduino.

  5. When done uploading, the green LED on the Arduino should turn on, indicating it is powered up and running the code.

Positioning the Motion Sensor

The last step is positioning the PIR motion sensor in the optimal location:

Usage and Customization

Now that your DIY Arduino motion sensor alarm is assembled and installed, let's go over how to use it and customize it for your specific needs.

Calibrating the Sensor

The PIR sensor may need some calibration to function optimally in your environment. Here are a few tips:

Adjusting the Sensitivity

You can make the motion sensor alarm more or less sensitive by modifying the Arduino sketch:

Modifying the Code

There are many ways to customize the behavior by modifying the Arduino code:

Expanding the Project

Some ideas for taking this project to the next level:

Conclusion

Constructing your own Arduino motion sensor alarm is an enjoyable, educational project that results in a functional security system. This guide covered sourcing the components, assembling the circuit on a breadboard, installing the code, adjusting the sensitivity, and enhancing the alarm system in many ways.

With the knowledge you've gained here, you can now build an Arduino motion sensor alarm system tailored exactly for monitoring your unique environment. You may even get ideas for more advanced alarm system projects to take on next using the Arduino platform.