mike chambers | about

Accelerate : Flash / Arduino Based Speed Detector

Wednesday, August 11, 2010

Well, as you may have noticed from my blog posts the past week or two, I have been playing around with Flash and Arduino. I have a ton of ideas and projects in mind, but wanted to start on something that wouldn’t be too overwhelming, and would give me a good opportunity to learn the basics. Well, I have finished my first project, and wanted to share it with everyone. It is a Flash / Arduino based speed detector with clients for Mac, Windows and Android based devices (via Adobe AIR 2.5 beta).

I have put together a quick video that shows the app in action:


View HD version here.

Here is how it works. I have an Arduino Duemilanove with ATMega328 which has two photo-resistors connected (with a 10k pull down resistor). I set up two laser pointers to shine a laser directly onto the photo-resistor (which is enclosed within a dark box). The Arduino monitors the values returned from the light sensor, and watches for any changes that indicate that the laser bean has been broken. When both laser beams are broken, the Arduino calculates the amount of time between when each sensor was tripped. It then sends that value to the Adobe AIR based client, which is connected to the Arduino via USB / Serial port and a serial port proxy (in the case, TinkerProxy).


You can download the schematic from the project’s repository.

Once the AIR application (running on the desktop, or an Android based device) gets the message from the Arduino that both sensors have been tripped, the AIR app takes the time that it took for each sensor to be tripped, and combines it with the distance between the sensors (in inches), and uses that data to determine the speed.


While I put this together mostly for fun, it is actually useful for tweaking RC car gears and setup. You can use it to help tweak both maximum speed, as well as acceleration / starting speed. Unfortunately, I don’t know enough about working on RC cars yet to actually take advantage of the data, but it is fun to hack around with regardless.

I have posted all of the Flash and Arduino code on GitHub, and released it under an open source MIT License. The AIR application is built using Flex 4, and although Flex 4 is not optimized for mobile, it performs really well on my Nexus One.

When looking at the Arduino code, keep in mind this is my first Arduino project, and the code could use some optimization, refactoring. (post in the comments if you have any suggestions).

I have posted some of the lessons learned from the projects in another blog post , so make sure to check that out.

Big thanks to Ben Griffith, Geoffrey Mattie who made some suggestions to clean up the design and UI of the app.

If you have any questions or suggestions about the project, just post them in the comments.

Update: Changed title since it is really more of a speed detector than speedometer.

twitter github flickr behance