Carlos Butz MonroyCarson RammAlex Crotts
Published © GPL3+

Counting Customers

This project will help your business keep track of max capacity during this pandemic!

BeginnerFull instructions provided2 hours281
Counting Customers

Things used in this project

Hardware components

PIR Sensor, 7 m
PIR Sensor, 7 m
×2
Argon
Particle Argon
×3

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE
Maker service
IFTTT Maker service
Google Sheets
Google Sheets

Story

Read more

Schematics

Argon Circuit Schematic

Showing the physical connections of the PIR sensor to the Argon board

Code

IOTPUBLISHENTER

C/C++
int counter= 0;
int passerbydetected = 0;  //global variable
int ledPin = D7;


void setup() {
    pinMode(D7,OUTPUT);
    pinMode(D6,INPUT);// Configure D6 as INPUT for PIR Sensor
    Particle.subscribe("MEGR3171F20/team10/countingoneperson", Igotthesignal);
}

void loop() {

passerbydetected = digitalRead(D6);
if(passerbydetected == TRUE){
    counter = counter+1;
    Particle.publish("MEGR3171F20/team10/someonejustwalkedby","MotionDetected",PUBLIC);
    //subscribe to this motion event
    delay(5000);
}
}


void Igotthesignal(const char *event, const char *data) {
    digitalWrite(ledPin, HIGH);
    delay(5000);
    digitalWrite(ledPin,LOW);
    
}

IOTPUBLISHEXIT

C/C++
int counter= 0;
int passerbydetected = 0;  //global variable
int ledPin = D7;


void setup() {
    pinMode(D7,OUTPUT);
    pinMode(D6,INPUT);// D6 for PIR sensor as INPUT
    Particle.subscribe("MEGR3171F20/team10/countingoneperson", Igotthesignal);
}

void loop() {

passerbydetected = digitalRead(D6);
if(passerbydetected == TRUE){
    counter = counter+1;
    Particle.publish("MEGR3171F20/team10/someonejustwalkedout","MotionDetected",PUBLIC);
    //subscribe to this motion event
    delay(5000);
}
}


void Igotthesignal(const char *event, const char *data) {
    digitalWrite(ledPin, HIGH);
    delay(5000);
    digitalWrite(ledPin,LOW);
    
}

IOTSubscriber

C/C++
int i;
int ledPin = D7; // choose the pin for the LED
int inputPin = D6; // choose the input pin (for PIR sensor)
int pirState = LOW; // we start, assuming no motion detected
int val = 0; // variable for reading the pin status
int counter = 0;

void setup() {
    Particle.subscribe("MEGR3171F20/team10/someonejustwalkedby",someonejustwalkedby); 
    Particle.subscribe("MEGR3171F20/team10/someonejustwalkedout",someonejustwalkedout); 
    Serial.begin(9600);  //Turns on the particle serial port
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, HIGH);  //blink on reset
delay(5000);
digitalWrite(ledPin,LOW);

}
void loop() {
    //Nothing loops for now 
    
}

void someonejustwalkedby(const char *event, const char *data) {  //do this when the motion event is published.

    digitalWrite(ledPin, HIGH); //make the LED turn on if the event occurs.
    delay(5000);
    digitalWrite(ledPin,LOW);
     counter= counter +1;
        Particle.publish("MEGR3171F20/team10/countingoneperson", String(counter), PUBLIC);
}
       
void someonejustwalkedout(const char *event, const char *data) {  //do this when the motion event is published.

    digitalWrite(ledPin, HIGH); //make the LED turn on if the event occurs.
    delay(5000);
    digitalWrite(ledPin,LOW);
     counter= counter -1;
        Particle.publish("MEGR3171F20/team10/countingoneperson", String(counter), PUBLIC);
    
}

Credits

Carlos Butz Monroy

Carlos Butz Monroy

1 project • 1 follower
Mechanical Engineer Major
Carson Ramm

Carson Ramm

1 project • 2 followers
Alex Crotts

Alex Crotts

1 project • 1 follower

Comments

Add projectSign up / Login