Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Basketball Blocker

Two rods driven by a stepper motor and leadscrew that extend across a basketball hoop to block shots. Four buttons select preset blocking positions.


Wiring

Board: AMIBJr.2 (Arduino Nano Every)
Power: 12–24 V input

Pin Role Notes
D2 Home sensor INPUT_PULLUP — LOW when triggered (fully extended)
D7 Stepper DIR AMIBJr.h built-in
D8 Stepper STEP AMIBJr.h built-in
D16 (A2) Stepper ENABLE Active LOW
D4 Button — Fully Open INPUT_PULLUP, LOW = pressed
D5 Button — One-Third INPUT_PULLUP, LOW = pressed
D6 Button — Two-Thirds INPUT_PULLUP, LOW = pressed
D12 Button — Fully Extended INPUT_PULLUP, LOW = pressed
D9 Indicator LED HIGH = on (system running)

Stepper microstepping pins (D10, D13, A1) are set automatically by setupAMIBJr(4) for 4× microstepping (800 steps/rev).


How It Works

On power-up, the controller homes by driving the stepper in the negative direction until the home sensor on D2 triggers. That position becomes step 0 (fully extended, fully blocking). The LED turns on when homing completes.

In normal operation, each button commands a preset target position:

Button Step target Description
D12 0 Fully Extended — rods fully out, blocking
D6 25,925 Two-Thirds extended
D5 51,851 One-Third extended
D4 77,777 Fully Open — rods retracted, not blocking

Motion is non-blocking (FlexyStepper). Pressing a button mid-move immediately updates the target — the motor smoothly redirects.

If homing fails (sensor never triggers), the controller enters a locked error state and prints a message over Serial every 5 seconds. Power-cycle to retry.


Calibration

The step count was measured with BasketballBlockerCalibration (sibling sketch). To re-calibrate, upload that sketch, jog the rods to fully open, and update FULL_EXTEND_STEPS in BasketballBlocker.ino.

Key constants to adjust in BasketballBlocker.ino:

const long  FULL_EXTEND_STEPS = 77777L;   // full rod travel in steps
const float STEPPER_SPEED_STEPS_PER_SECOND            = 3200.0f;
const float STEPPER_ACCEL_STEPS_PER_SECOND_PER_SECOND = 6400.0f;
const long  HOMING_DIRECTION = -1L;  // flip to 1L if homing goes wrong way

Serial Monitor at 9600 baud prints state transitions and button presses.

About

Carnival Conundrum - standalone exhibit

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages