Abdul MalikJabrail-McBrideDylan Vo
Published

Proximity Indicator!!!

With the utilization of particle argons and sensors, we have constructed a reversing vehicular tool!

BeginnerFull instructions provided145
Proximity Indicator!!!

Things used in this project

Hardware components

Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
Used to send and receive signals in order to measure the distance from an object
×1
LED (generic)
LED (generic)
Used as a visible sensor in order to relay that the ultrasonic sensor is too close to the object
×1
Buzzer
Buzzer
Used as an audio sensor in order to relay that the ultrasonic sensor is too close to the object
×1
Resistor 221 ohm
Resistor 221 ohm
Used to help balance the Argon sensor circuits
×2
Jumper wires (generic)
Jumper wires (generic)
Used to connect the sensors to the argon kit
×1
Argon
Particle Argon
Used as an activation hub for all the sensors and to relay code to the sensors
×3
Breadboard (generic)
Breadboard (generic)
Used to setup the circuits and build the sensors with the argon kit
×3

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE
Used to write the code in order to run the sensors appropriately

Story

Read more

Schematics

Light Sensor Circuit Diagram

Circuit Diagram detailing the breadboard setup for the LED light

Light Sensor Schematic

Schematic detailing the breadboard setup for the Light Sensor

Ultrasonic Sensor Circuit Diagram

Circuit Diagram detailing the Argon Kit Breadboard Connection for the Ultrasonic Sensor

Ultrasonic Sensor Schematic

Schematic detailing the breadboard setup for the ultrasonic sensor

Buzzer Circuit Diagram

Circuit Diagram detailing the breadboard setup for the buzzer sensor

Schematic for Buzzer

Schematic detailing the breadboard setup for the Buzzer

Flowchart

Organization Chart detailing how each sensor works with each other

Flowchart

Organization chart detailing how each sensor works and communicates with one another.

Code

Ultrasonic Code

C/C++
The following code exemplifies the initiation of the ultrasonic sensor detecting if an object is less than or greater than 60 cm corresponding with a buzzer and LED light, simultaneously.
int trigPin = D4;
int echoPin = D5;


void setup() {
    pinMode(trigPin, OUTPUT);
    pinMode(echoPin, INPUT);
}

void loop() {
   
    long distance;
    digitalWrite(trigPin, LOW);
    delayMicroseconds(2);
    digitalWrite(trigPin, HIGH);
    delayMicroseconds(10);
    digitalWrite(trigPin, LOW);
    distance = pulseIn(echoPin, HIGH);
    
   
    if (distance > 50) {
        Particle.publish("Ultrasonic", "Breach");
    } else {
        Particle.publish("Ultrasonic", "Clear");
    }
   
}

Buzzer Code

C/C++
The following code exemplifies the enactment of the buzzer when the distance from the ultrasonic sensor is fulfilled.
void setup() {
    pinMode(D6,OUTPUT);
    Particle.subscribe("Ultrasonic", buzzit, MY_DEVICES);
}
void loop() {

}

void buzzit(const char *event, const char *data) {
   
    if (strcmp(data, "Breach") == 0) {
        tone(D6,500,3000);
    } else if (strcmp(data, "Clear") == 0) {
        tone(D6,0,0);
    }
   
}

LED Code

C/C++
The following code simultaneously enacts on the LED & buzzer when the distance is fulfilled by the ultrasonic sensor.
int led1 = D5;
int led2 =D4;
void setup() {

  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  Particle.subscribe("Ultrasonic", light, MY_DEVICES);

}

void loop() {

}

void light(const char *event, const char *data) {
 
   
    if (strcmp(data, "Breach") == 0) {
        digitalWrite(led1, HIGH);

        digitalWrite(led2, LOW);
    } else if (strcmp(data, "Clear") == 0) {
        digitalWrite(led2, HIGH);
    }
}

Credits

Abdul Malik

Abdul Malik

1 project • 0 followers
Jabrail-McBride

Jabrail-McBride

1 project • 0 followers
Dylan Vo

Dylan Vo

1 project • 1 follower

Comments

Add projectSign up / Login