John: My son is in Cub Scouts, and for years we’ve been building Pinewood Derby cars. It’s always … interesting to see how much involvement the scouts have, versus their parents, in making their cars. For the most part, I’ve let my son do what he wants: cut the car, sand it, paint it, and so on. But after watching one parent spend hours painstakingly cutting, sanding, and grinding his kid’s car, my son and I decided we’d kick it up a notch this year — his last year in Cub Scouts.
August: My dad and I had an idea that our last Pinewood Derby car should be really cool. My dad is a geek and really good with electronics so he did most of the coding. I did most of the design. I thought it was a lot of fun because I got to spend more time with my dad, and got to do a lot of things that I like. I couldn’t wait until the race to see how fast it was. It did not win a single race — but we did win the most unique car design. It was the best Cub Scout experience I’ve ever had.
John: Even though I have a pretty nice wood shop, I’m more of a programmer type (I’ve written 6 books on mobile development). I’d wanted to do something with Arduino, so this seemed like the perfect opportunity to do so while at the same time providing me with a chance to teach my son how to wire things together, solder, and write code.
In this project, we’ll show you how to create a Pinewood Derby car that uses an Arduino compatible microcontroller board and an accelerometer to flash a set of LEDs in response to the orientation of the car. When the car sits flat in the pits, it flashes the lights in a certain pattern. When it’s at the starting gate and on the angled portion of the track, the light pattern changes and becomes much more active. Knowing that the car may jump off the track, we added special “danger” patterns when the car is tipped on its left or right side.
Since everything is done in code, it’s super easy to completely change the light patterns and orientation settings in the software. You and your kid can spend hours trying out different patterns to get the right, and potentially unique, ones for your car.
COMPONENTS
For this project, we used the following components:
Arduino Board
The Arduino is a programmable microcontroller that’s open-source, so there are a lot of different boards available. The Arduino team has designed some, while others in the community have implemented their own designs. Check out the Maker Shed and you’ll find a bevy of devices of all sizes and capabilities.
You can use any Arduino-compatible board with at least 10 digital outputs and 3 analog inputs, but since the Pinewood Derby car has specific requirements for length, width, and weight, your choices will be limited based on what will actually fit on (or in) your car. We prototyped our solution using a breadboard and the Arduino Micro (Maker Shed #MKSP20). This allowed me to teach my son breadboarding and get him involved in wiring the solution before we started soldering things together. When it came time to mount it on the car, I looked for an even smaller board and selected the Teensy 3.0 (pjrc.com/teensy). Since then, a 3.1 version was released and I’m sure there are other, suitably sized alternatives. The LiPo battery I chose outputs 3.7V, so I had to make sure the board I selected could operate on less than 5V.
Power
We wired an alkaline battery pack into our prototype and it worked great. But with the car’s 5oz weight limitation, this wasn’t optimal. My son’s a smartphone fanatic (even though he’s too young to actually have a smartphone), so I started thinking about using a smartphone battery. A quick search pointed me to Adafruit’s 3.7v 1200mAh LiPo battery. It has enough juice to power the Arduino and LEDs for several hours.
A Pinewood Derby car performs best when its weight is as close to 5oz as possible. With this battery and the other parts I selected, the car’s total weight was 4.8oz, so we needed to add very little weight to bring it up to the limit. If you select a smaller battery, you’ll need to add more weight.
My original plan was to disconnect the battery for charging. My son and I started thinking how cool it would be to have the car itself be rechargeable, so we decided on Adafruit’s #259 USB charging module. With the battery embedded in the bottom of the car and the charging module mounted on the back, you can charge the car using a standard cellphone charger. (The #259 module uses a USB Mini-B connector so I had to dig out an old BlackBerry charger.)
Adafruit now offers an even smaller charging module (#1904) with a Micro USB connector, so this may be a better choice for your project. It looks to be the same size as the power switch (described in the next section), so it would be easy to stack them together and take up very little space on the back of the car.
If you don’t want to go the rechargeable route, you can use the Maker Shed 9V Battery Case for Arduino. It should fit within the base of the car (although you’ll have to make a taller car) and it has a built-in power switch.
Power Switch
To switch our LiPo battery on and off, I selected the Push-button Power Switch Breakout (#1400). It has mounting holes, so it’s easily mounted on the car, and it’s got an LED indicator underneath so it’s easy to tell whether the car is powered or not (just in case something else isn’t working) and the red glow just looks cool. You can also use the Tactile On/Off Switch with Leads (Maker Shed #MKAD81) but it doesn’t have an indicator light and you’ll have to figure out a way to mount it on/in the car.
Accelerometer
To allow the Arduino to measure the car’s orientation, I selected the Adafruit ADXL335 5V ready triple-axis accelerometer. Even though it’s rated at 5V, it will operate at the lower voltages provided by the 3.7V battery I selected. It has a small form factor and easily mounts on the front of the car.
Lighting
In our prototype, we simply wired in 5 white LEDs, but we were looking for something more. I tried the Adafruit 8 LED NeoPixel Stick — it’s simple, mounts cleanly on the car, and uses only a few wires. It’s also multi-colored, so that’s pretty cool. But it wasn’t bright enough for our purposes and I had some issues getting the sample code to work correctly, so I discarded it as an option.
Instead we decided to just wire up 10 LEDs. I purchased three sets of 3.7V LEDs: yellow and blue to match the Cub Scouts colors, and orange simply because my son and I both like orange. I selected clear capsules so that the LEDs all look the same until they illuminate. You’ll also need the appropriate resistors to use with the LEDs you select. I purchased LED/resistor bundles from Amazon (blue: amzn.com/B004UZCADG, yellow: amzn.com/B004UZB9WO & orange: amzn.com/B004UZ3FNU).
Wiring
To connect the 10 LEDs to the Arduino board, I purchased some 10-wire ribbon cable. The battery connects directly to its charging module, but I also needed to connect the charging module to the switch and from there to the Arduino board, so I needed black and red hookup wire too.