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

Run Google Assistant on Your Amazon Echo
Intermediate
  • 2,210
  • 21

Full instructions

This is an implementation of the Google Assistant API wrapped as an Alexa skill.

DIY Smart Assistant Speaker/Lamp (Google Home or Alexa)
Intermediate
  • 2,033
  • 5

Full instructions

DIY build using 3D printed enclosure and parts, a recycled Bluetooth speaker, a Raspberry Pi, and a Philips Hue light bulb.

Who is it? It's Edison.
Intermediate
  • 62
  • 1

Full instructions

This is a smart video doorbell using an Intel Edison as main hardware with Youtube and Twilio for communication with the user.

ConnectTheDots with Particle Azure IoT Hub Integration
Intermediate
  • 582
  • 7

Protip

This project will allow you to connect your Particle device into an Azure IoT Hub for viewing data in real-time through an ASP.NET web app!

Other Clocks
Intermediate
  • 189
  • 3

Work in progress

A combination of 3 different clocks in one frame.

Edison Candle
Intermediate
  • 424
  • 6

Work in progress

Soothing LED candle based on the Intel Edison running Android Things.

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login