FINAL PROJECT
MISSION IDENTITY
FINAL PROJECT
The AI Goal Sentinel is a portable device that turns any regular soccer goal into a smart training system. You simply attach it to the crossbar, and it is ready to use. It automatically detects your shots and sends data instantly to your phone or computer, showing you the speed of the ball and exactly where it entered the goal. It turns a normal practice session into a fun, measurable game.
I am making this project because professional football tools are usually too expensive and hard to use for normal players. Most people cannot measure how fast they shoot or improve their accuracy with data. This project solves that problem by creating a cheap and easy-to-use device that lets anyone track their progress, just like professional athletes do.
THE ORIGIN STORY (MOTIVATION)
I have been passionate about football since I was a kid. It's not just a hobby; it's part of who I am. However, training alone can be difficult without feedback. I often wonder: "How fast was that shot?" or "Did I hit the corner precisely?"
This project combines my love for the sport with digital fabrication. My goal is to build a device that helps players like me improve their accuracy and power through real-time data, making training sessions more effective and fun.
TECHNICAL BLUEPRINT (THE ARSENAL)
The AI Goal Sentinel is an autonomous device designed to attach to any standard goalpost. To achieve portability and precision, the system integrates the following hardware components:
A. ELECTRONICS & LOGIC
- XIAO ESP32C6: Powerful microcontroller with integrated Wi-Fi and Bluetooth unit running bare-metal C for microsecond precision.
- Custom PCB: Fabricated board to integrate MCU, hardware protection, and sensor connections.
- 8x Diffuse Photoelectric Sensors (3m): Industrial-grade laser sensors arranged to create an invisible speed trap.
- SS14 SMD Diodes: Critical logic-level hardware protection.
B. POWER & MECHANICS
- Powerbank (5V): Provides portable autonomy.
- 3D Printed Body: Weather-resistant cases ensuring sensors correctly face the player in parallel lines.
- Velcro Straps: Flexible quick-release mechanism for the posts.
R&D: SENSOR EVALUATION & PLOT TWIST
CRITICAL RESEARCH: BALL DETECTION
To catch a football traveling at 70+ km/h, the optical hardware needs an insanely fast response time. I initially evaluated a standard 30cm diffuse sensor but rejected it due to its short range. I then considered complex retroreflective sensors, but a major breakthrough changed the project's direction.
1. Solviora E3F-DS30C4 (Standard)
- Response Time: 1 ms (Excellent)
- Range: 3 - 80 cm
- Verdict: REJECTED
Analysis: While the 1ms response time was perfect for high-speed tracking, its maximum range of 30 cm is a critical failure point. A football passing through the center of the net would go undetected.
2. E3F 3-Meter Diffuse Variant
- Response Time: 1 ms (Instant Reaction)
- Range: Up to 3 Meters (300 cm)
- Verdict: SELECTED
Analysis: THE PLOT TWIST. I discovered an upgraded industrial variant of the yellow sensor that extends the diffuse range to a massive 3 meters. This eliminates the need to align complex reflector plates across the goal, while keeping the crucial 1ms reaction time to prevent blind spots. Best of all: it keeps the budget low.
Initial Concept Sketch v1.0
Fig 1. First hand-drawn visualization of the system components and placement on the goal frame.
SYSTEM DESIGN: SMART GOAL STRUCTURE
FULL-SCALE GOAL CONCEPT
The system will be implemented on a physical goal structure with a size of 1 meter height and 1.3 meters width. This compact format allows portability while still providing a realistic training experience.
The design includes a total of 8 sensors, distributed symmetrically: 4 sensors on the left post and 4 sensors on the right post.
These sensors create multiple detection zones across the goal area. When the ball crosses, the system identifies the entry position, approximates the shot trajectory, and calculates speed using the time difference between sensor triggers.
SYSTEM DIAGRAM
Fig 2. Sensor distribution along both vertical posts to detect ball crossing position and speed.
SYSTEM WORKFLOW
THE LOGIC: TIME-OF-FLIGHT GATE
BUILDING AN INVISIBLE TUNNEL
Instead of using expensive Doppler radars or complex 160-degree camera tracking, the AI Goal Sentinel uses pure physics. We are building a "Speed Trap" (Time-of-Flight Gate) identical to the ones used in ballistic chronographs and professional sports setups.
- 4 sensors are placed on the front edge of the goal post, and 4 sensors are placed on the back edge, creating two perfectly parallel laser planes separated by a known physical distance.
- When the ball crosses the first plane, it triggers a hardware interrupt. The XIAO ESP32C6 starts a high-precision internal microsecond timer.
- When the ball crosses the second plane, the timer is stopped.
- Using the fixed distance and the exact time difference, the MCU calculates the final speed using standard kinematics: v = d / Δt.
THE HARDWARE SHIELD: SS14 DIODES
Moving to industrial 3-meter sensors created a massive electrical hazard. The chosen sensors operate at 12V, but the XIAO ESP32C6 microcontroller operates strictly at 3.3V. If a 12V signal hits the XIAO pins, the board will fry instantly.
- The diode is placed with its cathode (grey line) pointing toward the sensor's signal wire.
- Idle (No Ball): The sensor outputs 12V. The diode blocks it entirely. The XIAO pin remains safely HIGH via its internal 3.3V pull-up.
- Triggered (Ball Detected): The NPN sensor connects the line to Ground (0V). The diode "opens", pulling the XIAO pin to LOW, successfully registering a hit without exposing the board to dangerous voltages.
PROTOTYPE TESTS — PROOF OF CONCEPT
TEST 01 — INFRARED DISTANCE SENSORS
TEST 02 — AI VISION: VIRTUAL GOAL ZONE
How It Works — The 5-Step Architecture
<video> tag. Over that video, we place two transparent elements using CSS absolute positioning: The Crosshair (follows the finger) and The Goal Zone (the target).
ml5.handpose(). The AI places exactly 21 tracking landmarks on the hand's joints. Landmark #8 is always the tip of the index finger. JavaScript reads its X and Y coordinates every frame.
// Get the raw coordinates of Landmark #8 (Index Finger Tip)
let x = results[0].landmarks[8][0];
let y = results[0].landmarks[8][1];
let invertedX = 640 - x;. Then we check all four boundaries to see if the finger is inside the goal area.
let invertedX = 640 - x; // Fix the webcam mirror effect
let isInside = (invertedX > 195 && invertedX < 445 && y > 150 && y < 330);
if (isInside) {
goalAlert.innerText = "GOAL SCORED!";
}
System In Action
AI SIDEKICK LOG
Full Disclosure: To bring this AI Vision prototype to life, I enlisted the help of an AI assistant (Gemini) as a coding co-pilot. I knew conceptually what I wanted (tracking a finger to trigger a physical LED goal), but the AI pointed me to ml5.js for the hand-tracking network and the Web Serial API to bridge the browser with the hardware. Together we iterated on the mirror correction trick and the hit-box math. All final decisions, testing, and hardware validation were done by me.
TEST 03 — SPEED TRAP (15CM BENCH TEST)
const int sensorAdelante = 28;
const int sensorAtras = 5;
const float distancia_metros = 0.15;
volatile unsigned long tiempoInicio = 0;
volatile unsigned long tiempoFin = 0;
volatile bool enVuelo = false;
volatile bool calculoListo = false;
// Hardware Interrupts triggered on RISING signal (0V to 3.3V)
void isrAdelante() {
if (!enVuelo) {
tiempoInicio = micros();
enVuelo = true;
}
}
void isrAtras() {
if (enVuelo && !calculoListo) {
tiempoFin = micros();
calculoListo = true;
}
}
void setup() {
Serial.begin(115200);
pinMode(sensorAdelante, INPUT);
pinMode(sensorAtras, INPUT);
attachInterrupt(digitalPinToInterrupt(sensorAdelante), isrAdelante, RISING);
attachInterrupt(digitalPinToInterrupt(sensorAtras), isrAtras, RISING);
}
void loop() {
if (calculoListo) {
unsigned long deltaMicros = tiempoFin - tiempoInicio;
float tiempoMs = deltaMicros / 1000.0;
// v = d / t
float tiempoSegundos = deltaMicros / 1000000.0;
float velocidadMs = distancia_metros / tiempoSegundos;
float velocidadKmh = velocidadMs * 3.6;
Serial.print("HIT:");
Serial.print(velocidadKmh);
Serial.print(":");
Serial.println(tiempoMs);
enVuelo = false;
calculoListo = false;
}
}
STRATEGIC TIMELINE
Roadmap aligned with the Fab Academy 2026 Official Schedule.
-
WEEK 1 (JAN 21)
Project Management
Defining the concept, sketching the initial idea, and setting up the documentation website (Git & HTML).
-
WEEK 2 (JAN 28)
Computer-Aided Design
Creating the first 2D and 3D representations of the goal structure using SolidWorks.
-
WEEK 3 (FEB 04)
Computer-Controlled Cutting
Laser cutting a scale model to test the mechanism and verify the folding system.
-
WEEKS 6-8 (FEB-MAR)
Electronics Design & Production
Designing the custom PCB in KiCad (Week 6) and fabricating it (Week 8) to house the ESP32 and power management.
-
WEEK 7 (MAR 04)
Computer-Controlled Machining
Designing and cutting the full-scale frame structure using the monofab. Testing stability on the field.
-
WEEK 9 (MAR 18)
Input Devices
Calibrating the sensors to determinate speed and position of the ball when it crosses the goal line.
-
WEEK 11 (APR 01)
Networking & Communications
Programming the ESP32 to communicate wirelessly (Wi-Fi/Bluetooth) and send score data to a device.
-
WEEK 14 (APR 29)
Interface Programming
Developing the visual App or Web Dashboard where the player sees their speed and accuracy stats.
-
WEEKS 15-17 (MAY)
System Integration & Development
Final assembly, 3D printing enclosure, cable management, field testing, and recording the presentation video.