Things used in this project

Hardware components:
Photon new
Particle Photon
Microcontroller that does it all
×2
13285 01
PIR Motion Sensor (generic)
Sensors used to track motion of basketball through hoop
×2
Adafruit industries ada64 image 75px
Solderless Breadboard Half Size
×2
09590 01
LED (generic)
Visual for detected motion from PIR Sensors
×2
11026 02
Jumper wires (generic)
×2
826 04
Male/Female Jumper Wires
×6
Software apps and online services:
Q8wtlimqnp04fzhtr9v5
IFTTT Maker service
Used to publish tracked shot data to Google Sheets for graphing purposes.
Particle App
Used to track motion and "made shot" events
Google sheets
Google Sheets
Made shot data stored and graphed here
Hand tools and fabrication machines:
Hand Bender
Used to bend metal strips for attachment to backboard
Impact Driver
Used to fasten metal strips to sensor configuration
Drill Tap
Used to create hole for wire pass-through in sensor configuration

Schematics

Circuit Schematic
Schematic of circuit set-up
Iot screenshot adczghvdjn
Final Setup Photon
Image of altered design of photon used during testing
Img 0675 qhfmtezheb

Code

PIR SENSOR (Top of Backboard)C/C++
Code to track motion of basketball through hoop
//PIR Sensor (Top of Backboard)

int ledPin = D0;                // Establish pin for the LED
int inputPin = D1;               // Establish input pin for PIR sensor
int pirState = LOW;             // Assume no motion detected at start
int val = 0;                    // Variable for reading the pin status

 
void setup() {
  pinMode(ledPin, OUTPUT);      // declare LED as output
  pinMode(inputPin, INPUT);     // declare PIR sensor as input
 
  Serial.begin(100);
}
 
void loop(){
  val = digitalRead(inputPin);  // read input value
  if (val == HIGH) {            // check if the input is HIGH
    digitalWrite(ledPin, HIGH);  // turn LED ON
    if (pirState == LOW) {
      // we have just turned on
      
      pirState = HIGH;
      Particle.publish("Motion_PIR_Top","Motion_detected"); //Publish event when motion detected
    }
  } else {
    digitalWrite(ledPin, LOW); // turn LED OFF
    if (pirState == HIGH){
      // we have just turned off

      pirState = LOW;
    }
  }
}
PIR SENSOR (Bottom of Backboard)C/C++
Code to track motion of basketball to hoop
//PIR Sensor (Bottom of Backboard)


int ledPin = D0;                // Establish pin for the LED
int inputPin = D1;               // Establish input pin for PIR sensor
int pirState = LOW;             // Assume no motion detected at start
int val = 0;                    // Variable for reading the pin status
int score=0;                    // Counter variable for shots made
int other_sensor=0;             // Used for delay between both sensors
int this_sensor=0;              // Used for delay between both sensor
 
void motion_track_score(const char *event, const char *data){
    other_sensor=millis();}  //Used to track time of motion event from top PIR

void setup() {
  pinMode(ledPin, OUTPUT);      // declare LED as output
  pinMode(inputPin, INPUT);     // declare sensor as input
 
 Particle.subscribe("Motion_PIR_Top",motion_track_score); //Subscribe to motion of top PIR
  
  Serial.begin(9600);
}
 
void loop(){
  val = digitalRead(inputPin);  // read input value
  if (val == HIGH) {            // check if the input is HIGH
    digitalWrite(ledPin, HIGH);  // turn LED ON
    if (pirState == LOW) {
        this_sensor=millis();  //Used to track time of motion event of bottom PIR
      
      if (abs(other_sensor-this_sensor)<=2000){  //If time between events < 2 seconds, shot is made
       score=score+1; //Increment shot counter
       Particle.publish("Basket_Made", String(score)); //Publish event and shot counter
      }
     
      // we have just turned on
      
      pirState = HIGH;
     
    }
  } else {
    digitalWrite(ledPin, LOW); // turn LED OFF
    if (pirState == HIGH){
      // we have just turned off
      
      pirState = LOW;
    }
  }
}

Credits

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

AquaNiner Pet Hydration Monitor
Intermediate
  • 333
  • 14

Full instructions

Using two Photons, IFTTT and ThingSpeak, get notifications for when your furry friend needs water and monitor how much they're drinking.

Temperature Mirror
Intermediate
  • 335
  • 8

Full instructions

The Temperature Mirror incorporates a digital display to allow its user to readily view time, temperature, humidity, and light.

Temperature Mirror

MEGR3171 Team 49

Pet Feeder
Intermediate
  • 362
  • 7

Full instructions

Automated pet food dispenser to feed our pets when we are not at home by using an IoT device.

Teacher Tracker
Intermediate
  • 150
  • 4

Full instructions

If you want to know when a professor comes back to his/her office so you can ask annoying questions then this an option

LightAlert
Intermediate
  • 122
  • 4

Full instructions

As the great Terry Crews once said "that's 49 cents of milk spilt over the table! Somebody's gonna drink that!" But instead... electricity.

Alerts via Pushbullet When Smoke is Detected
Intermediate
  • 294
  • 8

Full instructions

This project uses two Particle Photons and Pushbullet to notify a user when smoke is detected by a smoke detector.

ProjectsCommunitiesContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login
Respect project
Feedback