SparkFun Forums 

Where electronics enthusiasts find answers.

User avatar
By LAZ900
Hey Spark Fun,

Hope all is well and I'm currently working on a fitness project where I'm trying to figure out a way to calculate when basketball goes through a basketball hoop.

Can you please point me in the right direction of which sensor I might need and programming language for it?

Please give me your thoughts as soon as you can---I could really use some true guidance on this.

I look forward to hearing anyone.
User avatar
By TS-Chris
Hi Laz.

A basketball hoop sensor could be something really simple like a momentary switch to something really complex like a light beam break sensor or a distance sensor.

I've never tried to build a sensor to detect a ball going through a hoop, but you might want to start with a simple solution first and see if that does what you're looking for. You may find during your testing that a single sensor doesn't work and might need to use multiple switches or a switch and a second type of sensor that both need tripped to prevent false triggers.

What I would try first is putting some sort of lever inside or under the hoop the gets pushed aside by the ball as it's falling through the hoop. On the other end of the lever you'd stick a micro switch similar to but not necessarily the same as one like this switch. The idea is that when the ball falls through, it moves the lever and presses the switch indicating a ball has gone through.

A switch doesn't have a programming language, but you're likely going to want the switch connected to a microcontroller that reads the position of the switch and takes some sort of action when the switch changes states. There are many microcontroller platforms available, but one of the most commonly used ones for hobbyists is the Arduino Uno. Arduino has it's own programming language but it's based on C so if you know C, it should be really simple to write code for it.