Embedded Eye

Give your gizmo the gift of sight

Internet of Things (IoT) car traffic counter camera using an ArduEye and COSM

Eager to make a little foray into the "Internet of Things", I decided to experiment with the use of an ArduEye as an "Eye for the IoT". My house is on a fairly busy street, of which I have a good vantage point from my attic home office. A car traffic counter seemed like a good choice for a first project.

I programmed an ArduEye Aphid to detect cars using a very simple algorithm- The ArduEye grabs a small block of pixels ten times a second, and if any pixel in that block changes by more than a threshold, this is considered a car detection. The block of pixels is on the path of cars headed north-bound on my street. I added the requirement that the pixels had to quiet down and be quite for a certain time interval (about a half a second) to prevent the same car from being counted twice.

Next was to upload the data feed to COSM (formerly Pachube). I made use of an excellent book, Building Internet of Things with the Arduino, by Charalampos Doukas, and used an Arduino Uno to bridge the ArduEye Aphid to the internet via a WiFly shield. COSM's API was simple enough to follow, and for the first time, one of my image sensor chips was feeding real-time data to the Internet!

Here is a link to my data feed on COSM. I'm uploading three datastreams. The first is a simple count of how many cars are detected per minute. the second datastream shows the raw intensity value of one pixel in the window- this is a fun way to monitor the change from day to night. (This datastream is a bit glitchy- I haven't figured that out yet). The third datastream shows the largest "delta intensity" change of any pixel between two successive frames. The picture below shows a screen shot of the car count datastream over a six-hour period of February 19, 2013. You can clearly see the increase of traffic due to rush hour towards the end of the plot.

The datastream you see may be different, depending on the current traffic and whether the camera is alive at any one point.

This first traffic monitor is very simple and certainly far from perfect. But it was fun to do and gives me a few other ideas for things to try. Here's an interesting question: What if I could make a version of the Stonyman image sensor chip that drew just a few hundred microwatts of power? Could I then hook it up to a low power microcontroller that could monitor traffic for, say, a year with just a single battery charge? I think it would be fun to try that out...

Views: 675

Comment by Geoffrey L. Barrows on February 22, 2013 at 9:32am

Update: I changed the sensor to push data every five minutes rather than every minute, since the original one minute cycle was too similar to the changing of the traffic light just north of here. This seems to have helped smooth out the car count plot. You can see the difference in the above plot over the previous 24 hours. Also I get periodic outages- not sure why at this point- I had one from 03:00 to 06:30 last night as you can see.

Comment by Geoffrey L. Barrows on March 6, 2013 at 9:01am

The feed has been running for over two weeks now, so if you zoom out to a one week view you can see how the weekend traffic is different from the week. However today we have something different- a big snowstorm is hitting Washington DC that is expected to put up to 30cm of snow on the ground. The Federal Government as well as most schools in the area are closed, which will substantially bring traffic down. However when I checked out the feed (see picture above), I noticed a spike in traffic to almost 30 cars an hour! Why? It seems that the simple method I have for detecting cars is also triggered by snowflakes!

Comment by Bobb Craig on May 7, 2013 at 5:46pm


First of all, thanks for a very interesting site and product.

Second, how soon to you think the Aphid's will be on the street?

And third, after reading your comment about hooking the project up to a low power micro controller, I was wondering if you know of the JeeNode and low power work of Jean-Claude Wippler (jeelabs.org)?

Look forward to seeing the ArduEye Aphid in production.



You need to be a member of Embedded Eye to add comments!

Join Embedded Eye

© 2022   Created by Geoffrey L. Barrows.   Powered by

Badges  |  Report an Issue  |  Terms of Service