Drag Racing Christmas Tree For RC Cars
Posted: June 9, 2010
This is a two part circuit I made for racing RC cars. The first part is a drag racing christmas tree with 3 yellow lights, a green light, and a red light at the bottom. The circuit has sensors to detect if a car crosses the starting line before the light turns green and a speaker to make 1980's car racing game sounds. The race is started with a simple push button. At the end of the drag racing track is a circuit to show which car won the race.
I originally made these circuits with a Amtel AVR8 chips but recently decided to try and "one-up" it and make it nicer. I had a couple Wixels from Pololu that I wanted to use to test the 8051 support in naken_asm so I figured I'd redo the circuits with these. Since they had radios build into them I could now make the starting circuit communicate and control a timer on the ending circuit making the race more interesting.
The source code, schematics, and explanation are further down on this page.
Related Projects @mikekohn.net
Here's a video of the new Wixel circuits, first on my desk at home showing the circuitry works and then at work where my co-workers helped me by driving the cars. Those cars are unfortunately still very difficult to control due to the fact that pushing left / right on the steering control turns the wheels full left / right. https://youtu.be/JwOyFHUCe60
I ended up selling the Wixel version of the circuit to someone, so I decided to build a new one using MSP430 and XBee radios. It seems the lasers I used before were discontinued, so I got different lasers and hot-glued them to some wooden mounts so they were a lot easier to aim. The source code for this version is also on GitHub... I haven't posted a schematic yet, not sure if I will or not. https://youtu.be/v6fWhuO8RxQ
Here is a video of the original Atmel racing lights being tested. Unfortunately those cars are cheap and hard to control. The surface of the table is too slippery and the cars only have forward, back, left, right as a digital full on or off. https://youtu.be/xlghOGqn3ds
The original circuit was done with an Atmel ATtiny2313 for the starting circuit and an ATtiny13 at the end of the track. The sensors to tell if a car starts too early and who crossed the finish line first was done with an infrared emitter and detector that reflected the IR off the car into the detector. The code (available below) is written in Amtel AVR8 assembly and can be assembled with naken_asm.
The new circuit is done with a pair of Wixels from Pololu. Unlike the original circuit, the finish line circuit has two SparkFun 7-Segment Serial Displays that show how much time has elapsed since the race has started. These displays are really nice (actually felt a bit like cheating) since they have their own microcontroller to drive the LED's and just need commands sent to them over SPI (or i2c / UART). Since the Wixels are based on the on a TI CC2511F32 microcontroller which have built in radios, the finish line circuit can be told when to reset the timers, start the timers, or clear the timers (because of a disqualification) by the starting line circuit. Also, instead of using infrared bouncing off the car to detect it crossing the starting / finish lines, for this circuit I used a 650nm Red Laser from Jameco pointing into a TEPT5600 Light Sensor Transistor.
Probably the hardest part of this circuit (besides the mechanics... aiming the lasers correctly, cutting the wood, soldering all the wires to a clean length, etc) the hardest part was probably the radios. I originally just read through the datasheet and and tried to use all the default values, but I couldn't get the circuits talking. I emailed Pololu asked for help and they recommended I just convert the C code from their SDK into assembly and use that. Other than an 8051 mistake I made it worked pretty much first try. Nice to see a company that is extremely responsive and seems to care about supporting a product they make. The SDK they make actually seems pretty nice, but again I really wanted to learn 8051 assembly and test naken_asm.
One odd note about the 8051 mistake I made when converting the C code to assembly for the radios: The mistake was I pointed to the DMA configuration to the wrong part of memory by forgetting the # in the assembly instruction. When I started up this bad firmware, the netbook I was developing the code on lost contact with my 2.4GHz WiFi access point and wouldn't reconnect until I reset the device / fixed the firmware. It seems I must have flooded the same radio channel that the 802.11 WiFi was using.
Other than the obvious parts (LED, resistors, 2N3906 transistor, PC board, wood, acrylic paint), I used the following parts:
The new Wixel based starter circuit with 2 radio controlled cars. The structure is made out of wood and painted with acrylic paints. The LED's and the speaker are attached to the wood structure with hot glue. This time I have bigger cars (Jada 1/16 scale cars) so they should be easier to control. To the left and right of the cars are the 3 AA (~4.5v) battery packs connected to the lasers that point at the photo sensors. These specific battery packs are really nice since they have an on/off switch on them.
The new end of track circuit has two 7 segment displays for a timer accurate to 1/10th of a second. The timer stops when the cars break the laser beam pointed at the photosensors. Because the displays can be controlled with SPI (as they are in this case) I was able to tie all the common signals together (data, clock, vcc, gnd) which minimized the number of wires and also makes sure they are in perfect sync. The only uncommon wires between the displays are the chip selects. So to stop a timer the only thing need to be done was to keep /CS at +Vcc for either the left or right 7 seg display. I did this by keeping the R7 register of the 8051 as a global /CS value.
Here's a closer up view of both the starting and ending track Wixel circuits side by side.
Front view of the original Atmel AVR8 starter circuit with 2 smaller radio controlled cars (I believe these are 1/24 scale). This picture shows the car on the left moving forward early and faulting, turning on a red light.
This is a close up of the original Atmel AVR8 starter circuit. I covered the infrared detector and receiver on both sides with black shrink tubing (unshrunk) just to make sure ambient light doesn't affect the sensor. A couple months after I made this circuit, I recyled the IR emitter / detector for a propeller tachomter that I used to caculate the thrust of some spinning propellers for a couple other circuits.
This is the original Atmel AVR8 end of track circuit that's placed at the end of the race track to detect who has won the race.
Schematic for the new Wixel based circuits.
Schematic for the original Atmel based circuits.
Schematic for the MSP430 based circuits.
Copyright 1997-2021 - Michael Kohn