Pinewood Derby Instant Replay System

Adam has been working on his Inventing Merit Badge since last summer. We discussed potential “problems” and “solutions” for months. After the harsh realization that he wasn’t going to invent a  flying car,  or a robot to clean his room, he focused a bit more on things within reach. One problem kept resurfacing – at our annual Cub Scout Pinewood Derby, there are so many Cub Scouts around the track, the 75+ parents in attendance can’t see the track. Given that it takes 2+ hours for a race, things get boring pretty fast for the adults, Cub Scouts, and siblings that can’t see the racing action.

Adam decided this was a problem worth solving. He knew there were some existing systems out there, but none were designed specifically to work with our track. We discussed that inventing doesn’t mean you have to build something completely new – that taking an existing concept, but tailoring it for your specific problem was still a worthy challenge.

Just in case you don’t read all the details (I’m looking at you Anonymous Internet Commenter!) – two quick things:

  1. He made all the (non-coding) decisions on this project. We discussed EVERYTHING, and he either generated the idea or asked for design input. The final working prototype was a father / son build, but he built the stand, chose the camera angle, picked the laser trigger location,  etc. I did the coding in Processing, with him by my side asking questions and providing input.
  2. If you think this project is awesome, please take a moment to comment on this blog, on YouTube, etc.
    He worked really hard on this one, and I’d love him to see your feedback. Thanks :)

This video provides a quick overview of the project, with WAY more details below.

And now for the details…

The Inventing Merit Badge was offered starting in June 2010 (in the original version from the early 1900s, you had to get a patent to get the merit badge!) and I knew this was one I wanted to help teach. I hoped Adam would be interested, and he was…

The requirements are very well constructed and ask Scouts to “Think of an item you would like to invent that would solve a problem for your family, troop, chartered organization, community, or a special-interest group”. This is great because it helps keep them focused on identifying a problem versus just dreaming up new gadgets.  We would discuss this every few weeks, with him jumping to solutions, and me returning him to defining a problem.

From his notebook:

problem:parents have trouble seeing the finish line because scouts are sitting around it and blocking the view

 possible solutions:

Idea #1: Use an rc controlled camera that follows the cars
Idea #2: Use cameras and tv’s to display track also with slow-mo replays and winner status

After some discussion, he decided that having a motorized camera that moved down a 50 foot track in 3 seconds while tracking moving cars was more work than we had time to complete – even if it would be really awesome. (Next year?!)

He decided that a single stationary camera by the finish line made the most sense and he built Lego  models of the concept to meet the requirement – “Create a model of the invention using clay, cardboard, or any other readily available material.” In our house, Lego is clearly a “readily available material”…

This is a remarkably accurate model of our setup...he even built some of the walls for perspective...

The beige Lego with writing on it is the projection screen with text for the audience....He later decided that the video was enough...

The orange cone is a camera on a tripod, the chain is the video cable back to the comptuer with him sitting at the computer to "type in what the announcer is saying"

After he had a model, we moved onto the next requirement – “Share the idea and the model with your counselor and potential users of your invention.”

I taught him how to use iThoughtsHD on the iPad, and he used a mind map to interview his mom (his younger brother is still a Cub Scout, so she’s clearly a target user)

iThoughtsHD Mind Map

He was pretty intimidated to do an interview, even with it being Mom, so the mind map helped him stay on target and he did a great job asking questions and recording her answers.

The next requirement –  ”Build a working prototype of the item you invented…Test and evaluate the invention” was the exciting one for me. He’d already done the real conceptual work, but now we got to BUILD and TEST!

We discussed what type of camera to use, and I shared that I’d done some prior webcam work with the Processing language / IDE (www.processing.org) and that it was really easy to work with webcams. Webcams are also inexpensive and small, which would be helpful. I spent a few hours poking around with Processing using the webcam embedded in my laptop, and a Logitech webcam I had laying around. I demonstrated some basic capture and replay, and then he grabbed an old Pinewood car and moved it past the webcam. The software worked great, but the 30 frame per second (fps) webcam was just too slow to capture anything meaningful. We were both pretty frustrated, and hit the web to find some options.  Luckily, there is a locally-available, relatively inexpensive ($40) webcam that does 60 fps video – the Playstation Eye Camera!

Quick, let's run to Best Buy!

We headed to Best Buy (in the name of Science!) and grabbed a PS3Eye camera. It wasn’t quite as easy to use as a standard webcam, as there are custom drivers required for 60fps video, and it turns out that the latest version of those drivers just do not work. I stumbled across a forum that provided a fix (get the old driver, pull out a file, put it in an absolute path), and the camera came alive. 60fps was MUCH better – we still had blur at real Pinewood car speeds, but it was still quite easy to identify each car as it crossed the finish line. (Yes, there is a way to get 120fps out of this camera, but at a much lower resolution…)

Once we knew the PS3Eye camera would work, Adam set out to build the stand that would hold the camera. We headed to Home Depot to stock up on PVC pipe (we like to build using PVC) – he mocked up something in the store using 1.5″ PVC, then we bought some 10 foot lengths and a bunch of fittings. The pics below show the build of the stand and camera mount…

Determining camera height for several view angles

Measuring, cutting, and assembling PVC pipe for the stand base

The stand is taking shape...

The first version of the camera mount...didn't work very well...

Removed the base of the PS3Eye, flattened the front of a cap, drilled a big hole, hot glued the camera to the cap, then put the cap on a tee fitting...

After all this construction, Adam decided the Lego model needed to be updated with “as-built” designs…

At this point,  the stand / camera mount was complete and I had some bad news to share with Adam. We’d been counting on getting a signal from the track when the cars crossed the finish line – but I realized that it doesn’t transmit data until the race is over – meaning ALL cars have crossed the finish line, or the max time has elapsed. We needed a way to know when the FIRST car crossed the finish line…  We sat in the driveway, trying to think of another way to make it work. Next thing I know we are staring at the garage door opener obstruction sensor which uses a light beam across the garage door opening. I had a spare set, but after a few minutes of working with them, we decided that we wanted something easier to work with…after discussing our options, we set out to build a laser trigger!

We headed to Radio Shack to get a laser module and a photocell. They had the photocells, but the lasers were “professional” models that were a little pricey  for us to tear apart. We walked over to WalMart and bought some laser pointer / LED flashlight keychains for $2.99 each! The pics below show how we hacked those keychains into a laser trigger…

Laser pointer keychain with the circuit board removed

Power wires added and laser switch shorted on

Shrink tubing makes everything look better!

Laser module mounted with fine adjustment screws added for extra awesomeness...

How to mount a photocell inside a PVC tee - first get a hole saw, a scroll saw and a scrap 2x4...

drill mounting holes, scribe channels for the photocell legs, paint it flat black...

Add photocell, superglue the legs, add mounting hardware and wires...

Paint the inside of the PVC tee flat black, drill mounting holes, mount photocell assembly, test with laser module...

We installed the laser trigger on the camera stand (later we moved the trigger in front of the finish line)...

We now had a way to know when the first car crossed the finish line, which let us do a LOT of testing. We played with the camera angle more, and changed the camera height slightly. He also made the final decisions on how many frames to capture AFTER the first car crossed the finish line (45 = 3/4 of a second), how many total frames to capture (60 frames =  1 second), the slow motion frame rate (5 fps), and the number of times to replay before returning to live video (3). I’d show him some options for each setting and we’d test with him making the call. The day of the race I dropped the number of replays to 2 because it was slowing down the race, but the other settings worked perfectly…

At this point, we found an unintended circumstance. If the laser trigger was tripped when it wasn’t time for a race, the replay would start again – we needed to know if there was an active race so that we didn’t start replay at the wrong time. Luckily the track has a green ready light at the finish line…we could have electrically interfaced to get the signal, but I was worried about over-competitive fathers questioning the integrity of the track sensors if we electrically interfaced to the track. Instead, we used another photocell to detect the ready light – and put another ready light in its place!

Photocell shoved inside a PVC cap to detect the ready light, with an LED to show the track's ready status...all secured with a nice long wiretie!

We used an Arduino with a Screw Shield to wire up the laser trigger, photocells and LEDs.

Since we already had a Processing sketch doing the video work, I decided to try out Firmata. With the Firmata sketch loaded on the Arduino (and it wired to the two photocells & LEDs), I could now trigger the instant replay with the laser trigger – and prevent false triggers by sensing the ready light.

With all this work done (and a VERY tired father / son team), it was time for the big Pinewood Derby.

It took us several hours that morning to setup the track (although it was the 5th time we’d set it up that week, so we were getting quite proficient!), the instant replay system, the projectors, and get everything secured for the onslaught of hyper Cub Scouts and hyper-competitive Dads.

Note all the duct tape to keep the stand in place (and the laser aligned!)

We had a field of VERY fast cars – which made for VERY exciting races.

We projected the instant replay video high on the wall across from the audience…

Adam diligently monitored the laser photocell alignment reading and made sure it was replaying properly…

and his little brother won 2nd place in his den!

The laser stayed aligned for the entire race – we were so worried that it would get bumped and knocked around – but it just worked. In fact, we staged this laser alignment shot because we never had to align it after we first set it up!

I was so busy running the track during the race that I didn’t get much video of the system in action – the best part of this Pinewood Derby was hearing the crowd gasp at tight races, then a few seconds later you’d hear it again as they watched the slow motion replay. The Cubmaster called  Adam up on stage to give him a big thank you for his project – and the crowd cheered.

Later that night, after the track had been put back in storage and we brought the instant replay system home, he looked at me and said with pride, “I finally invented something!”

Awesome work Adam!

About iancole