Crowdsourcing Algorithms

Original API artwork from TBD Catalog

Used with permission from the awe inspiring TBD Catalog

With the invention of triple-axis accelerometers and open source libraries, it’s becoming pretty easy to gather data. I can generate a tremendous amount of data using an Arduino and an OpenLog to log it. The problem is always the same: What do you do with all that data?

Speed Bag Repeating Gif

So here’s a real world example: A few years ago I built a Speed Bag Counter. For those who don’t frequent a boxing gym, the speed bag is the teardrop-shaped bag that boxers hit in quick unison to strengthen their shoulders and develop their hand-eye coordination. A standard round is three minutes, and because of the speed at which the bag bounces it’s pretty much impossible to keep count. I decided to build a counter so I could track of my improvement over time. Just hook up an accelerometer and a display to an Arduino and you’re good to go, right? As they say, the devil’s in the algorithm.

A log of triple axis accelerometer data

Accelerometer data is messy

Pictured above is one of the datasets I captured when I was trying to validate the system. Real world data is noisy.

But wait, we should be able to see periodicity and other key traits, right?

Graph of data

Unfortunately, even with logging at 500Hz the data is not self explanatory. With this data I did my best to try to create a system that could count hits.

Above is my very amateur attempt at a filter to suppress the noise and look for peaks. I arrived at this by loading the log into LibreOffice and throwing math at it until I was able to get a reasonable hit value from it. I learned two things:

  1. I know very little about algorithms.
  2. My approach is not very accurate. I’m about 28 percent off on average. I think it’s because there are some harmonic frequencies wreaking havoc when the boxer gets into a rhythm.

I’m pretty sure you can do a lot better. So here’s the deal: We’re going to have a little contest so that we can all learn from the experts about how to do this “for reals.” You can get the raw datasets here. The names of the logs contain the number of hits in each. If you don’t believe me you can view the videos and datasets here.

If you think you can more accurately calculate speed bag hits:

  1. Write an algorithm that correctly outputs the number of hits contained within the datasets (get them here).
  2. Implement your algorithm on a microcontroller – 8-bit and 32-bit micros are ok. No FPGAs. PLCs, you’re crazy.
  3. The most important step: Document the heck out of how you approached the problem, how you filtered the data, and ultimately how you arrived at a solution. We’re here to learn from you.
  4. Put your code and documentation into a public repo or website.
  5. Use your algorithm to tell us how many hits are contained in Mystery Dataset #1 and Mystery Dataset #2. We have videos of these sessions that we’ll post once the contest is over.

We believe in the fundamentals of Open Source Hardware. Your work must be released under an open source license of your choice. No -NC exclusions allowed. I don’t plan to make this into a product, but you must be ok with it when someone releases an accelerometer-based speed bag counter. And sells it. For money.

How do I enter?

Post a link to your repo or website in the comments. We’ll be running the contest through the end of the month (6/30), and I’ll test the solutions on the counter in the gym as they come in. There are very smart people in this world, so if there are multiple successful solutions we’ll randomly select a winner, who will be announced after the contest ends and all the entries are tested.

Wait, wait. So what do I win?

We’ll fly you and a +1 to Denver, and put you up in a hotel in Boulder. I’ll show you around SparkFun, take you to the Front Range Boxing Academy so you can see your code in action and do a dinner around Boulder. If you’re out of the USA, we will pay for a plane ticket for one person instead of two.

And whoa, Billy Bitzer is way better at this than me.

comments | comment feed

Leave a Reply

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