Browse over 10,000 Electronics Projects

Build a Thief Detector using an Arduino UNO and a RCWL-0516 Microwave Proximity Sensor

Build a Thief Detector using an Arduino UNO and a RCWL-0516 Microwave Proximity Sensor

[ By Electronics Infoline Team ]
====================================

 

In this tutorial, we will talk about a motion detection system using the Doppler effect and microwave, and for this project, we are using RCWL-0516 motion detection module with Arduino UNO.

if we talk about motion sensors then there is one more popular motion sensor called PIR HC-Sr501 and this sensor uses “Passive InfraRed” light waves technology to detect the motion. PIR sensor module is emitted by animals or humans mostly and those things that are warm or hot.

RCWL-0516
unlike the PIR sensor, RCWL-0516 continuously sends microwaves around it and those waves reflect back. And if anything moves near the sensor range then that body makes a change in the waves and this frequency known as the “Doppler effect”. The Really Cool thing about this sensor is, it can detect moving objects through walls and other materials such as plastic, wood, which means we can simply hide this sensor behind the wall or we can even hide this sensor in any plastic enclosure box.

This mini Doppler radar motion sensor work under the voltage DC4-28V, this sensor continuously give high-level TTL signal on its “out” pin, whenever it feels any motion in the environment. This sensor is really suitable for DIY smart security systems, motion detection home automation, motion sensor light switch, etc.

 

 

Specification

  • Work under 4-28V
  • Consume 2.8mA typical; 3mA(max)
  • Detection range5-9m (16.4 – 29.5 ft) with Angle: 360° with no blind spot
  • Out pin Low-Level status: 0V
  • Out pin High-Level Status: 3.3V
  • Working Temperature: -20~80 celsius
  • PCB Board Size: 35.9 X 17.3mm/1.41 X 0.68inch

For testing the functionality of this module we do not need any Arduino or any other microcontroller for this project, we can build a simple circuit with the module as well, but as I am doing with Arduino only if you wanted to add it in your DIY Arduino based electronics project. In this project, we are going to attach an i2c based OLED 128X32 Display module, Arduino UNO, a buzzer and an LED light on the prototype-based PCB called breadboard. So without further discussion let’s get started.

Collect the hardware Requirements

  • Arduino UNO
  • OLED 128X32 i2c
  • Breadboard
  • LED light
  • 220ohm resistor
  • Buzzer
  • Male to male jumper wires

 

 

Wiring

For making the prototype of this project simply Collect all the hardware and assemble all the components on the breadboard as I explain in the fritzing diagram. Or you can simply follow the data pins details if you wanted to use other Arduino based microcontroller modules.

 

Click to Enlarge

As I explain above all black wires should be connected with the ground of Arduino UNO, and follow the following pin configurations if you wanted to use other Arduino based microcontrollers.

Arduino UNO OLED
3volt VCC
GND GND
A4 SDA
A5 SCL

 

Electronics

Parts

Arduino UNO
LED with(220ohm) Pin9
Buzzer Pin8
RCWL-out pin Pin12

 

After wiring up everything let’s move the into software installation.

Collect Software Requirements

 

First of all, visit the Arduino website and download your Arduino ide, Arduino ide is available for all different operating systems, download your software and install it in your systems.

 

 

After the installation of Arduino ide, just download both Arduino Libraries “Adafruit GFX Library” “Adafruit SSD_1306” and add into your Arduino IDE by doing following steps as I mention below in the Screenshot below:



Advertisement1


 

 

For adding the libraries, just go to “Sketch” >include library > Add. Zip Library

 

 

Now you need to select the library and click on open, Arduino Ide will automatically unzip and install the library itself.

 

Add the both libraries by following the repeat steps. Now we need to connect the Arduino Board to Computer via USB cable and upload the source code via Arduino ide, for uploading the code, simply copy and paste the source code into your Arduino ide. Select your Arduino board, COM port and hit upload button by doing the following steps. Which is mention below in the Screenshots.

Go to “Tools”> “Board” > “Arduino/Genuino UNO”

 

Go to “Tools” > “Port” > “Select your COM PORT”
in our case its COM5

 

 

After selecting the COM ports just upload the source by pressing the short keys  CTRL+U or simply Go to
click on “Sketch”>“Upload”

 

After Uploading the code, the project should start working, if you wanted to see the demo video of this sensor, that how the sensor can detect motion even if it is covered by something.

#######################################

Source code

#######################################

 

#include <Wire.h>

#include <Adafruit_GFX.h>

#include <Adafruit_SSD1306.h>

// Set the LCD address to 0x27 for a 16 chars and 2 line display

 

#define SCREEN_WIDTH 128 // OLED display width, in pixels

#define SCREEN_HEIGHT 64 // OLED display height, in pixels

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);

 

int Sensor = 12;   //Input Pin

int LED = 8;     // Led pin for Indication

int Buzzer =9;

 

int flg = 0;  //Change detection flag

void setup() {

 

  Serial.begin(9600);

    // initialize the LCD

  if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128×64

    Serial.println(F(“SSD1306 allocation failed”));

    for(;;);

  }

  //Electronicsinfoline.com

 

 

  display.clearDisplay();

  display.setTextSize(2);

  display.setTextColor(WHITE);

  display.setCursor(0, 10);

  display.println(“Electronicsinfoline.com”);

  display.display();

  delay(4000);

  pinMode (Sensor, INPUT);  //Define Pin as input

  pinMode (Buzzer, OUTPUT);    //Led as OUTPUT

  pinMode (LED, OUTPUT);    //Led as OUTPUT

 

}

 

void loop() {

 

     int val = digitalRead(Sensor); //Read Pin as input

    

     if((val > 0) && (flg==0))

     {

        digitalWrite(LED, HIGH);

        digitalWrite(Buzzer, HIGH);

       

        display.clearDisplay();

        Serial.println(“Motion Detected”);

        display.setTextSize(2);

       display.setTextColor(WHITE);

         display.setCursor(0, 10);

        // Display static text

         display.println(“Motion    Detected”);

          display.display();

     //   display.display();

        flg = 1;

     }

 

     if(val == 0)

     {

        digitalWrite(LED, LOW);

        digitalWrite(Buzzer, LOW);

        Serial.println(“NO Motion”);

        display.clearDisplay();

        display.setTextSize(2);

        display.setTextColor(WHITE);

        display.setCursor(0, 10);

       display.display();

        display.println(“No Motion”);

       

      //  display.display();

         

        flg = 0;

     } 

     delay(100);

}

 

#######################################

Download Fritzing Diagram
Download Source Code

 

 


Top