Hans on IoT

ThingSpeak, MATLAB, and the Internet of Things

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Counting Cars and Analyzing Traffic 3

Posted by Hans Scharler,

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.

Car Counting Camera

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.

MATLAB_car_counting_display

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.

MATLAB Traffic Analysis ThingSpeak Visualization

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

siva replied on : 1 of 3
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
Hans Scharler replied on : 3 of 3
The source code is on File Exchange: https://www.mathworks.com/matlabcentral/fileexchange/52456-analyzing-traffic-using-a-webcam--a-raspberry-pi-and-thingspeak

Add A Comment

Your email address will not be published. Required fields are marked *

Preview: hide