Introduction: Radio Controlled Race Tree

Introduction

My cub scout pack, like most, runs a pinewood derby event every year. I was looking for a way to make things a little more interesting, so I came up with this race tree. All real drag races have race trees, so why not the pinewood version? My original plan was to hook the tree into my derby running software, but before I got that far, I my mock-up morphed into something I could use on our space derby (different race tree - uses a box to make horizontal light bars, but same electrical design and same arduino-powered brain), which doesn't have software, and needed a remote control box, instead. After seeing the scouts have fun controlling the race tree with the remote, I realized the software-driven approach was not to be. Those of you with more time than I might consider 1) hooking your tree into your track's launch system, using a servo of some sort to physically open the starting gate/start the race, and 2) to control your race timing board, and 3) to tell your race program when to listen for results.

Step 1: Eat One Hundred and Twelve Cinnamon Rolls.

We used the Pillsbury brand, but others may work. You need to save the plastic cup and metal lid the icing comes in. These become the light housings on the race tree unit.

Warning! Do NOT attempt to eat the cinnamon rolls in one sitting. Pay attention to the recommended serving size.

Step 2: Parts List

Remote Control Box

  • 1 4'x4' sheet of plywood or scrap (3/8" and 7/16" thick pieces work well)
  • 2 metal handles (see pics)
  • 1 8-12" long piano hinge
  • 16 wood screws, ~1" long
  • Paint or wood stain
  • Misc machine screws, washers, nuts to attach the side handles & piano hinge
    • My handles needed 3 each; piano hinge took 8

Common

  • 22 gauge hookup wire (my Amazon recommendation)
  • 2 nRF24L01 radios (1 for remote, 1 for race tree; ~$6 for both)
    2 SD card modules (1 for remote, 1 for race tree; ~$5 for both)
  • 2 SD cards (you need a 2nd one for the race tree; any size; not all cards seem to work, so try what you have laying around first)

Remote Control Guts

  • 3 large buttons - the bigger, the better (tBtB). Mine were salvaged from a large industrial machine.
  • 1 3-position switch - (tBtB). Mine is a manual-off-automatic toggle. A two-position switch will work, if you forego the self-destruct part of the device, which I have not yet implemented/activated in my device/instructable.
  • 3-position guitar pickup switch
  • 5-position guitar pickup switch (optional)
  • LCD 16x2 with presoldered pin header

  • Arduino Mega 2560 R3 (my Mega + LCD (and variable resistor?) came from this bundle)
  • Small speaker (i.e. from an old PC)
  • 1 330 ohm resistor (orange-orange-brown-gold, used on LCD pin 15)
  • 2 16v 100uf capacitor

  • 1 variable resistor, markings on side are u103 1202c, a common one that came bundled with other electronics

  • 1 small breadboard (optional, you can just solder everything together)
  • Female-female 22 gauge hookup wires
  • 3 sheet metal screws (used to attach speaker to lid)
  • Various standoffs (useful to attach arduino to lid)
  • USB battery pack (i.e. phone/tablet charger)

Race Tree + Controller

  • 14 icing cups+lids
  • Nail polish
  • Arduino Uno or similar board (mine is a Leonardo) (some boards, like the Nano, won't have enough memory)
  • 20pcs WS2812B 5050 RGB LED &PCB Board 1-LED Module Pixel Light 5V (you need 14)
  • 3.5'' female audio connector (stereo to power 2 speakers, else you need an adapter to drive more than one)
  • 1 5v 10 uf capacitor (RF24 radio power smoothing)
  • Electrical tape
  • Something to serve as the tree structure - I used old erector set pieces mounted to a 2x6 wood block
  • Piece of felt (optional - sized for whatever you use as a base)

  • Project box - I used a Google Chrome box - these make for great little project boxes

  • Black and white paint
  • Masking tape

Tools required

  • Safety glasses
  • Soldering iron
  • .032" diameter 60/40 rosin-core solder
  • Hot glue gun + glue
  • Hand saw or table saw
  • Hole saw bit (size to your buttons - depending on what you use, a jigsaw or drill bit may be more appropriate)
  • Drill + bits (size to your machine screws)
  • Screwdriver w/bit appropriate for your wood screws
  • Adjustable wrench or socket set
  • Rotary tool w/cutting and sanding bits
  • Needle nosed pliers
  • Wire strippers

Step 3: Build the Remote Box

Build a box to your liking. I'm going to gloss over the details of this part.

Cut the following box parts from your plywood sheet &/scraps. Thicknesses of 3/8" or 7/16" work nicely for the sides and lid. I used a ~1/8" particle board for the bottom, like pegboard, but without the holes. I didn't list this in the parts list, the thicker board will work just fine.

Dimensions

You can size this up or down to your liking, taking care to leave yourself enough room to put it all in. My box is larger than strictly necessary. The extra space affords room for miscellaneous items. I keep some items in mine that are helpful at the derby events:

  • Small mirror - useful to troubleshoot finish line LED alignments (not part of this project).
  • Sharpies - we use these to mark the cars, so I like to have a few extras on hand
  • USB charger + extra battery - because I'm paranoid. As it turns out, my fully charged 10,000mA USB battery pack was somewhere between 75%-100% after 10-hours of use at our district finals.
  • Misc tools (eg pliers) - because I'm paranoid

Remember, this is part prop, where look and feel are important! Miniaturization has no part in this project.

My dimensions are approximate. I made a few extra cuts for good measure ;-)

  • Top & bottom: 9"x14"
  • Sides (2): 8" x 3" x 3 1/2" (shorter side to front)
  • Back: 13 1/2" x 3 1/2"
  • Front: 13 1/2" x 3"

Pre-drill all holes for your screws to prevent splitting.

Sandwich the sides between the front and back pieces; attach with screws.

Attach the bottom.

Step 4: Lid Preparation

Internal speaker note
You don't need the internal speaker. It sounds great in a quiet room, but at an event, is barely audible. If you skip the speaker, you also do not need one of the SD card modules (you still need one for the race tree part).

Determine the location for your speaker then drill some holes for the sound. I made a grid of 1cm x 1/2 cm and drilled small holes. See the images

Cut outs for the controls

Decide how you will arrange your controls and cut out the lid to accommodate. I'll leave this part for you to figure out, but will share pics and tips to help you:

  • Rotary saws, drill bits, and jigsaws were my preferred tools. Use a drill bit large enough for your jigsaw blade to help get cuts started. For round buttons, use a hole saw on your drill.
  • I did a lot of hacking to the wood to thin out the material to allow for a nice flush(ish) mount of some of the controls (lcd and guitar switches). See the images for ideas.
  • I used hot glue to mount some of the parts (LCD and some under the lid components). Drill shallow holes at angles to give the hot glue some places to get into for more secure mounts.
  • A router might be a better way to do some of this.

It is projects like this that separate the true craftsmen from the mere hackers. Which one are you? I am in the latter group.

Attach the lid
Attach the piano hinge to the top and rear side. If your hardware is anything like mine, be sure to see the image notes for tips on avoiding some problems. Paint the box to suit your tastes. I used leftover house paint, which gave it a nice military vibe. I printed some glyphs I found/made onto transparent sticker paper. I was less than impressed with the result. If I were you, I would find another way, perhaps spray paint with stencils.

Step 5: Prepare and Mount the Controls, Electronics

Important note on the radios this project uses: Range is somewhat limited/iffy as-is, largely due to the thickness of the remote box, which degrades the signal. Range was maybe 40 feet, but reliability improved as the remote was moved closer to the tree. I then applied this hack to the radio unit in the remote box, after which I was able to get reliable radio communications across most of the distance of a large auditorium, maybe 40 yards. You could hack both radios for even better range, but that is probably overkill.

Test-fit the components

Test-fit controls, LCD, and boards into the openings you created. Make sure the wires you have will reach. Use female-connector wires where you have do, and spooled connector wire everywhere else you can. I'm using 22 gauge hookup wire from a 6-spool box. It is supposed to have 6 colors, but they gave me 2 blue spools, shorting me a black one. You will notice this on the race tree part, where black would have been a logical color to use, I used blue.

Attach the components

Attach with wood- or sheet metal screws, hot glue, whatever works for you.

Attach stand-offs to the Mega, then hot-glue those to the lid. I drilled small, shallow holes for the stand-offs to sink into prior to hot gluing. Take care not to drill all the way through!

The guitar switches work well with the screws they normally come with.

I hot glued the LCD panel, radio, and SD boards.

Attach the PC speaker with sheet metal screws.

The breadboard had a self-adhesive sticker on the back. Were I to do this project again, I would forgo the breadboard and solder things up directly. At the time, I didn't intend this to be a permanent home for my Arduino, but now I see the folly of such thoughts - just buy another Arduino.

Step 6: Electrical Hookups for the Remote

For this step, take a look at the diagram. Be sure to read the notes, as there are several things not shown in the
wiring because I couldn't find the right components (and apparently too lazy to figure out how to create them). Here are some additional comments on this step:

Buttons, speaker, & switches are wired directly to the Mega or via breadboard, as you prefer. There are a couple of capacitors and a resistor to include in the mix, but otherwise is pretty mundane.

A note about the Arduino in use here - the Mega provides more connections than the Uno and most other boards. It also provides more memory. I'm not sure you could fit the code into a lesser device, at least not without resorting to some mind-numbing memory saving tricks. But this project is for fun, and Megas are inexpensive these days, so don't create frustration where none should be.

The source code has a set of #defines at the top that show which wires plug into the Mega. The radio's ICSP wires plug into the SD card's 2nd set of same, and the SD card is plugged into the Mega's ICSP pins. Some boards do not have these pins, in which case you can use pins 50-52, which as I understand it, are physically connected.

Do be sure to wire the capacitor between the radio and its power source (the Arduino) - this seems to be a critical step to smooth power, else your radios may not work reliably, if at all. Also note I use a different sized capacitor for the tree controller's radio - the details are forever lost in my brain, er, browser history, but I believe either size is sufficient for the job.

Step 7: Race Tree Structure

Build skeleton
This is where you need to get creative and build a structure that will be the skeleton. I used parts from an old Erector Set attached to a painted block of wood - this is where the black & white paint and masking tape come in. I also glued a piece of felt to the bottom, but I did that more to account for minor problems in my scrap block of wood to give more stability than anything else. I like the somewhat industrial (read: 'raw') look this gives it.

Make the light covers

The plastic cups (remember all of those cinnamon roles you ate) serve as light diffusers. The lids provide a surface to mount the individual LEDs onto + solder wire connections.

Drill a hole in the center of each of the 14 icing lids. The holes need to be big enough for the LED-part of the component to fit thru, but not so wide that the whole board does. I used electrical tape to bind them all together then made the hold on a drill press. You could just drill them out individually. In any case, be sure to remove any stray bits of metal from the lids to prevent shorts.

Attach the light covers

Decide how you will attach the cups to the tree skeleton. Erector sets lend well to using nuts, washers, and bolts, so in this case I drilled two holes in each cup for the bolts to go thru. See the pic in the previous step where the lid is pulled away from the cup to get an idea of this.

Insulate the lids

The LED units have exposed metal bits on the LED-facing side. Pressing these against the bare metal lids is probably as bad an idea as it sounds. Get some nail polish and coat the lid's metal around each hole where the LED would touch. Let dry. I don't have a pic of this, but rest assured, it's there, under the hot glue. My nail polish happens to be black, but any color should block electrons.

Attach the lids to the cups by wrapping the top of the cups in electrical tape with a portion of the tape extending past the lid. Put some tension on the tape as you wrap and the excess tape will bend in towards the center of the lid. Press the tape against the lid. The tape may not stay stuck to the lid, but it should curl in enough hold the lid on. It only looks bad up close, I promise!

Step 8: Race Tree Light Info

An now for a word on the LEDs used in the project

WS2812B WS2811 5050 RGB LED & PCB Board 1-LED Module Digital Pixel Light 5V

The LEDs I used are basically a bare-bones version of Adafruit's. Unless you have a nice soldering iron that can handle small, intricate connections, consider spending some extra dough and get Adafruit's version, which looks to be easier to deal with.

The race tree software is written such that no more than two LEDs are lit at any one time. If you change this to light up more than three at full power, you will probably need to power the lights with an external power source, as your Arduino can only push something like 500mA.

The next bit is from Adafruit's nice guide on this subject. My design followed this advice. Yours should too.

https://learn.adafruit.com/adafruit-neopixel-uberg...

  • Before connecting NeoPixels to any power source, add a large capacitor (1000 µF, 6.3V or higher) across the + and – terminals as shown above.
  • Place a 300 to 500 Ohm resistor between the Arduino data output pin and the input to the first NeoPixel. This resistor must be at the NeoPixel end of the wire to be effective! Some products already incorporate this resistor…if you’re not sure, add one…there’s no harm in doubling up!
  • Try to minimize the distance between the Arduino and first pixel.
  • Avoid connecting NeoPixels to a live circuit. If you simply must, always connect ground first, then +5V, then data. Disconnect in the reverse order.
  • If powering the pixels with a separate supply, apply power to the pixels before applying power to the microcontroller. Observe the same precautions as you would for any static-sensitive part; ground yourself before handling, etc.

Step 9: Wire the Lights

This step requires a steady hand and some patience. At this point, your tree skeleton is built and the diffuser cups/lids are attached. Lay this down on a table and place your LEDs into each of the 14 holes. These LEDs have 6 connectors - 3 in and 3 out. Direction is important - there are arrows on the back of the LED board showing this. Arrange the 14 LEDs in their respective 14 lid holes. You can affix them with hot glue to make the soldering task easier, just be quick with the solder or the hot glue will melt...

You will be connecting these LEDs in series, but if you really think about it, I think they are parallel connections internally, else we would have to apply 14x5V of current (that is, in theory, since this project only lights two at once).

Figure out how you will run your wires. Don't run them as the crow flies, else your wires will be susceptible to damage from handling, no matter how much hot glue you apply. See the image showing the wiring order. The first set of wires you solder (to light #1 - see diagram) should be a bit longer - maybe 12". These will be used to connect the tree to the Arduino control unit we have yet to build. Keep in mind the wires from LED #7 to 8 may need to be a little longer. Cut your 5V-red, GND-black, data-X wires to length. It pays to cut a little long. Test fit a few wires before cutting.

Strip off about a 1/4" of insulation in each end.

Fire up your soldering iron. Use a fine-gauge solder - I used .032" diameter 60/40 rosin-core solder. The LED connector pads are tiny. The wire we will be using is 22 gauge - perfect for this work, and also perfect for breadboards and Arduinos. I'll assume you know how to solder, but if you don't, you can find a good number of instructions on the net, including some quality ones right here on Instructables. I can, however, share some tips I learned along the way:

  • Use a fine iron tip
  • Pre-tin the iron tip
  • Pre-tin the 14 LED connector pads - there are 6 on each. This will make the wires much easier to solder to the LED pads.
  • Be consistent with your wire colors. Use red for 5V, black for GND, and your favorite non-black, non-red color wire for the data signal.
  • Protip: Use a multimeter to check solder connection isolation from neighbors.

Solder the longest wires to the IN connectors on LED #1 (see diagram).

Connect the OUT connectors on LED #1 to the IN connectors on LED #2. Repeat thru LED #14. LED #14 doesn't need to be connected to anything, so leave its OUT connectors untouched.

Whew! You just finished something like 75 tiny solder connections! Go collect your soldering merit badge.

Later, you will seal these connections in hot glue for security, but you should wait until we test the tree. I tested mine every lights I completed, and you can too if you play with the Arduino code. Just take care not to light more than two at once lest you stray into low power issues.

Step 10: Build the Race Tree Controller

First, some notes

  • I mounted the Arduino to the inner white box with stand-offs. While this made for a stable installation, it did push the box above the outer box's capacity, so the lid doesn't quite close perfectly well.
  • I soldered a few things to a little protoboard. I had a little green breadboard in here, but its connections weren't reliable. Lesson: always use quality breadboards. You can use either.
  • The SD reader &/or Arduino SD library is a bit finicky. Of six SD cards, only an old 2GB card worked, initially. I needed two - one for the remote, and one for the tree controller. Research revealed these things can be sensitive to how the card is formatted, and that all major operating systems (Windows, Mac, Linux) all diverge from the ISO standard in subtle ways that seem to render them useless to this SD hardware + library. My son formatted my other cards with the SD Association's own formatting tool (get it here) and two more cards began working. I lost a lot of time dealing with this issue - I kept thinking my connections were bad (I did have a bad breadboard) or my SD unit was bad. I'm just lucky my first SD card happened to work, or else I may never have finished this project at all! The only other thing I can say here is when it works, it always works, and when it fails, it always fails. The SD library has some additional capabilities available for troubleshooting, but I didn't get far enough into this to try it.
  • The radios should work just fine at short range, but reliability drops with distance. Make sure you hack the radio in the remote to give you adequate distance. You can hack the tree's radio, too, but I've not seen the need. Do be sure to wire the capacitor between the radio and its power source (the Arduino) - this seems to be a critical step to smooth power, else your radios may not work reliably, if at all.
  • I used an Arduino Leonardo, because that is what I had on-hand. An Uno will also work just fine.
  • Wire up the radio and SD reader just like you did for the remote, noting the pins we use here are probably different.

Step 11: Race Controller Wiring

Sorry, no diagram for this one. Abbreviations used below:

  • AR - Arduino Leonardo or Uno
  • RF24 - Addicore nRF24L01+ radio
  • SD - SD card reader board

RF24 connections

  • IRQ (pin 8) to AR pin 2
  • CE (pin 3, Chip Enable) to AR pin 7
  • CSN (pin 4) to AR pin 8
  • GND (pin 1) - AR GND*
  • 3.3 VCC (pin 2) to AR 3.3V*
  • SCK (5), MOSI (6), MISO (7) to counterparts on the SD card module

* Wire a capacitor across the 3.3V and GND between radio and Arduino. I forget the technical name for this common usage of a capacitor, but it smooths out the power signal, and eliminates a source of problems for the radio units. I used a 50v 10uf capacitor here, but used a different size in the remote, purely based on what I had on hand. I believe I determined either size was adequate for this project. If you use an external power source for your LEDs, you may want to revisit this decision.

SD board connections

  • GND x4 to AR GND (I was having problems with the SD card, so in an act of desperation, wired all 4 to GND, not sure this was necessary - I only connected two in the remote's SD board).
  • 3.3V *open*
  • 5V to AR 5V
  • CS to AR pin 11
  • SCK (5), MOSI (6), MISO (7) to counterparts on the Arduino's ICSP interface. I think you could also use the designated numbered pins if your board doesn't have the dedicated ICSP pins. Google your board's name + ICSP for details.

3.5mm jack connections

  • Signal to AR pin 5
  • GND to AR GND
  • Note: if using a stereo jack like I am, there is a way to wire it for shared mono, but I just use a stereo-to-mono converter I had lying around.

Race Tree

  • 5V (red) to AR 5V
  • GND (black) to AR GND
  • Data <=> 300 - 500 Ohm resistor <=> AR pin 6
    • I wired the resistor inline and covered it in some heat-shrink tubing. You could put the resistor in the box &/or wrap in electrical tape.
  • Note: I snipped a connector + wires from some scrap PC parts. The race tree's three wires just plug into that. You might prefer to find a mating connector and wire the tree up to that for a cleaner, mistake-free connection. If you swap the wires, you could ruin the tree.

Shove it all in the box and make cutouts in the enclosure for the ports. See images on prior steps.

Step 12: Software

1) Download a copy of the Arduino IDE from https://www.arduino.cc/en/Main/Software

2) The Arduino code for the remote control and the race tree. Get both projects under this link:

https://github.com/joneser005/racetree

SpaceTreeRemoteControl & SpaceTreeSignalBoard

3) Arduino > Sketch > Include Library > Manage Libraries...

  • Add "SD by Arduino, SparkFun Version 1.0.6"

You also need some 3rd party libraries for the LEDs, radio, and wav playback. Look in the Arduino Library Manager (step 3, above), and if you don't find them, pull them down from Github and install:

Adafruit_NeoPixel by AdaFruit

RF24 by Maniacbug for radio comms

TMRpcm by TMRh20 for wav playback

4) Build + upload the 'remotecontrol' project to the Mega (or other Arduino - adjust pins to suit).

5) Build + upload the 'tree' project to the Leonardo (or Uno or whatever you used in the race tree).

Be sure to select the correct board before initiating the build.

You can connect the Arduino to the serial monitor to see some debug messages. Arduino only lets you talk to one board at a time. You can do better. Connect both boards up to your computer and connect to them both. On Linux-based systems, you can use the 'cu' utility to connect to each board in a different terminal window, where the boards' device names will be something along the lines of /dev/ttyACMn, though yours could differ:

cu -l /dev/ttyACM0 -s 115200
cu -l /dev/ttyACM1 -s 115200

Use google to find similar commands for Mac or Windows.

Step 13: Sound Files

The last thing you need are wav files. I have 6 sets for the race tree + a single set for the remote control box. Each set lives in a numbered directory (0-5) off the root of the SD card with a single number. Each folder corresponds to a different set of sounds selected via controls on the remote box.

Filenames must be: finish.wav go1.wav go2.wav go3.wav gooooo.wav notfunct.wav powerup.wav query.wav ready.wav set.wav

wav files must be 8-bit mono, no compression

The docs on the TMRpcm library outline the specs for wav files. I can put that info here if there is interest.

My sounds follow these themes, but you can make your own.

Pinewood Derby: 'standard' race tree, horns, and silly sounds

Space Derby: 'standard' race tree, old-school star trek, and home-brew cylon-like voices

PM me and I'll get you a copy of my wav files.
They aren't that big - Arduino processors don't like wav files with high bitrates - I just never bothered to add them to Github.

Step 14: Making It All Work

If you got this far, all you need to do is plug everything in...

Remote Control

1) Plug up the remote's Mega USB connector to your computer's USB (if you want to see serial messages) or to a USB battery pack (for normal, cordless operation).

2) The LCD should light and display "Launch Control Ready" and a robot voice will say 'Systems Online'. Note some battery packs need to be turned on to provide power.

Race Tree

1) Plug the speakers power to an external power supply.

2) Plug the speaker line-in into the Race Tree Controller's 3.5mm audio jack.

3) Plug the tree's LED wires to the controller's LED wires. Don't mix these up.

4) Plug an appropriate DC converter into the Race Tree Arduino's power-in jack. Uno and Leo accept 6-12V DC, min 500mA. Note if you instead power this device via USB, you may experience LED data signal leakage into the audio stream. I don't fully understand why this is. Use a wall wort and you will be fine.

5) The tree should cycle lights on all lights, and play a wav file.

Operation

The lights operate in pairs, from top to bottom, there are seven pairs, 1-7.

Note: Race tree ignores radio comms when it is playing a wav file.

Race Tree States

Power on: #1 lights are blue

Ready: #1 lights are yellow

{Press the remote control's reset button (big green button at top-right on my unit) at any time to enter/re-enter the Ready state}

Set: #2 lights are yellow

{ Must be in the Ready state, then press the 'Set' button (middle red button on my unit) }

GO sequence: #3-6 fire in sequence, speed dictated by the wav files being played. 3-5 are orange, 6 lights green to indicate the racers begin.

Stop: #7 lights red five seconds after the GO sequence completes. You can change this in the code - I think 5 seconds was a bit long for cars finishing their races in less than 3 seconds.

Error: #1 lights red - I think I saw this happen once or twice before my last round of changes to the code. This may have been a bug in my code or a fluky radio.

Troubleshooting

Once everything is working, that is. If you have problems during the build, try to work it out or PM me or ask in the comments.

Tree is not responsive

I've run this rig for 10 hours straight at our cub scout district finals. The only problem I had was three instances of no responses from the tree. All were fixed by a simple power cycle, once on the tree once and twice on the remote. Perhaps a bug is hiding in my code somewhere.

Tree sometimes is not responsive

Radios too far apart? Try closing some distance between the remote and tree. If you have this problem, you probably skipped the radio hack I recommended.

Lights are dim

Check connections to the light tree. 5V, data, GND must all be good.

Phasing whine in speakers

The race tree's Arduino is powered via USB. Use a suitable DC adapter.