Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

Motion Tracking with Arduino

Motion tracking is a crucial technology in various applications, from security systems to interactive installations and robotics. Using Arduino, a popular open-source electronics platform, we can create a motion tracking system that is both affordable and customizable. This article will guide you through building a basic motion tracking project using Arduino, demonstrating its importance and practical applications.

Projeto: In this project, we will create a motion tracking system using an Arduino board and a PIR (Passive Infrared) sensor. The objective is to detect motion within a specific area and trigger an LED to indicate the presence of movement. This simple yet effective system can be expanded for use in home security, automated lighting, or interactive art installations.

Lista de componentes:

  1. Arduino Uno (1x)
  2. PIR Sensor (HC-SR501) (1x)
  3. LED (1x)
  4. 220-ohm Resistor (1x)
  5. Breadboard (1x)
  6. Jumper Wires (various)

Exemplos: Below is the Arduino code for the motion tracking project. This code will read the input from the PIR sensor and turn on the LED when motion is detected.

// Define the pins for the PIR sensor and the LED
int pirPin = 2; // PIR sensor input pin
int ledPin = 13; // LED output pin

void setup() {
  // Initialize the serial communication for debugging
  Serial.begin(9600);

  // Set the PIR sensor pin as INPUT
  pinMode(pirPin, INPUT);

  // Set the LED pin as OUTPUT
  pinMode(ledPin, OUTPUT);

  // Initialize the LED to be off
  digitalWrite(ledPin, LOW);
}

void loop() {
  // Read the value from the PIR sensor
  int pirValue = digitalRead(pirPin);

  // Check if motion is detected
  if (pirValue == HIGH) {
    // Motion detected, turn on the LED
    digitalWrite(ledPin, HIGH);
    Serial.println("Motion detected!");
  } else {
    // No motion, turn off the LED
    digitalWrite(ledPin, LOW);
  }

  // Small delay to avoid multiple triggers
  delay(500);
}

Explanation of the Code:

  1. Pin Definitions: We define the pins for the PIR sensor and the LED. The PIR sensor is connected to pin 2, and the LED is connected to pin 13.
  2. Setup Function:
    • We initialize serial communication at a baud rate of 9600 for debugging purposes.
    • We set the PIR sensor pin as an INPUT and the LED pin as an OUTPUT.
    • We initialize the LED to be off.
  3. Loop Function:
    • We read the value from the PIR sensor.
    • If the PIR sensor detects motion (returns HIGH), we turn on the LED and print "Motion detected!" to the serial monitor.
    • If no motion is detected, we turn off the LED.
    • A small delay is added to avoid multiple triggers.

This basic setup can be expanded by integrating more sensors, using different types of actuators, or connecting the system to a network for remote monitoring.

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.