Microwave Radar Motion Sensor (HW-MS03)

A few months back I took a look at some low-cost passive infrared (PIR) motion sensor modules. Since I am fond of sensors,  I did a few sensor research and found out about Microwave radar sensors. Luckily, I found this interesting sensor in our new arrival lists, In this article, we are going to discuss one such sensor called the HW-MS03.

All the modules that you require to implement this project are available on our website. Visit PROBOTS

So, what are these Microwave radar sensors ??

Microwave sensors, also known as Radar, RF, or Doppler sensors, These sensors are capable of detecting movements like walking, running, or crawling human presence in an outdoor environment.

Microwave sensors generate an electromagnetic (RF) field between transmitter and receiver, creating an invisible volumetric detection zone. When an intruder enters the detection zone, changes to the field are registered and an alarm occurs.

These sensors are capable enough to detect motion by applying the Doppler effect and emit microwaves which will bounce off surfaces and return to the sensor. It is able to measure and detect the amount of time for the signal to be reflected to the sensor which is known as echo time.

What is Echo time ??

Echo time helps to calculate the distances from any object within the detection zone and establishes a baseline for the motion detector to work from.

With echo time, the sensor is able to detect, if there is any movement in the detection zone as if a person is moving within the zone as the waves will be altered which changes the echo time. With the microwave sensor, it is able to do all this within less than a microsecond.

Where are these Microwave Radar Sensors used??

When it comes to motion sensors, they use various technologies to detect movement in an area and are used commonly in security, industrial, transportation fields. But there are many varieties when it comes to motion sensors like the PIR motion sensor, microwave sensor, ultrasonic sensors, etc. each category of these sensors have their own advantages and disadvantages.

The HW MS Series of Microwave Radar Sensors

HW-MS series is a newly developed single-board microwave induction module. This product is especially suitable for the ultra-thin design of intelligent home appliances, security products, lighting products, and other electronic fields.

The HW-MS03 microwave induction module uses a planar antenna to transmit and receive high-frequency electromagnetic waves and then detects a slight movement change of the folded-back wave, which in turn triggers the microprocessor to work, and finally outputs a useful control electrical signal (HIGH – 1) (LOW – 0) or control state (on/off). 

Now let us look at the pinouts of the microwave sensor

Pinouts:

Out — Sensor Output (HIGH (3.3 V) Motion detected/LOW (0 V) idle)

VIN+  — 3.3V

GND — Ground/0 V

Now to work with the microwave sensor, we need few components, once that is done we will move to the wiring diagram and the coding section.

Components Required:

Arduino Uno

Buzzer

HW MS03

Jumper Wires

Wiring Diagram:

Wiring Connections Details:

ArduinoBuzzerHW MS03
+3.3V---------Vin
GndGndGnd
5Buzzer Pin Positive----------
2-----------Out

For the software section, we will be using the Arduino IDE, Since no library is required to do this basic test, we will directly go to the coding.

Code:


/**
 * This code is written  to visualise the working of the microwave radar sensor
 * For more such interesting articles on products and their working visit: Probots
 *
 * @author  Abhishek S
 * 
 */

#define inputPin  2 
#define Buzzer_pin 5
void setup()
{
  pinMode(inputPin, INPUT);        // Initializing the declared inputPin as INPUT 
  pinMode(Buzzer_pin, OUTPUT); // Initializing the declared Buzzer_pin as OUTPUT 
  Serial.begin(9600);
  Serial.println("HW-MS03 Radar test");
}
void loop()
{
  bool reading = digitalRead(inputPin);  
  if (reading == HIGH) 
  {
    Serial.println("MOVEMENT!");
    digitalWrite(Buzzer_pin, HIGH);     
  }
  if (reading == LOW) 
  {
     Serial.println("NO MOVEMENT!");
     digitalWrite(Buzzer_pin, LOW);   
  }
     delay(500); // wait 0.5 second
}

Code Explanation:

This code is pretty straightforward, but still let us get into the code details without wasting time.

The Coding begins with defining the pin numbers for sensor input, buzzer pin.

#define inputPin 2 
#define Buzzer_pin 5

In the void setup() I will initialize respective pin numbers as input and output. I will then serially begin with the baud rate @ 9600 and print a message

pinMode(inputPin, INPUT);        // Initializing the declared inPin as INPUT 
pinMode(Buzzer_pin, OUTPUT); // Initializing the declared Buzzer_pin as OUTPUT 
Serial.begin(9600);
Serial.println("HW-MS03 Radar test");

In Void loop() the main execution will take place 

Here I will digital read the input pin of the sensor and store it in a variable of type bool

 bool reading = digitalRead(inputPin); 

With the stored variable I will now put that variable in an if condition to detect the movement, ie.. When the sensor is triggered, the pin becomes high and in turn prints the message and turns ON the buzzer.

if (reading == HIGH) 
{
   Serial.println("MOVEMENT!");
   digitalWrite(Buzzer_pin, HIGH);     
}

With the stored variable I will again put that variable in an if condition to detect movement, ie. When the sensor is not triggered, the pin becomes low and in turn prints the message and turns OFF the buzzer.

 if (reading == LOW) 
  {
     Serial.println("NO MOVEMENT!");
     digitalWrite(Buzzer_pin, LOW);   
  }
     delay(500); // wait 0.5 second
}

“ The LED in the below images has been added only for visual representation “ 

According to the given code and wiring diagram, the connected buzzer will turn ON and OFF when there is Movement and NO Movement and the respective result will be shown on the serial monitor.

The output of the Radar test will look something like the above images, you can always tweak around and take it to the next level.

All the components used in this article are readily available on our website. Please visit: PROBOTS to buy any components you need to kickstart your project.

Leave a Reply

Your email address will not be published. Required fields are marked *