PCL Project
I created and programmed a PIR sensor that notifies me when a customer is at the register of my workplace. This served to increase productivity as I could make myself useful by doing inventory or helping in the kitchen without my previously incessant concern that a customer may need assistance.
Supplies
PIR Sensor: https://www.amazon.com/Adafruit-LK-918O-SANV-FBACA-PIR-Motion-Sensor/dp/B00JOZTAC6
Particle Argon Starter: https://store.particle.io/products/argon-kit
Cardboard
Particle Code and Webhook
bool alarm_mode_status = TRUE;
int pirPIN = 3;
int pirVal;
void setup() {
pinMode(pirPIN, INPUT);
Particle.function("toggle", toggle);
}
void loop() {
if(alarm_mode_status){
pirVal = digitalRead(pirPIN);
if( pirVal == LOW){
delay(100);
}
if(pirVal == HIGH){
Particle.publish("Alarm_Triggered");
delay(30000); //need to switch to time class
//30 second delay
}
}
}
int toggle(String param) {
if(alarm_mode_status == TRUE){
alarm_mode_status = FALSE;
}else{
alarm_mode_status = TRUE;
}
return 0;
}
Adjusting Time Delay
Using a screwdriver, turn the orange knob labeled "time" all the way to the left. This shortens the time delay to about five seconds which is ideal for my project. Turning the knob all the way to the right would result in a 60 minute time delay. Adjust "sensitivity" knob (seen on the left) directly in the center.
Sensor
Hook sensor up to argon.
Wiring
Place seven wires on the breadboard accordingly using the images above.
Construct Final Product
Attach toilet paper roll around the base of PIR sensor to minimize the range of motion it senses and ensure accuracy.
Video
Final Product Complete!
Above is a visual representation of my workplace layout and how I utilized my project. I chose to face the sensor towards the register to ensure it didn't pickup irrelevant motion in the seating area.
Challenges and Improvements
I struggled with the time delay. Initially I had it set to 10 minutes and didn't know why my IFTTT wasn't working. Upon further inspection I realized it wasn't a programming issue and I just needed to shorten the time delay on the physical sensor.
I also struggled with over complicating my code and using too many unnecessary wires. The latter was an easy fix.
If I could do something differently I would likely opt to use another tube shaped item instead of a toilet paper roll to make it look nicer.