Project 8 — Photo Finish (Who Really Won the Race?)

Text written by Claude Fable 5 (claude-fable-5).

Project 8 — Photo Finish (Who Really Won the Race?)

The one idea: a circuit can remember. Two cars cross two beams almost together — too close for eyes — but the box saw it, picked the winner, and keeps the winner’s light on. No arguing with the box.

This is the biggest build in the series so far, and it earns it: it’s the first circuit with memory — a state that persists after the event that caused it is long gone. Every computer memory cell is a fancier cousin of what you’ll build today. It splits naturally into two sittings: the gates (a fun session by itself) and the judge.

Which sensor for a finish line? A toy car won’t fit through a slotted optointerrupter’s 5 mm gap. Two honest options:

  • Build your own big optointerrupter (recommended, and the default below): a separate IR LED on one side of the lane, phototransistor on the other — same circuit as Project 7, just with the two halves pulled ~5–10 cm apart. “We built our own sensor” is a great flex.
  • Keep the slotted part and tape a small cardboard flag to each car’s roof, positioned so it swishes through the slot at the finish. Works, but aligning two lanes is fiddly.

What you need

Build it — stage 1: the light gates

One gate per lane, both sharing the battery rails. Note the eye is wired the other way up than in Project 7 — here we want beam present = HIGH, so the armed gate reads HIGH and a car yanks it LOW:

  +6V ──┬── 220Ω ── IR LED ──────────── GND     (one side of the lane)

        └── C (phototransistor)                 (other side, facing the LED)
               E ──┬── [gate node]
                   └── 10kΩ ── GND

Mount LED and eye facing each other across the lane, ~2–4 cm above the track so the car body (not the wheels’ gaps) breaks the beam. Straw over the eye, aimed at the LED. Test each gate alone first: hang an LED + 470 Ω from + to the gate node — it should glow when the beam is clear and blink off as your hand (or a test car) passes. Chasing alignment is the lesson here; budget playtime for it.

Sunlight warning: direct sun or a bright lamp shining into the eye floods it — the gate reads “beam present” even when blocked. Indoors, straw fitted, eye pointed away from windows.

Build it — stage 2: the judge (two 555s that lock each other out)

Each 555 is wired as a latch: a LOW blip on its trigger (pin 2) snaps its output HIGH, and it stays HIGH — that lane’s LED is on and won’t turn off. The cross-coupling makes it a fair judge: the instant one 555 latches, its output turns on a transistor that holds the other 555’s reset (pin 4) low — frozen, unable to latch, even if the second car arrives a millisecond later.

Per lane (identical twice — lane A shown; A’s lockout transistor grips B):

  1. 555 pin 1 → GND, pin 8+.
  2. Pin 6 (threshold) → GND, pin 7 unused. This disables the timer part — the 555 is now a pure latch.
  3. Pin 2 (trigger) → that lane’s gate node.
  4. Pin 4 (reset) → + through 10 kΩ.
  5. Pin 3 (output) → 470 Ω → lane LED → GND. That’s the winner light.
  6. Lockout: pin 3 also → 10 kΩ → base of an NPN; emitter → GND; collector → the other 555’s pin 4.
  7. Re-arm button: one pushbutton from both pin 4s to GND. A press forces both outputs low → both LEDs off → judge armed.

Race procedure: press re-arm (both LEDs off), release cars, and the box answers — one LED on, locked. Press to re-arm for the rematch.

What to say to the child

“When the cars finish that close, our eyes just can’t tell — and then everybody argues, right? So we built a robot judge. Each lane has an invisible light beam at the finish, and inside the box there are two little switches having their own race: whichever beam breaks first, its switch flips and instantly freezes the other one. And here’s the amazing part — the box remembers. The race is over, the cars are in your hand again, and the winner’s light is still on, because the box is holding onto what it saw. Nobody can argue with it. Not even me.”

For you — the physics

Try it with the Arduino — “won by how much?”

The latch names the winner; the Arduino can print the margin. Feed both gate nodes into digital pins (Arduino and gates must share GND; power the gates from the Arduino’s 5 V pin so logic levels match):

const int laneA = 2, laneB = 3;      // gate nodes: HIGH = beam, LOW = car
unsigned long tA = 0, tB = 0;

void setup() {
  pinMode(laneA, INPUT); pinMode(laneB, INPUT);
  Serial.begin(9600); Serial.println("Armed!");
}

void loop() {
  if (!tA && digitalRead(laneA) == LOW) tA = micros();
  if (!tB && digitalRead(laneB) == LOW) tB = micros();
  if (tA && tB) {
    Serial.print(tA < tB ? "Lane A" : "Lane B");
    Serial.print(" wins by ");
    Serial.print(abs((long)(tA - tB)) / 1000.0, 1);
    Serial.println(" ms");
    while (true) {}                  // press the Arduino reset to re-arm
  }
}

“Lane A wins by 12.4 ms” lands very well with the over-6 crowd — and with grown-up race officials. If you have a 7-segment or LCD display, print the same number there; the Serial monitor is already a fine display.

Try next

← Back to Read Me First.