I've put up this page to share my designs for PICmicro based digital finish lines for Pinewood Derby tracks.
There is a lot more detailed information in the Info Section of the site
This page is really for people who want to build their own timer from scratch, or customize the design in some way. PIC programming knowledge wil be required to modify the firmware if you alter the hardware design enough to require it. No programming is necessary if you use my kits or board sets.
Most people will want to use one of the kits or printed circuit board sets to jump start the project.
There are three main variations of the design:
Designs 1 can be build using the 18-pin PICmicro 16F628 or 16F88. Design 2 really needs a 28-pin device, although you could use an 18-pin if you are willing to give up the ICSP (In Circuit Serial Programming) pins. Design 3 requires the 40-pin 16F877. The boards and kits are based on Design 3. The kits can be used with or without the LED display, include an optional reset switch input, and the serial computer interface. The kit version can function with or without a computer connected, just like designs 2 and 3. The kits also include an ICSP connection on the board, allowing firmware upgrades using an ICSP programmer without requiring removing or replacing the PICmicro chip.Be sure to check the basic under $10 timer design page which shows how to build from scratch a basic 5-lane PIC based timer for under $10!
There are two ways to hook them up. You can pull the pin high with a resistor,
and have the phototransistor pull the pin low when illuminated, or you can pull
the pin low with a resistor, and have the phototransistor pull it high when
illuminated. The firmware is configurable to work either way.
On my PC board design I pull the pin high so that I can use a single 8-in-one
resistor network chip for both the sensors and switches, rather than a bunch of
Here are sample diagrams:
PIC pin pulled high
For this version the output is pulled low by the phototransistor when the sensors are illuminated. When a car crosses the finish line, the phototransistor turns off, and the resistor pulls the line high.
This is the version used on my PC boards.
Note that the resistors for the sensors are on the board. They are a part of RN1 (which is 8-resistors in one part) shown in the diagram. You do not need additional resistors on the track, only the phototransistor. RN1 isn't on the P40b as I used individual resistors on the prototype.
PIC pin pulled low
For this version the output is pulled high by the phototransistor when the sensors are illuminated. When a car crosses the finish line, the phototransistor turns off, and the resistor pulls the line low.
I've found that Ultra Bright White LEDs work much better than the IR LEDs. The White LEDs put out a lot of IR, are much brighter, and being visible they are much easier to align and to verify the alignment before each race.
These same phototransistors are available from glitchbuster.com for around 50-cents each, with only $1.85 shipping. They have almost all the parts you will need, and at the best price I've seen anywhere -- a considerable savings over Radio Shack.
You can get 7000 MCD red LEDs from LSdiodes.com for only $0.60 cents each and $2 shipping. These should work ok, and cost less!
The phototransistor should be mounted in a narrow tube that is one to two inches long and has been painted flat black on the inside. This reduces the effect of ambient light on the sensors. The total distance from the LED to the sensor shouldn't be greater than 6 inches with the standard IR or UltraBrite White LED. Even less for a 3000 MCD red LED. A brighter LED may give you more distance. Alignment of the LED with the phototransistor and tube are important, since you want maximum signal when the LED is on and unblocked.
If you have a newer laptop or computer without a serial port, a USB to serial adapter can be purchased relatively inexpensively and works fine. I got mine at the local Best Buy or CompUSA in the PDA section for around $20. Note, however, that while this will work fine for running a race and talking to the race timer, it cannot be used with a serial pic programmer for programming the chip, because it has insufficient voltage for programming.
For more details about the board, see the Timer Board Manual.
The large-digit driver board is used to power finish line display digits larger than 1-inch tall. (The driver is necessary for digits drawing more voltage or current than the 5v 20mA the PIC can supply.) By changing the value of the resistor chip, input power, and voltage regulator you can drive digits as large as 5-inches. The default configuration, shown above, is intended for the 3-inch tall digits discussed elsewhere on this site. (Part 202542 from Jameco.com.) I've found them to be the best size for a finish line display.
More info on the digit driver can be found on the driver board page.
Other than using the custom timer board, if you want to save a few steps, you can buy an Olimex PIC-P40B proto board from SparkFun Electronics for a around $22, which already has most of the parts in place. It has a DB9 connector hooked to a MAX232 with all the necessary capacitors, all the power related components, and a PIC16F877A already mounted and ready to go. It even has a jack for a wall-wart power supply. (Which you can also get from them for $3 to $6, if you don't want to dig through your junk box for one.) It also has an ICSP (in-circuit serial programming) connector, which with their PIC-PG1 for about $8 and the free ICPROG software from Bonny Gijzen gives you the ability to download the programming to the chip yourself. All you'd have left to do is solder in the resistors and the lines to the sensors, and a couple of lines from the MAX232 to the PIC RX and TX pins, and you'd be ready to go. It doesn't get much easier than that. You could use the PIC-P18B or PIC-P28B, but they aren't much cheaper, and the 40-pin 16F877A gives you enough spare I/O pins to later add a 7-segment LED Display if you want, for stand-alone operation without a PC.
Olimex PIC-P40B Proto Board: (Shown without the PIC 16F877A chip.)
On the PIC-P40B, to connect the MAX232 to the PIC, connect PIC pin 25
(RC6/TX) to pin 10 of the MAX232 (the RX hole on the protoboard),
and pin 26 (RC7/RX) of the PIC to pin 12 of the MAX 232(the TX hole), as shown below.
The pins by the Max232 on the P40B are labeled for the computer's RS-232 pins they correspond to,
so the Max232 RX goes to the PIC TX, and the Max232 TX goes to the PIC RX, as seen below.
Below is my complete development test environment.
It shows the "track simulator" I put together for testing and debugging
the firmware without needing a real track at my desk.
The programmer in the picture is a
kitsrus.com kit 150 USB programmer,
but I also use the Olimex PIC-PG1 serial programmer. With the USB programmer, I can leave it
hooked to the ICSP connector and keep the P40 RS-232 connector hooked to the com port,
without having to switch the serial cable back and forth and shut down hyperterminal every
time I want to load a new compile of the firmware. Plus the USB programmer is much faster,
programming and verifying the whole chip in about 5 seconds.
Unless you are using the P40B, you'll also need a regulated +5v power source, like the one at the lower left of my schematic. Plans for another good one can be found here.
The advanced version looks like this:
Note that the starting gate pin should not be hooked directly to a relay or solenoid, but to a driver transistor.
Here is an example using a MOSFET driver transistor. (The IFL540N is around $1 from glitchbuster.com)
The diode in parallel with the solenoid is also important, as it prevents the reverse current spikes
that would otherwise occur when the solenoid switches off.
To see how the 7-segment display hookup works, see How does it drive six 7-segment displays using only 13 pins for an explanation of digital display multiplexing. Note also that there are no current limiting resistors on the board. This was done to allow maximum flexibility in your choice of display hardware, however you must be sure you provide an appropriate voltage level for the 7-segment displays you are using. For small digits that just means appropriately sized current limiting resistors. For large size digits that means driver transistors and a higher voltage source. My next few goals for this project are to construct a sample kind of "reference standard" small digit display, as well as a design for a large digit display made up of of discrete LEDs, and one using 3" 7-segment LED's modules. (I recommend part 202542 from jameco.com, as they seem to be the biggest bang for the buck in the large LED Digit Display category. Also they are about half the price of the equivalent from DigiKey, which can really add up if you have lots of lanes.)
The firmware is "soft configurable" for several hardware options. I've written a MS Windows program to set up and configure the firmware. You can download the executable here or a zip file containing it here. The settings are stored in the eeprom on the timer, so you should only have to perform the setup once.
The PC Software Interface Protocol for communicating with Race Management Software on a PC is documented here.