OPT101 and ALPR detection: engineering review

Reviewed 21 October 2026 against XIAO firmware 0.6.0, repository base de82f64. This is a source and manufacturer-documentation review, not a field validation. No sensor waveform, target-camera measurement or detection-range result was supplied. This review records the 0.6.0 baseline. The subsequent 0.7.0 implementation changes are documented in OPT101 tuning and raw capture; the findings below describe the older code, not the current release.

Finding

OPT101 is useful for measuring optical pulses that a slow camera can miss. The current implementation is a narrow optical timing matcher, not a general ALPR detector. A successful match means a sufficiently strong light signal passed the configured timing rules. A failed match does not establish that an ALPR is absent.

Flock's own FAQ confirms infrared illumination, but does not supply an authenticated 8–12 Hz / 8–35 ms optical signature. Axis documents a plate-reading product with both constant and pulsing IR. Its plate-capture guide also describes short exposures. Exposure duration alone is not an emitter's pulse duration or repetition frequency. These sources do not justify a universal 10 Hz rule.

What the sensor can and cannot tell us

The TI OPT101 datasheet, sections 6.5, 6.8 and 8, describes an integrated photodiode/amplifier, 2.7–36 V supply, internal 1 MΩ feedback and nominal 14 kHz bandwidth. Its response spans visible and near-infrared light. One output voltage cannot identify wavelength or source.

TI specifies high output around supply minus 1.3 V minimum / 1.15 V typical under its stated conditions. At a 3.3 V supply that implies roughly 2.0–2.15 V of upper output swing, not 3.3 V. Actual breakout circuitry, load and tolerances matter. Check the real module with a meter or scope. Optical filters and shading can help headroom; neither establishes camera identity.

Findings in the reviewed 0.6.0 code

Finding Code evidence Practical effect
Narrow accepted waveform config.h: 8–12 Hz, 10–30% duty, 8–35 ms width Continuous IR and pulses outside any one bound are rejected, even if they come from a real ALPR.
At least five rising edges pulse_detector.h: four completed valid intervals At 10 Hz, minimum acquisition is about 400 ms from the first usable rising edge, plus up to about 100 ms before status publication. Initialization and threshold settling can add delay. A short passing burst can be missed.
Three timing limits intersect Width, duty and frequency are all required At exactly 10 Hz, the effective width range is 10–30 ms; a nominally allowed 8 ms pulse fails the duty rule. At 8 Hz it is 12.5–35 ms; at 12 Hz it is about 8.33–25 ms. Sampling quantization affects boundary cases.
Sampling is requested, not guaranteed irsensor.cpp: one analogRead per RTOS tick interval, timestamped with esp_timer_get_time Nominal 1 kHz is suitable for the reference millisecond pulses. It does not exploit the sensor's full bandwidth. Narrower pulses may be missed; check rate and gaps with preview, radio and SD active.
ADC ceiling is not sensor saturation pulse_detector.h: clipped = raw >= 4000 A flattened OPT101 output below ADC full-scale is invisible to this flag. A clear flag is not proof of optical headroom; distorted pulse widths can remain plausible.
Threshold is in raw ADC counts 120-count minimum trigger, 70-count release floor, adaptive noise multiplier Weak signals can fail even when their timing fits. Thresholds are not calibrated optical power or a guaranteed detection distance.
Baseline follows input Exponential baseline with 500 ms time constant Response depends on signal amplitude, ambient light and recent history. A sensor enabled during a bright pulse can need extra settling.
Good rejection safeguards already exist Hysteresis, 15% interval-regularity rule, >5 ms gap reset and 300 ms staleness These reduce spurious or stale matches. They do not make a timing match unique to ALPRs.
Dashboard waveform is decimated irsensor.cpp: nominal 200 Hz display ring; snapshots limited to 64 samples The displayed trace is useful for setup but is not a timestamped raw capture suitable for characterizing fast pulses.
Nearby evidence is only correlation Optical/radio fusion uses a 3-second window A radio and a light can belong to different objects. Preserve each source and evidence tier.

Primary implementation: pulse validator, sampler, configuration, and existing synthetic checks. Existing tests exercise timing, gaps, ADC full-scale clipping, noise and wraparound; they do not validate analog saturation below full-scale or real-world range.

  1. Measure the actual module first. Record supply voltage, dark output, ambient output, bright-light plateau and pulse amplitude. Keep 3.3 V-compatible wiring to D1/GPIO2. Do not raise the supply without designing ADC input protection.
  2. Add diagnostic waveform capture. Export timestamped raw ADC samples, actual sample intervals, supply/voltage calibration when available, and the active profile. Keep diagnostic observations separate from camera alerts.
  3. Separate saturation diagnostics. Label the existing flag as ADC clipping. Add a calibrated headroom warning for the actual breakout; flatness alone cannot distinguish saturation from genuinely constant light.
  4. Characterize known sources before adding profiles. Measure repetition, width, duty, burst length and amplitude across approach angles, distances, daylight and darkness. Keep unknown pulses as unclassified observations.
  5. Use faster acquisition only where measurements justify it. For pulses approaching or below a millisecond, evaluate continuous ADC/DMA or a comparator with hardware edge timestamps, including noise filtering and CPU/radio load. Simply widening all limits would increase matches from unrelated lights.

Bench and field test record

Use a separately controlled LED emitter and verify its waveform with a scope or logic timing reference. At a fixed geometry, start with a 10 Hz, 20 ms pulse train. Record signal amplitude, first-match latency, measured frequency/duty/width, actual sample rate, gap count and whether an alert was produced.

Trial Expected interpretation with the current profile
Covered sensor and constant light No repeated timing match; verify raw response when uncovering.
10 Hz / 20 ms, adequate amplitude and headroom Match after four usable intervals.
Same timing at progressively lower amplitude Establish the threshold behavior; no range claim from synthetic counts.
10 Hz with 1, 5, 8, 20, 35 and 50 ms widths Only widths also satisfying the duty rule should qualify.
5, 8, 10, 12, 20, 50, 60, 100 and 120 Hz Check out-of-profile rejection; sweep phase near boundaries.
Two to five pulses, then longer bursts Establish minimum burst length and settling behavior.
Increasing steady illumination plus pulses Find analog saturation and loss/distortion of pulse headroom below ADC clipping.
Ordinary LED lighting, vehicle lamps, IR security cameras and remotes Record false matches and unmatched optical signals. A remote is not an ALPR calibration source.
Preview, WiFi/BLE and SD logging active Check actual timing and dropped samples under normal workload.

For known ALPR sites, record the verified model, observation geometry, lighting, waveform and both detections and misses. Use separate observations to tune and evaluate a profile. Report false alerts per hour and detection rate by condition; do not infer sensitivity from successful demonstrations alone. No detection distance, sensitivity or false-positive rate is established by this review.