fbpx
Arduino Lesson 14: Motion Sensor
Arduino Lesson 14

Motion Sensor

Use motion sensor to detect motion

Components Required

Buy
Buy

Introduction

A motion sensor (or motion detector) is an electronic device that is designed to detect and measure movement. Motion sensors are used primarily in home and business security systems. PIR Sensor is short for passive infrared sensor, which applies for projects that need to detect human or particle movement in a certain range, and it can be referred as PIR (motion) sensor, or IR sensor.

Learning outcomes:

  • Using motion sensor
  • Theoretical background of using Infrared waves in motion sensor

Theory

When a human or animal body will get in the range of the sensor, it will detect a movement because the human or animal body emits heat energy in a form of infrared radiation. That is where the name of the sensor comes from, a Passive Infra-Red sensor. In addition, the term “passive” means that sensor is not using any energy for detecting purposes; it just works by detecting the energy given off by the other objects.

https://i1.wp.com/github.com/HarshaWeerasinghe/MagicBit_Sensors/blob/master/resources/MotionSensor/Screenshot_3.png?w=640&ssl=1

Figure 1: PIR Sensor –Howtomechatronics.com

Methodology

First, connect the motion sensor to your Magicbit and upload the following code to your Magicbit. In this demonstration like other demonstrations, we use D32 as the data pin.

Code

 

int MOTIONsensor =32;
void setup() {
  pinMode(MOTIONsensor, INPUT);
  Serial.begin(9600);
}
void loop() {
  Serial.println(digitalRead(MOTIONsensor));
}

Explanation

When some human being detected by the motion sensor, which is in the range of the sensor, the output of the serial monitor, will be displayed ‘1’. If not there will be displayed ‘0’.

Related Posts
Leave a Reply

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