Pinewood Derby electronics · Unit 67

A small car.
A big personality.

A police-themed Pinewood Derby family build, brought to life with flashing lights, a two-tone siren, motion sensing, and a Home Assistant dashboard that moves with the car.

XIAO ESP32C3MPU60503.7 V · 650 mAh LiPoESPHomeHome Assistant

Project reference v1.1 · Updated October 13, 2026

Illustration of the blue and cream Unit 67 police carUNIT 67 · LIFESAVER
LightsAlternating outputs
SoundTwo-tone siren
MotionCar-axis tilt
From the Home Assistant dashboard

Put Unit 67 through its paces.

Change the tilt and switch between awake and sleeping. This browser demo uses illustrative readings; it does not connect to the car.

Pinewood Derby PoliceUNIT 67 · LIFESAVER
LEVEL
● CAR ACTIVE
Police car tilts to match the demo controls
UNIT 67 · LIFESAVER
Front / back0.0°
Left / right0.0°
Battery4.00 V
MPU temp26.0°C
Interactive demo

A dashboard with character.

The car illustration follows pitch and roll. The status badge turns green within ±2°, amber up to 5°, and red beyond that.

Sleep pauses the flashing lights and marks the readouts as unavailable. No audio plays in this demo.

Inside the build

The boards behind the personality.

Hardware identified from the build owner and supplied ESPHome configuration.

Seeed Studio XIAO ESP32C3

The tiny main controller handles Wi-Fi, ESPHome, light switching, PWM siren tones, and the connection to Home Assistant. The board also includes lithium-battery charging support.

Seeed board documentation ↗

BLE is a board capability; this project configuration uses Wi-Fi.

MPU6050 sensor module

Acceleration is sampled every 200 ms over I²C at address 0x68. The firmware projects the readings into the car’s own axes to calculate front/back and left/right tilt.

The dashboard also exposes the MPU’s internal temperature, which is a sensor-chip reading rather than an ambient thermometer.

3.7 V · 650 mAh LiPo battery

A compact rechargeable lithium-polymer battery powers the car’s electronics. The battery set shown for this build includes two 650 mAh packs with Molex 2.0 connectors and two USB charging leads.

The controller runs the alternating police lights and adjustable two-tone siren, while battery monitoring keeps the charge status visible in Home Assistant.

Features in the supplied build

More than a flashing light.

Alternating police lights

A 200 ms interval toggles GPIO9/10 and GPIO3/2. Each pair has an interlock and a 200 ms changeover delay. The dashboard adds red/blue reflections around the illustrated car.

Adjustable two-tone siren

GPIO8 alternates between configurable low and high frequencies. Defaults are 850 and 950 Hz; each tone adjusts from 100–3000 Hz. Volume is a 0–100% PWM setting, with a master siren enable.

Mount-aware tilt calibration

Capture flat, front-lift, and side-lift positions, solve the car axes, then zero the level reading. Solved axes and zero offsets are saved across restarts.

Stable level feedback

Moving averages smooth the acceleration and angle readings. A 0.3° deadband reduces jitter near zero; the car-level sensor is true when both tilt angles are within ±2°.

Battery visibility

The 3.7 V, 650 mAh LiPo battery has two firmware readings: Battery Voltage in volts and Battery Level as an estimated percentage. Voltage is measured through XIAO D2/A2 (GPIO4); percentage is calculated from that same reading, with no second pin.

Awake / sleep awareness

The car publishes active at boot and inactive one second before deep sleep. Adjustable defaults are 30 seconds awake and 30 minutes asleep. A motion-sensitivity setting and GPIO5 wake input are configured.

Sleep duration and motion sensitivity are applied during boot in the supplied reference. Verify the MPU interrupt connection and wake behavior on the assembled car; physical operation has not been tested here.

Firmware signal map

Small board, clearly defined jobs.

These are raw GPIO numbers in the supplied YAML, not XIAO D-pin labels. The supplied firmware still selects esp32-c3-devkitm-1; the physical board is the XIAO confirmed by the owner.

FunctionESPHome GPIOXIAO pin
Battery Voltage (ADC1)GPIO4D2 / A2
Battery Level (%)Calculated from voltageNo additional pin
MPU6050 SDA / SCL · 0x68GPIO6 / GPIO7D4 / D5
Configured wake inputGPIO5D3
Light output pair AGPIO9 / GPIO10D9 / D10
Light output pair BGPIO3 / GPIO2D1 / D0
Siren PWMGPIO8D8
Calibration workflow

Teach the sensor what “flat” means.

  1. Hold the car flat and press Capture Flat.
  2. Lift the front, hold steady, and press Capture Front Lift.
  3. Lift one side, hold steady, and press Capture Side Lift.
  4. Press Solve Car Calibration to save the car axes.
  5. Return to a level surface and press Zero Car Level.

Keep all three captures in the same awake session. Lift captures are temporary and are lost when the controller restarts.

Design notebook

From the drawing to the dashboard.

The original SketchUp view and Home Assistant card supplied for this project.

Original SketchUp drawing with a shaped Pinewood Derby body and separate modeled components
Original mechanical design drawing. Component dimensions and final assembly details are not shown in this view.
Original Home Assistant police-car dashboard with tilt, battery voltage and MPU temperature
The original dashboard’s police-car theme inspired the interactive web display above. Values here are from the supplied screenshot.
Project files · v1.1

Keep the build and the dashboard together.

Public reference files with private credentials removed. The supplied firmware logic is preserved; it has not been compiled or tested on hardware.

Preview of the branded Pinewood Derby setup and entity mapping PDFSetup & Entity Mapping Guide · v1.1
Two pages covering installation, private secrets, entity IDs, calibration, and dashboard checks.
Preview of the Pinewood battery and MPU6050 wiring diagramSchematic & Wiring Guide · v1.1
Four pages: battery and sensor wiring, light/siren signals, XIAO pin mapping, and battery-voltage/charge-level checks.

The card includes matching vector artwork, explicit unavailable-data handling, and a visible sleeping state. Install custom:button-card, copy the graphics to /config/www/pinewood/, and map the entities to your own Home Assistant installation.

Firmware API, OTA, Wi-Fi, and fallback hotspot credentials use local !secret references. Supply your own values privately.