GIU-F1Tenth / GIU-F1Tenth/pitlane-utils
Implement Lap Timer System
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
📝 Ticket Description:
Develop a lap timing system for the F1TENTH car using a distance-based sensor (e.g., TOF or laser) to detect when the car passes a fixed point on the track. The system should measure lap time and send data to a laptop for visualization and control using MQTT or UART communication.
Core Features
- Use a TOF or laser sensor to detect car crossing (based on distance changes).
- Use ESP32 (preferred for Wi-Fi/MQTT) or STM32 + UART to:
- Monitor sensor data
- Detect when the car passes
- Start/stop/reset the lap timer
- Communicate with a laptop
- Laptop script (Python + MQTT or serial):
- Display lap times
- UI with Start / Stop / Reset buttons
- Store multiple laps
Possible Architectures
ESP32-based System
ESP32 reads TOF sensor (via I2C or SPI)
Detects car crossing
Publishes lap times via MQTT over Wi-Fi to a laptop (laptop runs AP or joins ESP32 network)
Laptop visualizes data and controls via Python script
STM32 + TOF + UART
STM32 reads TOF sensor
Lap time calculated on STM32
Sends lap time over UART to ESP32 or directly to laptop
Laptop displays UI
Alternative Ideas (open to discussion)
Dual TOF sensors to detect direction of crossing
Laser diode + photodiode pair for high-speed trigger
Infrared beam break method
Requirements
Precise distance thresholding to detect a passing car
Debounce logic to avoid multiple triggers from a single pass
Lap time accuracy to milliseconds
Reliable wireless or wired communication with minimal delay
Configurable detection parameters (e.g., car width, trigger threshold)
Deliverables
Working firmware on ESP32 or STM32
Python script for the laptop (MQTT or UART based)
Basic UI with Start / Stop / Reset
Documented code + wiring + setup guide
Stretch Goals (Optional)
Support multiple cars and track IDs
Store historical lap data in CSV or plot it
OTA updates for ESP32 firmware
Display module showing current lap time in real time (e.g., OLED)
🔁 Flowchart
Here's a flowchart to explain the general logic:
+---------------------------+
| Power On |
+------------+--------------+
|
v
+---------------------------+
| Initialize Sensor + WiFi |
+------------+--------------+
|
v
+-------------------------------+
| Wait for "Start" Command from |
| Laptop via MQTT or UART |
+------------+------------------+
|
v
+---------------------------+
| Monitor Distance Reading |
+------------+--------------+
|
(distance < threshold ?)
/ | \
yes debounce no
| | |
v v |
+-----------------+ +--------+
| Trigger Lap End | |
+--------+--------+ |
| |
[Compare timestamp, calc Δt] |
| |
+-------v-------+ |
| Send Lap Time |<------------+
| to Laptop via |
| MQTT / UART |
+-------+-------+
|
+-------v-------+
| Wait for next |
| pass or Stop |
+---------------+
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.