For fast transaction call 0916.457.0748
Learning Sensor Kit for Arduino Tutorial Motion Sensing

Learning Sensor Kit for Arduino Tutorial Motion Sensing

This project will teach us how to use the PIR Motion Sensor, its configuration, wiring and how would it work using Arduino Technology. PIR Motion Sensor is a sensing device that detects moving objects, particularly people. This device is often integrated as a component system which automatically detect motion in a certain area.

Motion Sensing with Arduino UNO R3

Things you’ll need:

  • PIR Motion Sensor
  • Arduino UNO R3
  • Uno R3 Sensor shield V5.0
  • Power Cable
  • LED
  • 220 ohm Resistor
  • Breadboard
  • Connecting Wire

 

Mounting your Uno R3 Sensor shield V5.0 to your Arduino UNO R3. Click here.

Schematic Diagram:

 

Connections of PIR Motion Sensor are as follow:

Ground to Arduino Ground
Vcc to 5V
Signal to Digital Pin 8 of Arduino
LED is connected to Digital Pin 13 of Arduino
   

Building the Code

For you to make this project work, you’ll need first to download the Arduino Software and install it in your computer. To do so, visit the Arduino Website and download the application.

Connect your Arduino Board to your computer using the Power Cable.

Open up your Arduino software and write the following code:

 

int led = 13;      // set the LED pin out to digital I/O port 13
int motion = 8;  // set the sensor port to digital I/O port 8
 
void setup() {
   pinMode(led, OUTPUT);         // it is necessary to configure that the led port is an output
   pinMode(motion, INPUT);      // and motion port as input
   Serial.begin(9600);                 // for you to check and run the serial monitor
}
void loop(){
   if (digitalRead(motion) == HIGH) {     // if motion is detected
      digitalWrite(led, HIGH);                   // signals the led port to HIGH and lights up the LED
      Serial.println("Motion detected!");     // display “Motion Detected!” in your serial monitor
    } else {
      digitalWrite(led, LOW);                    // if no motion is detected, turn off the LED
    }
}
    

Select the Board and Port you are using, in the Menu Bar select “Tools”. Select the corresponding board you are using and the designated port. Check this out on how to select board, Easy Learning Kit for Arduino Tutorial.

Upload your code.

Now test your project by moving in front of the Motion Sensor and you’ll notice that the LED would turn on. Turns off if nothing is detected.

 

Check out our other Sensor Tutorials below:

 

Happy Coding!


0 comments

Leave a comment

Please note, comments must be approved before they are published

Payment Methods

Facebook Rewards Program