Give your gizmo the gift of sight
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...