The Pi is powered from a POE splitter which also provides data connectivity. The TFMini detector connects into the Pi via UART serial connectivity.
The Pi is running a custom written Python script that checks the distance the sensor reports back multiple times a second. The TFMini has a max range of 12m and anything greater will report back 0mm. The script looks for the distance to increase above 0mm for a period of time and registers it as a car. Likewise, it also waits for the reading to return to 0mm for a period of time to reset the detection logic.
The detection logic also takes into account the show schedule. There is one JSON schedule that we store in GitHub that all the different pieces of the show utilize to know what the hours are for each day.
The Python script also logs the number of cars detected each day and stores them in a SQL database on the Pi. This database gets backed up to Azure nightly incase the Pi looses the data.
All of the interaction from the front end to the backend is done via APIs which allow ShowMon, our Q-SYS control system to also hook in and grab the data and control the counter.
To help with comissioning the system, it has Test and Manual Override modes to allow us to be able to work on the system without effecting the live counts.
Each hour, ShowMon publishes an attendance report to our Teams channel with the car counts for the hour as well as total car counts for the season. It gives us a quick and easy way to visualize the nightly attendance.
Based off the recption of sharing the car counter online, I went ahead and built out a new UI that allows local reporting of attendance as well as the ability to create a local schedule. The updated source code as well as install instructions are now available on the GitHub repo.
This year we decided to try utilizing a commerically available AI analytics system for counting cars - Camlytics. This service locally processes the video and uploads the events to their cloud platform. From there, you can easily create dashboards and have API integrations to the data. Some challenges we have faced with running an AI model at night is the time required to detect cars and cars driving through without headlights on can cause them to not be counted. We estimate we are only gathering 1/3 or less of actual cars.