The Traffic Monitor is an open source smart city traffic monitoring software built with commodity hardware to capture holistic roadway usage. Utilizing edge machine learning object detection and Doppler radar, it counts pedestrians, bicycles, and cars and measures vehicle speeds.
- 🧮 Reporting roadway utilization - counting cars 🚗, bicycles 🚲, pedestrians 🚶, and more! 🐕🐈🏍️🚜
- 🚨 Capturing roadway users' speeds - measuring speeds, capturing image and video of event.
- 📷 Privacy-focused, local inferencing (no cloud required) only collects and sends data you specify.
- 🐘 Permanent, long-term deployment on roadways to monitor roadway usage.
- 🐜 Temporary, remote deployments utilizing the low-power footprint and batteries.
- 💡 Extensible with any Raspberry Pi-compatible senosrs and components; e.g. Air Quality sensor for analog gas: RED, OX, NH3, noise, light, proximity, temperature, pressure, humidty and Particulate Matter (PM 5, 2.5, 1).
Coming soon.
- Assemble your device (see hardware components ⚒️).
- Install Raspberry Pi OS (Full Install) Bookworm (latest).
- Full Install required for all components to run properly. Lite is missing H.264 codec for libcamera.
- Recommend to Install using Imager instructions and follow the OS customization to set up your Wi-Fi credentials and username and password to access the device headless (no monitor or keyboard).
- Insert the microSD card and start your device
- First boot may take a few minutes before it is fully online
- Remotely access your device (recommend using SSH) and login to your Raspberry Pi
- Recommend use IP Address in case your router doesn't recognize the hostname you set during setup.
- Run
git clone https://github.com/glossyio/traffic-monitor
into your home folder (or any folder) - Run
cd traffic-monitor
- Run
sudo chmod +x script/*
to enable scripts - Run
./script/bootstrap
to fulfill dependencies. Note: System will reboot after this script. - After reboot, log into the device and
cd traffic-monitor
to continue. - Run
./script/setup
to set up project in an initial state - Run
./script/server
to start the application./script/update
is not required on initial setup but may be used if you change Docker configurations. This does not yet automatically update the traffic monitor.
- Access the application at the following URLs (check container status with
docker ps
):http://<device_ip_address>:1880/ui
is your primary device dashboard, use it to ensure it is capturing events (Node-Red dashboard)http://<device_ip_address>:5000
to view the Frigate interface and make any configuration changes specific to your deployment
- Mount your device in a place it can capture the entire roadway in the mounting guide (coming soon).
- Configure your device
- Start capturing roadway usage data!
This setup uses commidity, consumer hardware to enable object detection and speed/direction measurement:
- 👉 (Required) Raspberry Pi 5
- Note: The Raspberry Pi 4B is not recommended as it does not meet the power requirements on the peripherals (USB) for the TPU and radar for this setup.
- 👉 (Required) A high-quality microSD card (>= 32GB with minimal snapshot and video capture). Recommend a high performance card, even when configuring for minimal recording. Setup has been tested and works well with the SanDisk Extreme Pro microSDXC UHS-I Card.
- (Recommended) The official 27W USB-C Power Supply for testing and permanent mounts.
- 👉 (Required) Raspberry Pi Camera Module 3 or Global Shutter for object detection (requires a RPi 5 Camera Cable).
- 👉 (Required with camera) Coral AI Tensor Processing Unit (TPU). The Coral USB Accelerator is easy-to-use co-processor and capable of 100+ FPS with millisecond inference time. Other co-processors may work, but this is supported natively in Frigate.
- (Recommended) OmniPreSence OPS243-A Doppler Radar Sensor - provides accurate radar-based speed/direction detection.
- (Optional) Air Quality sensor (Enviro+) with Particulate Matter (PM) Sensor
- External enclosure and internal mounting board need to be custom made at the moment, instructions coming soon.
We are not affiliated with any of the stores or companies linked in this section. These are just suggestions that have been used or tested. If you have used or tested more, submit a PR to add them!
Access configuration at http://<device_ip_address>:1880/ui
> Configuration/Setup Tab
- Set up Frigate zones by entering the Frigate UI at
http://<device_ip_address>:5000
, clicking the primary camera, selectingDebug > Show Options > Mask & Zone creator
. For dashboard and data capture to work properly, you should set up the following 4 named zones:zone_capture
- Set to capture the entire roadway, including sidewalks that are clearly in view for counting objects through them. Avoid edges where poles and trees may occlude a clear view of objects.zone_far
- Paired withzone_near
, this will determine if an object moves "outbound" or "inbound". Set this to be roughly the further half of thezone_capture
region.zone_near
- Paired withzone_far
, this will determine if an object moves "outbound" or "inbound". Set this to be roughly the closer half of thezone_capture
region.zone_radar
- This should correspond to the field of view for the radar (where it can pick up accurate measurements) on the street. It will roughly make a rectangle in the center of the camera field of view from curb to curb.
- Set up the deployment location at at
http://<device_ip_address>:1880/ui
>Configuration/Setup Tab
> Deployment Location Entry Details
http://<device_ip_address>:1880/ui
is the Node-RED dashboard and your primary device dashboard, use it to ensure it is capturing events, see the latest events, and see summarized stats.http://<device_ip_address>:5000
to view the Frigate interface and make any configuration changes specific to your deploymenthttp://<device_ip_address>:1984
shows the go2rtc configured camera settings on the Raspberri Pi. Use this if your cameras are giving errors in Frigate.http://<device_ip_address>:1880
is the Node-RED flow editor used to develop the logic to connect events to speeds, create event records, capture radar readings, and more. This is primarily used by developers. The default admin login is admin/password.
More documentation coming soon.
If the Frigate camera shows nothing, check the configuration, review the Frigate Camera Setup documentation.
- In Frigate --> Configuration Editor:
- Enable camera(s) (
cameras
-->enabled: True
) - Enable detection (
detect
-->enabled: True
)
- Enable camera(s) (
Device dashboard available at http://<device_ip_address>:1880/ui
.
Cumulative events by object for the day (resets daily).
Last 5 events detected and confirmed by radar.
Car object speed statistics for the day (resets daily).
Hourly events count by object for the last 24-hours.