Introduction: CarWatch Proximity Alert System DIY Tunis EcoTrick : Un Projet Éducatif, Économique Et Écologique Par Électronique

Welcome to the Arduino DIY Tunis EcoTrick project! This project is designed to help you build a smart car detection system using Arduino Nano, PIR and ultrasonic sensors, and a Bluetooth module. The system is designed to detect the presence of a car in a non-parking area and send a light signalization. If the car remains present for more than 10 seconds, the system activates a siren. This project is an excellent example of how you can create an educational, economical, and ecological solution that has real-world applications.


Project Title: CarWatch Proximity Alert System


The system is a car detection system that uses an Arduino Nano, a PIR (passive infrared) sensor, a relay module, a siren, and an ultrasonic sensor. The system is designed to detect if a car enters a non-parking area and provide a signal to indicate its presence.

The PIR sensor detects motion in its field of view and triggers the Arduino to turn on a light signal using a relay module when a car is detected. The system also includes an ultrasonic sensor to measure the distance between the sensor and the car. This allows the system to detect if the car is within a certain distance of the sensor, indicating that it has entered the non-parking area.

If the car is detected by either the PIR sensor or the ultrasonic sensor, the system sets a flag to indicate that a car is present. If the flag remains set for more than 10 seconds, the system activates a siren to alert nearby individuals that a car has entered the non-parking area.

Overall, this system provides a simple and effective way to detect if a car has entered a non-parking area and provide an audible warning to nearby individuals to take action.

Supplies

Parts:

  • Arduino Nano
  • PIR sensor
  • Ultrasonic sensor
  • Bluetooth module
  • Relay modules (Light and siren)
  • LED lights
  • Buzzer
  • Resistors (220 Ohms)
  • Jumper wires
  • Breadboard
  • USB cable
  • 9V battery
  • Battery snap connector
  • Enclosure box


Tools:

  • Soldering iron
  • Solder wire
  • Multimeter
  • Wire cutter/stripper
  • Screwdriver
  • Drill (optional)

Step 1: Understanding the Design

The Arduino DIY Tunis EcoTrick is a smart car detection system that uses a PIR sensor to detect the presence of a car and an ultrasonic sensor to measure the distance. When a car is detected, the system sends a light signalization to the user. If the car remains present for more than 10 seconds, the system activates a siren to alert the user. The system also sends the distance measured and the system state via Bluetooth module.

Step 2: Soldering the Components

Start by soldering the PIR and ultrasonic sensors, resistors, and jumper wires onto a breadboard. Then, connect the relay modules, LED lights, and buzzer to the breadboard. Finally, connect the Bluetooth module to the Arduino Nano and breadboard.


Step 3: Wiring the Circuit

Wire the PIR sensor to the Arduino Nano's digital pin 13. Wire the ultrasonic sensor's trigger pin to pin 4, and the echo pin to pin 5. Connect the relay modules to the Arduino Nano's digital pins 2 and 3, and connect the buzzer to pin 8. Connect the Bluetooth module's RX pin to pin 7 and the TX pin to pin 6. Make sure to follow the circuit diagram closely.

Step 4: Coding the Arduino Nano


Upload the code to the Arduino Nano using the Arduino IDE. The code will read the inputs from the PIR and ultrasonic sensors and activate the relay modules, LED lights, and buzzer accordingly. It will also send the system state, distance measured, and monitoring information via Bluetooth module.


// Define pins

#define PIR_PIN 13

#define LIGHT_RELAY_PIN 2

#define SIREN_RELAY_PIN 3

#define BUZZER_PIN 8

#define UltraSound_TRIGGER_PIN 4

#define UltraSound_ECHO_PIN 5

#define BT_RX_PIN 7

#define BT_TX_PIN 6


// Define constants

#define MAX_DISTANCE 300 // Maximum distance we want to ping for (in centimeters)

#define TRIGGER_INTERVAL 50 // Interval between each ping (in milliseconds)

#define ALERT_DELAY 10000 // Time to wait before triggering alarm (in milliseconds)


// Include required libraries

#include <SoftwareSerial.h>


// Initialize objects

SoftwareSerial BTSerial(BT_RX_PIN, BT_TX_PIN);


void setup() {

 pinMode(PIR_PIN, INPUT);

 pinMode(LIGHT_RELAY_PIN, OUTPUT);

 pinMode(SIREN_RELAY_PIN, OUTPUT);

 pinMode(BUZZER_PIN, OUTPUT);

 pinMode(UltraSound_TRIGGER_PIN, OUTPUT);

 pinMode(UltraSound_ECHO_PIN, INPUT);

  

 digitalWrite(LIGHT_RELAY_PIN, LOW);

 digitalWrite(SIREN_RELAY_PIN, LOW);

 digitalWrite(BUZZER_PIN, LOW);


 Serial.begin(9600);

 BTSerial.begin(9600);

}


void loop() {

 // Read PIR sensor

 int pirState = digitalRead(PIR_PIN);

 if (pirState == HIGH) {

  Serial.println("Car detected");

  digitalWrite(LIGHT_RELAY_PIN, HIGH);

  delay(ALERT_DELAY);

  digitalWrite(SIREN_RELAY_PIN, HIGH);

  digitalWrite(BUZZER_PIN, HIGH);

  BTSerial.println("Alert! Car detected in non-parking area.");

  Serial.println("Alert sent via Bluetooth.");

 } else {

  digitalWrite(LIGHT_RELAY_PIN, LOW);

  digitalWrite(SIREN_RELAY_PIN, LOW);

  digitalWrite(BUZZER_PIN, LOW);

 }

  

 // Read distance from ultrasonic sensor

 long duration, cm;

 digitalWrite(UltraSound_TRIGGER_PIN, LOW);

 delayMicroseconds(2);

 digitalWrite(UltraSound_TRIGGER_PIN, HIGH);

 delayMicroseconds(10);

 digitalWrite(UltraSound_TRIGGER_PIN, LOW);

 duration = pulseIn(UltraSound_ECHO_PIN, HIGH);

 cm = duration / 58;

 Serial.print("Distance: ");

 Serial.print(cm);

 Serial.println("cm");


 // Wait for a short time before starting again

 delay(TRIGGER_INTERVAL);

}


N'oubliez pas de connecter les composants correctement et de téléverser le code sur la carte Arduino. Si vous avez des problèmes, n'hésitez pas à consulter la documentation ou à demander de l'aide sur les forums Arduino en ligne.

Step 5: Enclosure and Testing

Once the circuit and code are complete, place the components into an enclosure box. Drill holes for the PIR and ultrasonic sensors and for the LED lights and buzzer. Connect a 9V battery to the battery snap connector and place it in the enclosure. Finally, test the system to ensure that it works correctly.

Step 6: We Provide Technical Support for Free With Open Source Platform DexTn

Je fournis un fichier Fritzing pour les détails techniques complets et pour fournir un point de départ solide pour améliorer la qualité du projet. Le fait que vous ayez soudé la carte de manière à la rendre universelle pour le câblage d'Arduino Nano est également très utile pour rendre le projet robuste et compatible avec tous les composants pour tous les projets.

Pour aider les autres à recréer ce projet et à améliorer leurs compétences en électronique, j'ai créé un fichier Fritzing qui montre tous les détails de câblage et de disposition des composants de ce projet. Le fichier Fritzing est un outil open source qui permet de créer des schémas électroniques, des conceptions de circuits imprimés et des maquettes de prototypes. Il est donc très utile pour les débutants et les professionnels.

Pour utiliser le fichier Fritzing que j'ai créé pour ce projet, vous pouvez télécharger le logiciel Fritzing à partir du site Web officiel de Fritzing et ouvrir le fichier. Dans le fichier, vous trouverez toutes les informations nécessaires sur les composants utilisés dans ce projet, leur disposition sur la carte de circuit imprimé et les connexions de câblage à l'Arduino Nano.

Le fichier Pcb Fritzing que j'ai créé est conçu pour être universel et compatible avec d'autres projets. Vous pouvez donc l'utiliser comme point de départ pour vos propres projets Arduino en utilisant les mêmes composants que ceux utilisés dans ce projet ou en modifiant les connexions filiaires pour s'adapter à vos besoins spécifiques.