Hot Wheels Racing Photo Finish
Build a photo-finish timer for Hot Wheels races using Arduino, infrared sensors, and an LCD display.
- Arduino
- Intermediate
- 60 minutes
- 5 steps
Shop this project
CartYou'll need
Prices from vilros.com. Tax and shipping at checkout.
Before you start, you'll need
- Arduino Uno
- 2 infrared break-beam sensors
- 16×2 LCD display
- Breadboard
- Jumper wires
- Hot Wheels track
Plan the racing system
About 10 minutes
Understand how the photo-finish timer will work.
- The system uses two infrared sensors positioned at the finish line.
- Each sensor detects when a car crosses it and records the time.
- The Arduino calculates which car finished first and displays the winner on an LCD.
- Position sensors so the beams are broken when cars pass.
You should see
You understand the sensor placement and timing logic.
Wire the infrared sensors
About 15 minutes
Connect both sensors to Arduino digital pins.
- Connect the first sensor's VCC to 5V, GND to GND, and signal to digital pin 2.
- Connect the second sensor's VCC to 5V, GND to GND, and signal to digital pin 3.
- Test each sensor by checking if the signal pin reads HIGH when the beam is unbroken and LOW when broken.
You should see
Both sensors are wired and respond to interruptions.
Connect the LCD display
About 10 minutes
Wire the LCD to show race results.
- Connect the LCD to the Arduino (VCC to 5V, GND to GND, SDA to A4, SCL to A5 for I2C LCDs).
- If using a parallel LCD, connect RS, E, and data pins according to your model.
- Initialize the LCD in your sketch.
You should see
The LCD powers on and displays a startup message.
Write the timer sketch
About 20 minutes
Program the Arduino to detect and time both cars.
- Open Arduino IDE and create a new sketch.
- Copy the complete photo-finish timer sketch below.
- The sketch monitors both sensors and records finish times.
- Connect a reset button to digital pin 4 (optional).
- Upload to your Arduino.
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
const int sensor1Pin = 2;
const int sensor2Pin = 3;
const int resetButtonPin = 4;
unsigned long time1 = 0;
unsigned long time2 = 0;
bool raceStarted = false;
bool car1Finished = false;
bool car2Finished = false;
void setup() {
pinMode(sensor1Pin, INPUT);
pinMode(sensor2Pin, INPUT);
pinMode(resetButtonPin, INPUT_PULLUP);
lcd.begin(16, 2);
lcd.print("Ready to Race!");
Serial.begin(9600);
}
void loop() {
if (digitalRead(resetButtonPin) == LOW) {
resetRace();
delay(200);
}
if (!car1Finished && digitalRead(sensor1Pin) == LOW) {
time1 = millis();
car1Finished = true;
if (!raceStarted) raceStarted = true;
}
if (!car2Finished && digitalRead(sensor2Pin) == LOW) {
time2 = millis();
car2Finished = true;
if (!raceStarted) raceStarted = true;
}
if (car1Finished && car2Finished) {
displayWinner();
}
}
void displayWinner() {
lcd.clear();
if (time1 < time2) {
lcd.print("Car 1 WINS!");
lcd.setCursor(0, 1);
lcd.print("By ");
lcd.print(time2 - time1);
lcd.print(" ms");
} else if (time2 < time1) {
lcd.print("Car 2 WINS!");
lcd.setCursor(0, 1);
lcd.print("By ");
lcd.print(time1 - time2);
lcd.print(" ms");
} else {
lcd.print("PHOTO FINISH!");
lcd.setCursor(0, 1);
lcd.print("Dead Heat!");
}
}
void resetRace() {
time1 = 0;
time2 = 0;
raceStarted = false;
car1Finished = false;
car2Finished = false;
lcd.clear();
lcd.print("Ready to Race!");
}For I2C LCD, use LiquidCrystal_I2C library instead. Reset button on pin 4 with internal pullup.
You should see
The sketch compiles and uploads successfully.
Test with Hot Wheels cars
About 5 minutes
Run actual races and verify the timer.
- Position the sensors at the finish line of your Hot Wheels track.
- Release two cars and watch the LCD display the winner.
- Adjust sensor placement if cars aren't detected consistently.
You should see
The system correctly identifies which car finishes first.
It didn't work
Sensors don't detect cars.
Check that the infrared beam is at the right height for your cars. Ensure the sensors are aligned across the track width.
What to do next
Stuck? Contact Vilros Support with your board model and what you see on screen.