top of page
IMG_20170503_173438.jpg

Post

Electronics Projects for Kids: Learn Arduino - Motion detection with Arduino and PIR Sensor.



Introduction


Hello ! Welcome to today's blog. I hope so far our previous posts are educative. This is the ultimate resource for everything related to kids' projects, ranging from basic to intermediate and advanced levels. Our goal is to provide informative and practical content on how to complete projects step-by-step using Arduino for kids, and empower you to do it yourself and even build more sophisticated projects from electronics for kids to intermediate and to advanced electronics.


Circuit building is fascinating subject that allows you to create your own gadgets. did you know your laptop, your home TV, cars are all using electronic concepts ? All this starts with electronics for kids, and you are on the right track studying basic circuits for kids.


If you have done one of our previous post, Arduino board is not new to you for the basic circuit for kids and absolute beginners, we are introducing a Sensor - A device that can capture a parameter from environment. The sensor is called PIR and can detect a motion. We shall detect motion and light from that sensor and triggers a LED. That's the beauty of basic circuits for kids.


Required Materials

  • Arduino board

  • Breadboard

  • Jumper wires

  • LED

  • 220 - ohm resistor

  • PIR sensor


Required Components  for PIR detector
Required Components for PIR detector

How it Works


The sensor (PIR) detects the motion and this signal is read by your Arduino board, then light an LED to indicate motion detection, this information is printed in your Serial monitor, do you know what it is ? Do know worry if you are not aware, I will show you how to open it. Let's build the circuit.



Building the Circuit

  1. Connect a jumper wire from +5V of Arduino board to the breadboard +Ve (red marked) rail. Take another jumper wire and connect GND of Arduino to the GND of the breadboard (black labelled)

  2. Connect VCC of PIR to +5V rail in breadboard, GND of PIR to GND of breadboard, V0 which is the signal pin to pin 2 of Arduino.

  3. Connect your 220-ohm resistor in breadboard, one side to the taller part of LED(positive) and the other side of resistor to Pin 8 of Arduino through a cable. Connect the shorter pin of LED to GND.

Below is the reference circuit


Schematic of PIR Arduino project
Schematic of PIR Arduino project


Actual Circuit


Arduino PIR sensor in action
Arduino PIR sensor in action

Arduino PIR LED Circuit



Code /Arduino Sketch



// Define the PIR sensor and LED pins
int pirSensorPin = 2;
int ledPin = 8;

void setup() {
  // Initialize the serial communication at 9600 baud
  Serial.begin(9600);

  // Set the PIR sensor pin as input and the LED pin as output
  pinMode(pirSensorPin, INPUT);
  pinMode(ledPin, OUTPUT);
}

void loop() {
  // Read the PIR sensor value
  int pirSensorValue = digitalRead(pirSensorPin);

  if (pirSensorValue == HIGH) { // Motion detected - blink the LED
     Serial.println("Motion detected!");
     delay(100);
    
    digitalWrite(ledPin, HIGH); // turn LED on
    delay(100); // wait for 100ms
    digitalWrite(ledPin, LOW); // turn LED off
    delay(100); // wait for 100ms
  } else {
    // No motion detected - turn off the LED
    digitalWrite(ledPin, LOW);
     Serial.println("No Motion detected!");
     delay(100);
  }
}

Open your Arduino IDE, copy and paste the code into it. Navigate to tools, and select Board type, if you are using Arduino Uno, select it, if you are using Arduino Mega 2560, select it. On tools select the correct port assigned to your board.

To open the Serial monitor - check on the right top side of your Arduino IDE and click an icon that is indicated as Serial Monitor by hovering using the cursor.


Video Demo




Need to explore more ?


I will give you a challenge: look for a buzzer and add it in this circuit. When the motion is detected, DigitalWrite the buzzer pin HIGH (1) means you are putting the buzzer On, and when there is no motion DigitalWrite it LOW to put it OFF, all this is in learning Arduino for kids, or for absolute beginners.


The code of how this works would be defining the buzzer pin, say


int buzzer =  7;  

//in void setup declare the pin as output

PinMode(buzzer, OUTPUT);

//immediately after where we turn on LED
DigitalWrite(buzzer, HIGH);

//immediately after where we are turning LED off

DigitalWrite(buzzer, LOW)

Let me know how you feel about this challenge in the comment section. .


Other STEM projects for your you and your kids to test


If you like this project and and want to see more, you can check those as well:




Conclusion


Congratulations ! You have successfully built an Arduino PIR motion sensor circuit with LED for basic circuit. Like this post, share widely and can follow us in our social media platforms. In case you have any topics you wanna suggest, leave a message in comment section.


If you like online STEM activities, consider to subscribe to the newsletter and Social medias for updates and don't miss any STEM event. Don't forget to subscribe to the newsletter at the bottom of our website ''www.makersgeneration.net'' for more events, tutorials and freebies.



Subscribe to the Facebook group if you have yet registered. Content and tutorials are shared daily: Create and build STEM project for kids



We can be reached at: contact@makersgeneration.net if any questions.



See you on soon.





Comments


Categories

Recent Posts

Archive

Search By Tags

Follow Us

Comments

Share Your ThoughtsBe the first to write a comment.
bottom of page