Hans on IoT

ThingSpeak, MATLAB, and the Internet of Things

Counting Cars and Analyzing Traffic

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.

|
  • print

Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.