Arduino and Microwave Sensor

A while back we wrote about the microwave sensor (http://icaruslabs.cysecurity.org/microwave-motion-detection-system). A PoC is ready for demonstration. Once again we are using an Arduino board for this project. For use in the field we will be using a standalone AVR or maybe a Parallax Propeller board. The microwave sensor outputs the data through a single pin. The frequency of the signal being output changes in proportion to the speed it is detecting. The arduino reads the output through findFrequency function. Since the frequency varies along with the speed of movement, findFrequency returns a value that is directly proportional to the speed of the object’s motion that it is detecting. As you can see in the schematic below, we’ve attached 3 LEDs to measure the speed. If no motion is detected, none of the LEDs will light up. If some motion is detected, the first led will light up. If there is a somewhat faster motion, two of the LEDs will simultaneously light up and if there is a very fast motion, all three will light up.

microwave motion

What differentiates this setup from normal motion detectors is the fact that it is capable of penetrating solid objects such as walls and doors. It could be of immense importance during situations where a direct line of sight is impossible or just not viable such as disaster or high risk areas.

working prototype

Here is the Arduino code that we used:

int pin= 7;
int led1= 8;
int led2= 9;
int led3=10;
unsigned long time;
void setup()
{
  Serial.begin(9600);
  pinMode(pin, INPUT);
  pinMode(led1,OUTPUT);
  pinMode(led2,OUTPUT);
  pinMode(led3,OUTPUT);
}

void loop()
{
  int out= findFrequency(pin);
  Serial.print(out);
  Serial.print("\n");
 if(out==-1)
 {
digitalWrite(led1,LOW);
digitalWrite(led2,LOW);
digitalWrite(led3,LOW);
delay(100);
 } 
else if(out<30)
 {
digitalWrite(led1,HIGH);
digitalWrite(led2,LOW);
digitalWrite(led3,LOW);
delay(100);
 }
 else if(out<90)
 {
digitalWrite(led1,HIGH);
digitalWrite(led2,HIGH);
digitalWrite(led3,LOW);
delay(100);
 }
 else if(out<2000)
 {
digitalWrite(led1,HIGH);
digitalWrite(led2,HIGH);
digitalWrite(led3,HIGH);
delay(100);
 }

}
 long findFrequency(int pin) {
  long freq = 0;
  freq= 500000/pulseIn(pin, HIGH, 250000);
  return freq;
}

Leave a Reply

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