Skip to content

Garage Parking Traffic Light

A wall-mounted traffic light that beeps faster and turns red as your car gets close, so you stop right in the spot.

Try it

Simulated time

Behavior simulation: shows what it should do. It does not run the code.

Try this: Slide the car distance slowly from 3 m down to 0.4 m: watch green turn yellow then red while the beeping speeds up, then wait 20 s for it to go quiet.

Controls

  • Car distance from wall3 m
  • 'Set spot' button (hold 3 s)

What it does

Red light
Yellow light
Green light
Light colour seen
Beeper
Measured distance
Stop spot
Gone quiet (car still 20 s)
What it's doing

What it does

A small box mounts on the garage wall facing the front of your car. An ultrasonic sensor inside measures how far away the car is, using sound pulses too high for people to hear. A bright three-colour light shows green while you have room, yellow as you get close and red when you should stop, and a beeper speeds up as you get closer. A button lets you set your own perfect stopping spot. It runs from a plug-in 5 V USB adapter, and the light and beeper switch themselves off when the car stays still.

Try it above: Slide the car distance slowly from 3 m down to 0.4 m: watch green turn yellow then red while the beeping speeds up, then wait 20 s for it to go quiet.

Safety

  • The beeper can be loud at close range; it has a mute switch and goes quiet by itself after the car stops
  • The box must be screwed firmly to the wall so it can't fall on the car or a person; screws and wall anchors are included
  • Use only the supplied 5 V USB power adapter; everything inside the box runs on 5 V
  • Keep the sensor out of the way of car doors and bikes so it doesn't get knocked or bumped into
  • It is a parking aid only: still watch where you're driving and look out for children, pets or objects the sensor might miss

What’s inside

21 parts. We buy, make and put these together for you.

Brain

Runs the program and makes the decisions.

$25.70
  • Arduino Nano1×

    $25.70

    The small brain that reads the distance, picks the light colour, runs the beeper and remembers your stop spot.

    • 18 × 45 × 8 mm
    • Memory: stop spot saved in built-in EEPROM
    • Runs on: 5 to 12 V
    • Draws: about 20 mA
    • Weight: 7 g
    list price, checked Oct 5, 2026 at a generic supplierView

Senses

Measures the world around it.

$3.95
  • HC-SR04 ultrasonic distance sensor (5 V)1×

    $3.95

    Sends out sound pulses too high to hear and times the echo to measure how far away the car is.

    • 46 × 20 × 16 mm
    • Note: 5 V board, so no level shifter needed
    • Range: 0.02 to 4
    • Runs on: 4.5 to 5.5 V
    • Draws: about 15 mA
    list price, checked Oct 5, 2026 at AdafruitView

Controls

What you press, turn or flip.

$2.45
  • Panel-mount push button, 16 mm1×

    $0.95

    Hold for 3 seconds with the car parked to save the current distance as the stop spot.

    • 18 × 18 × 29 mm
    • Pullup: board internal pull-up
    • Runs on: 0 to 12 V
    • Weight: 4.6 g
    list price, checked Oct 5, 2026 at AdafruitView
  • Panel-mount mini toggle switch (mute)1×

    $1.50

    Flip it to turn the beeper on or off; the lights keep working.

    • 13 × 10 × 10 mm
    • Type: SPST, 6 mm panel hole
    • Pullup: board internal pull-up
    estimate

Lights, sound and screen

How it tells you what it is doing.

$6.40
  • 5 mm LED, diffused red1×

    $0.50

    The red light that tells you to stop.

    • 6 × 6 × 9 mm
    • Runs on: 1.85 to 2.5 V
    • Draws: about 15 mA
    list price, checked Oct 5, 2026 at SparkFunView
  • 5 mm LEDs, assorted colors (white, blue, green, yellow, red)2×

    $4.95

    The green light (plenty of room) and the yellow light (getting close).

    • 6 × 6 × 9 mm
    • Colours used: 1 green, 1 yellow
    • Runs on: 1.8 to 3.4 V
    • Draws: about 15 mA

    Pack of 25, you use 2, the 23 spares are yours.

    list price, checked Oct 5, 2026 at AdafruitView
  • Active buzzer, 5 V1×

    $0.95

    Makes the beeping that speeds up as the car gets closer.

    • 12 × 12 × 10 mm
    • Runs on: 3 to 5.5 V
    • Draws: about 25 mA
    list price, checked Oct 5, 2026 at AdafruitView

Power

Where its energy comes from.

$7.95
  • 5 V 2 A wall power supply (UL listed, 2.1 mm plug)1×

    $7.95

    Plugs into a household power outlet and gives the box safe low-voltage 5 V power.

    • 45 × 65 × 30 mm
    • Plug: 2.1 mm barrel
    • Runs on: 5 to 5.25 V
    • Draws: about 1000 mA
    • Weight: 76 g
    list price, checked Oct 5, 2026 at AdafruitView

Small electronics and wiring

Resistors, connectors and cables that join it all up.

$40.59
  • Resistor 220 Ω, 1/4 W, 5 %1×

    $0.75

    Limits the current to each light so the LEDs don't burn out (3 used).

    • 6 × 3 × 3 mm
    • Value: 220 ohm
    • Runs on: 0 to 300 V

    Pack of 25, you use 1, the 24 spares are yours.

    list price, checked Oct 5, 2026 at AdafruitView
  • PN2222 NPN transistor (2N2222 equivalent)1 packs

    $1.95

    A tiny electronic switch that powers the buzzer so the board's pin isn't overloaded.

    • 5 × 4 × 5 mm
    • Runs on: 0 to 40 V
    list price, checked Oct 5, 2026 at AdafruitView
  • Resistor 1 kΩ, 1/4 W, 5 %1×

    $0.75

    Sets a safe small current from the board into the buzzer transistor (1 used).

    • 6 × 3 × 3 mm
    • Value: 1 kohm
    • Runs on: 0 to 300 V

    Pack of 25, you use 1, the 24 spares are yours.

    list price, checked Oct 5, 2026 at AdafruitView
  • DC barrel jack to screw terminal adapter (female)1×

    $3.75

    The socket on the box where the power adapter plugs in.

    • 14 × 30 × 13 mm
    • Runs on: 0 to 24 V
    • Draws: about 0 mA
    list price, checked Oct 5, 2026 at SparkFunView
  • Electrolytic capacitor 100 µF 25 V1×

    $7.99

    Smooths the power so the sensor readings stay steady when the buzzer switches on.

    • 6 × 6 × 11 mm
    • Value: 100 uF 25 V
    • Runs on: 0 to 25 V

    Pack of 50, you use 1, the 49 spares are yours.

    list price, checked Oct 6, 2026 at AmazonView
  • Perma-Proto half-size solderable breadboard PCB1×

    $4.50

    Holds the board and small parts firmly together inside the box.

    • 81 × 51 × 2 mm
    • Weight: 12 g
    list price, checked Oct 5, 2026 at AdafruitView
  • Hook-up wire 22 AWG solid core, 6 x 25 ft1 sets

    $15.95

    Connects the lights, button, switch and sensor to the circuit board.

    • 25 × 5.1 × 5.1 cm
    • Weight: 340.7 g
    list price, checked Oct 5, 2026 at AdafruitView
  • Heat-shrink tubing assortment1 packs

    $4.95

    Insulates wire joints so nothing can short out.

    • 15 × 0.5 × 0.5 cm
    list price, checked Oct 5, 2026 at AdafruitView

Body and structure

The case, frame and panels.

$4.00
  • 3D-printed enclosure with lid and light hood1×

    $4.00

    The box that holds everything, with holes for the sensor eyes, the three lights, button, switch and power socket, plus wall-mount tabs.

    • 11 × 6.6 × 18 cm
    • Size: 80 x 50 x 180
    • Features: sun hood over lights, 2 screw tabs
    • Material: PETG
    Made by usestimate

Fixings

Screws, bolts and ties that hold it together.

$18.94
  • Brass heat-set insert, M3 x 4 mm6×

    $5.95

    Strong metal threads in the plastic so the lid and circuit board screw in securely.

    • 4 × 4 × 4 mm

    Pack of 50, you use 6, the 44 spares are yours.

    list price, checked Oct 5, 2026 at AdafruitView
  • M3 socket head screw (6-30 mm)6×

    $9.99

    Hold the lid and the circuit board in place.

    • 6 × 6 × 13 mm
    • Length: 8 mm

    Pack of 1120, you use 6, the 1114 spares are yours.

    list price, checked Oct 5, 2026 at AmazonView
  • Wall screw and anchor2 sets

    $3.00

    Fix the box firmly to the garage wall so it can't fall.

    • 14 × 2 × 14 mm
    • Plug: 6 mm nylon
    • Count: 2
    • Screw: 4 x 40 mm
    estimate

Other

$1.00
  • Printed labels1 sets

    $1.00

    Name the button, mute switch and power socket so they're easy to use.

    • 56 × 0 × 8 mm
    • Material: vinyl sticker
    Made by usestimate

Parts total (21 lines)

$110.98

$101.48 from supplier list prices, $9.50 estimated. Preparation and shipping are added when you order.

How it goes together

The step-by-step instructions that come with your order, 4 steps. Try them here first.

Before you start

Garage Parking Traffic Light goes together in 4 steps, about 40 min in all. No soldering and no coding.

Already done in our workshop

  • Print the enclosure and fit the threaded inserts
  • Build the circuit board
  • Fit the front-panel parts
  • Wire everything together
  • Load the program and test
  • Close up, label and pack

Have these ready

  • Tape measure
  • Pencil
  • Drill
  • Screwdriver

4 steps

Code

The code it runs1 file, 224 lines. We load it onto the board for you.

Uses: EEPROM (built-in)

parking_helper/parking_helper.ino
/*  ===========================================================  Tinkerly - Garage Parking Helper (Arduino Nano firmware)  ===========================================================  What this program does, in plain words:  - About 16 times a second it sends a silent sound pulse from the    ultrasonic sensor and times the echo to work out how far away    the front of the car is.  - Single odd readings are thrown away (middle-of-three filter) and    the rest are smoothed (running average), so the lights don't flicker.  - Light and beeper:      * Nothing closer than 2.5 m      -> all lights off, no beeping      * More than 1.0 m before the spot -> GREEN light, slow beep      * Within 1.0 m of the stop spot   -> YELLOW light, beeps get faster      * At the stop spot or closer      -> RED light, steady tone  - If the car hasn't moved for 20 seconds, the light and beeper switch    off (sleep). Any movement wakes it up again.  - Hold the 'Set spot' button for 3 seconds with the car parked where    you like it: that distance becomes the new stop spot. It is saved    in the board's memory (EEPROM) so it survives a power cut. All three    lights flash briefly to confirm.  - The Mute switch is wired directly in the beeper line, so it silences    the beeper without the program needing to know.   Pins (match the wiring list exactly):    D2 -> sensor TRIG        D3 <- sensor ECHO    D4 -> red LED            D7 -> green LED      D8 -> yellow LED    D5 -> beeper (through the Mute switch)    D6 <- 'Set spot' button (other side to GND, uses internal pull-up)  ===========================================================*/ #include <EEPROM.h> // ---------- Pin numbers ----------const uint8_t PIN_TRIG   = 2;const uint8_t PIN_ECHO   = 3;const uint8_t PIN_RED    = 4;const uint8_t PIN_BEEP   = 5;const uint8_t PIN_BUTTON = 6;const uint8_t PIN_GREEN  = 7;const uint8_t PIN_YELLOW = 8; // ---------- Settings (distances in metres, times in milliseconds) ----------const float    START_DIST      = 2.5;    // closer than this = car is comingconst float    YELLOW_BAND     = 1.0;    // yellow zone length before stop spotconst float    DEFAULT_STOP    = 0.5;    // stop spot used until the user sets oneconst float    STOP_MIN        = 0.1;    // allowed range for a saved stop spotconst float    STOP_MAX        = 2.4;const float    MOVE_THRESHOLD  = 0.02;   // 2 cm change counts as 'moving'const float    SMOOTHING       = 0.35;   // how quickly the average follows new readingsconst float    NO_ECHO_DIST    = 4.0;    // used when no echo comes back (nothing there)const unsigned long MEASURE_EVERY = 60;     // ms between sensor pingsconst unsigned long SLEEP_AFTER   = 20000;  // ms without movement before going quietconst unsigned long HOLD_TIME     = 3000;   // ms to hold button to save stop spotconst unsigned long CONFIRM_TIME  = 1000;   // ms of light flashing after savingconst unsigned long ECHO_TIMEOUT  = 25000;  // us, about 4.3 m maximum // ---------- Saved settings in EEPROM ----------const int      EEPROM_ADDR  = 0;const uint16_t EEPROM_MAGIC = 0x7A51;  // marks that a valid value was savedstruct SavedData { uint16_t magic; float stopSpot; }; // ---------- Working variables ----------float stopSpot = DEFAULT_STOP;float avgDist  = NO_ECHO_DIST;  // smoothed distancefloat refDist  = NO_ECHO_DIST;  // distance when car last 'moved'float raw[3]   = {NO_ECHO_DIST, NO_ECHO_DIST, NO_ECHO_DIST};uint8_t rawIndex = 0; unsigned long lastMeasureAt = 0;unsigned long lastMoveAt    = 0;unsigned long holdStart     = 0;unsigned long savedAt       = 0;bool buttonWasDown = false;bool holdDone      = false;bool confirming    = false; enum Zone { ZONE_FAR, ZONE_GREEN, ZONE_YELLOW, ZONE_RED, ZONE_SLEEP }; // ---------- Helpers ----------float clampF(float v, float lo, float hi) { return v < lo ? lo : (v > hi ? hi : v); } float mapF(float x, float inLo, float inHi, float outLo, float outHi) {  return outLo + (x - inLo) * (outHi - outLo) / (inHi - inLo);} // Middle value of three: throws away a single odd readingfloat median3(float a, float b, float c) {  if ((a <= b && b <= c) || (c <= b && b <= a)) return b;  if ((b <= a && a <= c) || (c <= a && a <= b)) return a;  return c;} // One sensor ping. Returns distance in metres.float readDistance() {  digitalWrite(PIN_TRIG, LOW);  delayMicroseconds(3);  digitalWrite(PIN_TRIG, HIGH);  delayMicroseconds(10);  digitalWrite(PIN_TRIG, LOW);  unsigned long us = pulseIn(PIN_ECHO, HIGH, ECHO_TIMEOUT);  if (us == 0) return NO_ECHO_DIST;          // no echo: nothing in range  return (us * 0.000343) / 2.0;              // speed of sound, there and back} void loadStopSpot() {  SavedData d;  EEPROM.get(EEPROM_ADDR, d);  if (d.magic == EEPROM_MAGIC && d.stopSpot >= STOP_MIN && d.stopSpot <= STOP_MAX) {    stopSpot = d.stopSpot;  } else {    stopSpot = DEFAULT_STOP;  }} void saveStopSpot(float v) {  SavedData d = { EEPROM_MAGIC, v };  EEPROM.put(EEPROM_ADDR, d);  // put() only rewrites bytes that changed} void setLights(bool r, bool y, bool g) {  digitalWrite(PIN_RED, r ? HIGH : LOW);  digitalWrite(PIN_YELLOW, y ? HIGH : LOW);  digitalWrite(PIN_GREEN, g ? HIGH : LOW);} // ---------- Setup: runs once at power-on ----------void setup() {  pinMode(PIN_TRIG, OUTPUT);  pinMode(PIN_ECHO, INPUT);  pinMode(PIN_RED, OUTPUT);  pinMode(PIN_YELLOW, OUTPUT);  pinMode(PIN_GREEN, OUTPUT);  pinMode(PIN_BEEP, OUTPUT);  pinMode(PIN_BUTTON, INPUT_PULLUP);  // pressed = LOW  digitalWrite(PIN_TRIG, LOW);  digitalWrite(PIN_BEEP, LOW);  setLights(false, false, false);   loadStopSpot();   // Start the average from a real reading so it doesn't 'slide in'  float first = readDistance();  for (uint8_t i = 0; i < 3; i++) raw[i] = first;  avgDist = first;  refDist = first;  lastMoveAt = millis();} // ---------- Main loop: runs over and over ----------void loop() {  unsigned long now = millis();   // 1) Measure and smooth the distance every MEASURE_EVERY ms  if (now - lastMeasureAt >= MEASURE_EVERY) {    lastMeasureAt = now;    raw[rawIndex] = readDistance();    rawIndex = (rawIndex + 1) % 3;    float filtered = median3(raw[0], raw[1], raw[2]);    avgDist = avgDist + (filtered - avgDist) * SMOOTHING;     // 2) Has the car moved? If so, reset the 20 s sleep timer    if (fabs(avgDist - refDist) > MOVE_THRESHOLD) {      refDist = avgDist;      lastMoveAt = now;    }  }   // 3) 'Set spot' button: hold 3 s to save current distance  bool buttonDown = (digitalRead(PIN_BUTTON) == LOW);  if (buttonDown && !buttonWasDown) {        // just pressed    holdStart = now;    holdDone = false;    lastMoveAt = now;                         // wake up while setting  }  if (buttonDown && !holdDone && now - holdStart >= HOLD_TIME) {    stopSpot = clampF(avgDist, STOP_MIN, STOP_MAX);    saveStopSpot(stopSpot);    holdDone = true;    savedAt = now;    confirming = true;    lastMoveAt = now;  }  buttonWasDown = buttonDown;   // 4) Decide which zone we are in  Zone zone;  if (now - lastMoveAt > SLEEP_AFTER)          zone = ZONE_SLEEP;  else if (avgDist > START_DIST)               zone = ZONE_FAR;  else if (avgDist <= stopSpot)                zone = ZONE_RED;  else if (avgDist <= stopSpot + YELLOW_BAND)  zone = ZONE_YELLOW;  else                                         zone = ZONE_GREEN;   // 5) Work out whether the beeper should be on right now  bool beepOn = false;  if (zone == ZONE_RED) {    beepOn = true;                                         // steady tone  } else if (zone == ZONE_YELLOW) {    // Beep period shrinks from 600 ms to 120 ms as the car nears the spot    float d = clampF(avgDist, stopSpot, stopSpot + YELLOW_BAND);    unsigned long period = (unsigned long)(mapF(d, stopSpot, stopSpot + YELLOW_BAND, 0.12, 0.6) * 1000.0);    if (period < 20) period = 20;    beepOn = (now % period) < (period / 2);  } else if (zone == ZONE_GREEN) {    beepOn = (now % 1200UL) < 150UL;                       // slow short chirp  }   // 6) Drive the lights and beeper  if (confirming) {    // After saving: flash all lights for 1 s, beeper quiet    if (now - savedAt < CONFIRM_TIME) {      bool on = ((now - savedAt) % 250UL) < 125UL;      setLights(on, on, on);      digitalWrite(PIN_BEEP, LOW);      return;    }    confirming = false;  }   setLights(zone == ZONE_RED, zone == ZONE_YELLOW, zone == ZONE_GREEN);  digitalWrite(PIN_BEEP, beepOn ? HIGH : LOW);  // Mute switch cuts this in hardware} 

Comments

No comments yet

Ask the maker a question, or say what you would change. Comments are public.

Sign in to comment. It is free.

More in around the house

See all in Around the house

Priced by a person

Ask for a price