CIPAD 42: Système d'alarme V2.0

3 min read 2 months ago
Published on Oct 02, 2024 This response is partially generated with the help of AI. It may contain inaccuracies.

Table of Contents

Introduction

This tutorial provides a step-by-step guide to building a basic alarm system using Arduino, as demonstrated in the video "CIPAD 42: Système d'alarme V2.0" by Daniel Talbot. The project utilizes Tinkercad and Wokwi platforms and employs components and functions previously covered in earlier lessons. This guide is designed for beginners looking to enhance their programming and electronics skills.

Step 1: Setting Up the Project Environment

  • Choose Your Platform: Decide whether you want to work with Tinkercad or Wokwi for your project.
    • Tinkercad: Access your project here.
    • Wokwi: Access the project here.
  • Create an Account: If you don't already have an account, sign up on the selected platform to save your projects.

Step 2: Understanding the Components

  • Identify Required Components:
    • Arduino Board: The main microcontroller.
    • Buzzer: For sound alerts.
    • PIR Sensor: To detect motion.
    • LEDs: To provide visual alarms.
    • Resistors and Breadboard: For connections and stability.
  • Familiarize Yourself with Each Component: Understanding how each component works will help you in the troubleshooting process.

Step 3: Wiring the Components

  • Connect the PIR Sensor:
    • Connect the VCC pin to the 5V on Arduino.
    • Connect the GND pin to the ground on Arduino.
    • Connect the OUT pin to a digital pin (e.g., pin 7).
  • Connect the Buzzer:
    • Connect one terminal to another digital pin (e.g., pin 8).
    • Connect the other terminal to the ground.
  • Connect the LEDs:
    • Use a resistor to connect the positive leg of the LED to a digital pin (e.g., pin 9).
    • Connect the negative leg to the ground.

Step 4: Writing the Code

  • Open the Code Editor: In your chosen platform, navigate to the code section.
  • Basic Code Structure:
    const int pirPin = 7;
    const int buzzerPin = 8;
    const int ledPin = 9;
    
    void setup() {
        pinMode(pirPin, INPUT);
        pinMode(buzzerPin, OUTPUT);
        pinMode(ledPin, OUTPUT);
    }
    
    void loop() {
        if (digitalRead(pirPin) == HIGH) {
            digitalWrite(buzzerPin, HIGH);
            digitalWrite(ledPin, HIGH);
            delay(1000); // Alarm duration
            digitalWrite(buzzerPin, LOW);
            digitalWrite(ledPin, LOW);
        }
    }
    
  • Upload the Code: Click on the upload button to compile and run your code on the Arduino.

Step 5: Testing the Alarm System

  • Activate the PIR Sensor: Move in front of the sensor to trigger the alarm.
  • Observe the Output: Ensure the buzzer sounds and the LED lights up when motion is detected.
  • Troubleshoot: If the system does not work as expected:
    • Check the wiring connections.
    • Verify that the code is correctly uploaded.
    • Examine the component functionality.

Conclusion

You have successfully built a basic alarm system using Arduino. This project reinforces essential programming and electronics concepts while providing a hands-on learning experience. For further enhancements, consider adding features such as remote notifications or integrating a keypad for deactivation. Continue exploring Arduino and related projects to expand your skills!