The DeepRacer timer is an automated timing solution which is used together with the leaderboard & timekeeper system used during DeepRacer events.
Please note that the most recent release of Raspberry Pi OS "Bookworm" is currently not supported due to changes in the way the GPIO is handled, please use "Bullseye" (Legacy) for the RPi operating system.
NOTE: At this time the Raspberry Pi 5 is not supported for automated timing due to changes in the way the GPIO is connected. Please review this issue for updates.
- Raspberry Pi 4 / Zero W (known to work)
- 2x Sound Sensors Variant 1 - Youmile (preferred) / Variant 2 - WaveShare
- 2x Pressure sensor
- 2X 1.5m, two core flat wire between sound sensor and pressure sensors
- Soldering iron
- PoE hat / case for Pi Zero https://www.waveshare.com/poe-eth-usb-hub-box.htm
- PoE splitter (for use with Pi 4) https://www.amazon.co.uk/gp/product/B0832QR4NG
Note: only required if you intend to use a PoE switch at the track for powering AP's and the Raspberry Pi
For the timer you can build your own sensors or purchase timing boards from Digital Racing Kings
- Solder a 1.5 m, two core wire to each pressure sensor. Isolate each solder with a heat shrink tube
- Attach a two pin female connector to the other end of the wire
Cable | Sound sensor | RPI 4 |
---|---|---|
Red | VCC | +3.3V, Pin 1 & 17 |
Black | GND | Pin 9 & 25 |
Yellow | DOUT | Pin 11 (GPIO17) & Pin 13 (GPIO27) |
To install the Raspberry Pi (RPi) OS on an SD card the recommended approach is using the Raspberry Pi Imager
Once installed choose the one of the following images based on the RPi being used.
- RPi 4 : Raspberry Pi OS (Other) -> Raspberry Pi OS Lite (64-bit)
- RPi Zero W : Raspberry Pi OS (Other) -> Raspberry Pi OS Lite (32-bit)
Note: Screen shot is for an RPi Zero W
Once you've selected your OS click on settings to configure the advanced settings.
Here you can set the device hostname, password, enabale SSH and (optionally) configure the WiFi settings.
For the username we recommend you use: deepracer
as this is the expected value used in the service definition.
Important: The [service-definition/deepracer-timer.service] is configured to expect the RPi username to be deepracer
, if you use a different username you will need to change the following lines for the WorkingDirectory
and ExecStart
paths and also the User
before running service-setup.js
WorkingDirectory=/home/deepracer/deepracer-timer
ExecStart=node /home/deepracer/deepracer-timer/timer.js
Restart=on-failure
User=deepracer
Once the SD card has been written, eject it from your computer, insert into the RPi and boot it up.
Go to Device Management -> Timer activation
in DREM, select a fleet and enter a hostname for the RPi and click Generate
Clicking on the Copy
button copies the activation script to your clipboard, SSH into your RPi and run the command, this will download the timer script from DREM, update your RPi with the required dependencies and install the timer service, finally the device will have AWS SSM agent installed.
This process has been tested on:
- Pi Zero W
- Pi 4
If you get an error with the service you can check the status of it using
sudo systemctl status deepracer-timer.service
And also check the journal for more detail
journalctl -e
And disable the service using
sudo systemctl disable deepracer-timer.service
If for whatever reason you are unable to use the service the timer code can be run in a loop with the command
./run_timer.sh
The pressure sensors work best when they are positioned at the back of the start / finish line and not the front (so the car has crossed the majority of the start / finish line before touching the sensors) and when positioning a car to start a race, it can be placed 50cm from the start / finish line.
The Youmile sound sensor boards have one screw (easier to use) for calibration whereas the WaveShare sound sensor boards have two screws for calibration, turn the screws to increase/decrease the pressure strip sensitivity.
-
If laps are triggered but nothing has touched the pressure sensors.Turn the screw(s) slowly until there is only one led lit.
-
If no laps are triggered. Turn the screw(s) so that both leds are lit and then slowly back until there is only one led lit.
- Go to
http://<RPI IP>:8080/admin/
using a private window in Chrome or Firefox - Log in using timekeeper credentials
- Select the event you are running from the list of events you have access to
- Use
Registration
and add a racer, click on the DeepRacer logo (top right) to go back to the event timer home page - Use
Timekeeper
select the racer you just added and test - Start the race and press the pressure sensors. This should trigger a new lap on the timekeeper website
When using the automatic timer, select the racer and have the timer on the Start race?
screen, when the car crosses the start / finish line for the first time the clock will start ticking down and the lap timer will start. This is also the case if for whatever reason a race is paused, once the car crosses the line again the clock resumes.
There is an .stl
file to print out the sensor box choose the right .stl
file for the sensors you have.
- Timerbox Youmile sensors
- Timerbox WaveShare sensors - slightly larger sensors
When updating the code please create a new leaderboard-timer.zip
file to make this easier to setup - Thank you.
From the parent directory:
zip -r website/public/leaderboard-timer.zip leaderboard-timer -x "*.git*" -x "*node_modules*" -x "*stl*" -x "*.DS_Store"