The power of any tool becomes magnified when you start combing it with other tools. In this File Exchange project by Eric Wetjen, he demonstrates a powerful project by using a webcam to gather live traffic video of Route 9 in Natick, MA, using Simulink to deploy a car-counting algorithm to a Raspberry Pi, using MATLAB to perform analysis, and using ThingSpeak to collect and share the analyzed data with others.
The project uses a Raspberry Pi 2 and USB webcam acting as a sensor. The webcam picks up traffic flowing in both directions. Once the algorithm for detecting cars is modeled in Simulink, the algorithm gets deployed on the Raspberry Pi. The Raspberry Pi sends the raw data to ThingSpeak on regular basis where it is analyzed using the MATLAB Analysis app on ThingSpeak.
After sending to ThingSpeak, Eric created a MATLAB Analysis app to calculate the daily traffic-volume on ThingSpeak Channel 51671. Now that the data is public, others could use this processed data within apps such as Waze to optimize directions using analyzed traffic flows.
Check out the article for the complete project details and all of the code to get your Raspberry Pi + ThingSpeak analysis project started.
3 CommentsOldest to Newest
hi,do rasp pi have the power to run the program continuously.what kind of data is send to thingspeak,is the no.of vehicle.
what type of method did you used to detect vehicle,is it edge detection or backgrpond subtraction
Where can I download source code ?
The source code is on File Exchange: https://www.mathworks.com/matlabcentral/fileexchange/52456-analyzing-traffic-using-a-webcam–a-raspberry-pi-and-thingspeak