Building your own motion sensor with an Arduino is an easy and fun electronics project that most people don't even realize is possible. In this comprehensive guide, I will walk you step-by-step through everything you need to know to put together your own Arduino-based motion sensing device from scratch.

Overview of Arduino Motion Sensors

Arduino motion sensors detect movement in a room or area and send that data to the Arduino board to trigger some kind of output response. Common uses for DIY motion sensors include home security systems, automated lighting, robotics projects, and more.

There are a few different types of motion sensing modules that work with Arduino:

For this beginner-friendly project, I'll be using a basic PIR motion sensor paired with an Arduino Uno board.

Bill of Materials

To build your own Arduino motion detector, you will need:

The PIR sensor requires 3 connections - power, ground, and output. The output pin will go HIGH when motion is detected. Total cost for these parts is around $15-20.

Easy Step-by-Step Assembly Guide

Follow these steps to assemble the motion sensor circuit:

1. Connect the PIR VCC pin to Arduino 5V pin

This provides power to the sensor.

2. Connect the PIR GND pin to Arduino GND

Grounds the circuit.

3. Connect the PIR OUT pin to Arduino pin 2 through a 10 kΩ pull-down resistor

The resistor prevents false signals when the output is idle.

4. Upload motion sensing sketch to Arduino

I'll share sample code below to detect the sensor state.

5. Power on the Arduino

Use a 9V battery pack connected to the power jack.

Once powered on, the PIR sensor will start detecting motion anywhere within its range, up to 6 meters away. The Arduino code will monitor the output pin and print to serial whenever motion is detected.

Arduino Motion Sensing Sketch

Here is a simple sketch to monitor the PIR sensor output:

const int pirPin = 2;

void setup() {

pinMode(pirPin, INPUT);


void loop() {

if (digitalRead(pirPin) == HIGH) {

Serial.println("Motion detected!");



This will print "Motion detected!" to the serial monitor whenever the PIR sensor pin goes HIGH. Easy!

You can add additional logic to trigger lights, take a photo, activate a siren, or whatever you want when motion is sensed. The possibilties are endless.

Troubleshooting Tips

If your homemade motion sensor isn't working, try these troubleshooting tips:

With just a little tweaking, you should have your DIY motion detector up and running in no time!


Building your own Arduino motion sensor from a simple PIR module is an easy, fun project for beginners. This guide covered:

With just a few cheap parts, you can now build your own custom motion sensing projects! This is a great intro to Arduino that most people overlook.