Coin Comparator Token Rejection Loops: Optical Sensor Calibration Fixes
A coin comparator stuck in a rejection loop is almost never a mechanical failure — it is a photometric threshold failure, and anyone who swaps out the acceptor body before scoping the optical path is burning money on a misdiagnosis. The comparator does exactly what its reference voltage tells it to do, and when that reference drifts, every legitimate token gets flagged as a slug. 💀
The core mechanism is brutally simple: an infrared emitter fires through the token window, a phototransistor reads the attenuated signal, and a window comparator judges that reading against high and low thresholds stored in the calibration EEPROM. A valid coin must land inside the acceptance band for a specific number of clock cycles. When the Coin Comparator Token Rejection Loops pattern appears — good token in, instant return, repeat forever — the acceptance band has collapsed or shifted, not disappeared. The token never violated the physics of the sensor; it violated a corrupted threshold table.

Why Dirty Optics Produce Phantom Rejection Cycles
Dust, nicotine film, and dried soda residue on the emitter lens scatter infrared energy before it ever reaches the phototransistor. The signal amplitude drops, the comparator reads the drop as a valid token being absent, and the rejection solenoid fires within milliseconds. Here is the part most techs miss: a partially occluded lens creates intermittent acceptance — one token passes, the next three bounce. That erratic behavior mimics a worn accept coil, which is exactly how good hardware gets replaced for no reason. 🎯
Before touching calibration memory, physically inspect both lenses under a loupe and clean them with isopropyl and a lint-free swab. Measure the emitter forward current against the service datasheet — a degraded IR LED that has lost 30 percent of its output will pass a visual check and still wreck every acceptance decision downstream.

Scope First, Calibrate Second
Put a scope probe on the phototransistor collector and feed a known-good token through the slot. You want to see a clean analog envelope with a defined peak and a minimum dwell time inside the acceptance window. If the envelope is noisy or the peak sits below the low threshold rail, calibration will not hold — fix the optical path first. Only after the raw waveform is clean do you touch the Optical Sensor Calibration routine, because calibrating against a dirty lens writes garbage thresholds straight into non-volatile memory, and that corruption survives every power cycle.
Run the auto-calibration sequence with three reference tokens of the target denomination, then verify each one manually through the diagnostic port. Watch the accept counter versus the reject counter across twenty consecutive inserts. Anything short of twenty out of twenty means the band is too tight — widen the low threshold rail by roughly five percent and retest. Loose bands let slugs through; tight bands starve the machine of legitimate revenue. There is no middle ground here, only measured tolerance.
EEPROM Drift and the Voltage Trap
Calibration values live in EEPROM and they drift with supply voltage sag. A comparator fed 11.4 volts instead of 12.0 will shift its reference rails enough to reject perfectly good tokens on cold starts while accepting them fine after warm-up. Log the supply rail under load during a rejection event — if it dips below spec, the calibration table is not the problem, the power chain is. 🧠
Also audit the comparator clock. A marginal crystal oscillator shifts the sampling window relative to the token transit, and the acceptance logic samples the analog envelope at the wrong moment in the waveform. Replacing a fifty-cent crystal has saved more acceptor bodies than any threshold rewrite I have ever performed. The rejection loop is a symptom; the real fault is always one of three things — optical attenuation, reference drift, or timing skew. Calibrate against clean signal, stabilize the rail, and the loop dies.