Two-Beam People Counters: State Machines, Timeouts and Retained MQTT State
A review examines three published sources on counting people with two beam sensors and checks them against an ESP32 prototype that reports over MQTT. The reference design detects entries and exits by which beam is blocked first, relying on a short timeout to discard incomplete crossings. Timeouts built on millis() must use unsigned elapsed-time arithmetic to handle the roughly 50-day rollover. The prototype follows the direction logic and rollover-safe timeout pattern, but keeps its count only in RAM, so reboots reset it and errors are never corrected automatically. Its state is published every 5 seconds without the retained flag, so dashboards connecting between messages must wait for the next update.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in