Repository navigation
Releases
Release v1.2.0
Highlights
- Debug mode switch. A new DEBUG setting in lap_timer/config.py (default False) controls verbosity. In normal use the console is quiet. Startup still prints the Pi's IP addresses so you can find them for the tablet, and errors are still shown.
- Quieter console. Per-request access log lines are hidden by default. Set DEBUG = True to get Flask debug mode (debugger and reloader) and the access logs back.
- New docs. The README has new sections with screenshots and a buy link for the lane sensors, plus new ARCHITECTURE.md, BUILDERS_GUIDE.md and CONTRIBUTING.md files.
Changes
Behavior
The server no longer logs every request by default. Startup messages and errors are still printed.
app.run() now takes its debug and request-handler settings from config.DEBUG. The reloader stays off, so GPIO pins are not claimed twice.
Documentation
README: new "buy sensors" section with an Amazon affiliate link and disclosure.
README: new "screenshots" section with the race setup (mode selection) and race screen on iPad.
README: the architecture list now mentions DEBUG, and there is a new "debug mode" section under setup.
README: the setup section now notes that the IP address is printed on startup.
New files: ARCHITECTURE.md, BUILDERS_GUIDE.md, CONTRIBUTING.md.
New images: static/ipad-laptimer-mode-selection.png and static/ipad-laptimer-race-screen.png.
Housekeeping
- New VERSION file.
Upgrade notes
- No config changes are required. The default is quiet output.
- To get the old verbose behavior with the Flask debugger, set DEBUG = True in lap_timer/config.py. Do not leave it on in production, since the Flask debugger is enabled.
Release v1.1.1
Release v1.1.1
Fixes startup and install errors on a fresh Raspberry Pi.
Features
- Added 4 lane support. Submit PINs on startup or set in configuration
Fixes
- Fixed the "Failed to add edge detection" crash on startup. Flask's debug reloader started the app twice, and the second process failed to claim the GPIO pins. The reloader is now disabled.
- Fixed installation on current Raspberry Pi OS (Bookworm or newer). The old
RPi.GPIOpackage is replaced byrpi-lgpio, a drop-in replacement that works there.
Install
The install steps are now in the README. rpi-lgpio compiles a C extension, so install the build tools first:
sudo apt update
sudo apt install -y swig python3-dev python3-venv liblgpio-dev
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
Upgrading from v1.1
If you installed with the old RPi.GPIO, run pip uninstall RPi.GPIO and then pip install -r requirements.txt.
Release v1.1
Carrera Lap Timer v1.1
A lightweight lap timer for analog slot car racing (Carrera and similar), running on a Raspberry Pi. It reads two lane sensors over GPIO and serves a web UI you can open on an iPad or any browser on your network.
Features
- Two-lane timing with current lap, last lap, fastest lap and lap count per lane
- Race setup screen: choose a race by number of laps or by race time
-- Laps: a lane finishes when it reaches the target. The race ends when both lanes are done, and the first to finish wins.
-- Time: the clock stops at the limit and each car finishes its current lap. The most laps wins, and ties go to the car that crossed the line first. - Race screen showing the goal, remaining time (time mode), laps as "3 / 10" and the winner when the race is over
- Start lights with a randomized start, like the real thing
- Stop, continue and reset. Reset returns to the setup screen.
- Sensor bounce filter: crossings on the same lane closer than
MIN_LAP_SECONDS (default 1.0 s, inlap_timer/config.py) are ignored - Manual lap buttons for testing without hardware
Getting started
pip install flask # on the Pi, RPi.GPIO is also needed
python CarreraLapTimer.py
Open http://<pi-address>:5000 in a browser. Sensors are expected on GPIO 18 (lane 1) and 23 (lane 2). You can change the pins in `lap_timer/config.py. Without RPi.GPIO (for example on a laptop), the app runs fine and you can use the manual lap buttons.
Known limitations
The sensor is read on both edges (GPIO.BOTH). If one crossing produces two edges, the bounce filter drops the second, but the right edge setting depends on your sensor wiring. If a car never crosses the line after the race ends, the race stays open until you press Reset. Race state is kept in memory, so restarting the server clears it. The default MIN_LAP_SECONDS of 1.0 s should be clearly below your fastest lap. Adjust it for your track.
Tests
python -m unittest discover -s tests -v