G-Scale Drag Strip Controller
The objective of this project is
to design and construct a controller that will manage a G-Scale drag
strip where two locomotives will race each other over a fixed
The controller is ready to go!
|Latest News: Several
decisions have been made that will necessitate some significant
changes to the software and hardware:
Two parallel tracks are set up on a level surface. A few feet from one end a "Christmas Tree" light pole and two IR sensors are placed between the tracks. Near the other end of the track two more IR sensors are placed to determine the winner. Sufficient track is left after the end sensors to allow competitors to bring their engines to a safe stop. It is recommended that diodes be placed in the track to prevent trains from running off the end.
A five conductor cable connects the far end sensors to the controller. A second five conductor cable connects the start sensors and a ten conductor cable connects the "Christmas Tree" lights to the controller. The controller itself connects to 7-12 volts DC and has two buttons on it, one labeled Start and one labeled Reset. A separate power supply that is appropriate for the voltage of the Christmas Tree's bulbs attaches directly to the lighting circuit. If LEDs are used for the Christmas Tree the same power supply that powers the controller can be used.
Each track is connected to its own power supply. The competitors control starting and stopping of the engines and use the throttle to determine their speed.
To start a race:
Latest Prototype Photos
This unit utilizes a PIC 16f873A processor that is mounted on a prototyping area that I left to the side of some of my speedometer circuit boards. This allows quick prototyping as the right side of the board allows for quick connections to a regulated power supply and programming pins. The PIC is to the left - the device to its left is a 4 MHz resonator.
Here is the back of the board - in its current state the chip can be programmed.
The components that are needed to drive the LCD display have been added in this photo. The pot in the upper right is used to adjust the display's contrast. The large resistor at top center is the current limiter for the backlight on the LCD.
A heat sink has been added to the 7805 regulator and a 7 pin header at top left connects to the sensors.
Here the connector for the sensors can be seen more clearly. The colored array of wires coming from around the chip connects to the Christmas Tree driver box.
A tight close-up of the wiring of the sensor cable.
Another view of the finished board, front...
... and back.
Another close-up of the sensor cable.
The other end of the sensor cable terminates in two female RJ-11 connectors. These will be mounted on the control box so that the sensors can be quickly connected or disconnected.
Here the LCD has been attached. The button (red on left) is RESET. The black button on the right is START.
A back view with LCD and switches.
The opening screen of the display.
This view shows the start line. The two start sensors are at the top. The two black blocks in the center contain IR detectors while the outer two blocks contain IR LEDs. The Christmas tree connector is shown at the very top.
This view is from almost directly overhead.
|Prototype #1 Photos
The Christmas Tree is made from 12 lights. Two blue at the top then three pairs of amber, a pair of green and two red at the bottom.
The negative lead from each LED is soldered directly to the square brass support in the center. Each positive lead has a 200 ohm 1/8 watt resistor soldered to it. This is needed to limit current to the LEDs.
A 10 conductor plug was added to accommodate the wires from the Christmas Tree
This view shows the start with the controller in the black box in the center. The Christmas Tree is at its top and the two sensors extend from the sides of the box.
A green lights signal the start of a race.
In this slightly blurred photo the red light in the right lane is lit indicating that the right engine false started.
To allow proper testing of the circuitry with 12 volt "Malibu" type bulbs a wooden tree support was made from a scrap of 2" x 2" lumber.
The face of the board that shows the bulbs has been tapered 10 degrees on each side so that the bulbs point towards one lane or the other.
The taper can be seen more clearly in this photo. The holes were drilled with a 5/8" Forstner bit with the drill press table tilted to 10 degrees. The bulbs are just a bit over 1/2" in diameter so they easily fit in the holes in the block.
Wires need to be connected to the bases of the Malibu bulbs before mounting them in the "tree".
The bulb's contacts can be seen in the photo below. Solder will not adhere to the contacts. In order to connect the wires to the contacts use a small screwdriver to spread each contact to that the stripped end of the wire can fit between the loop of wire.
The wires have been pushed through the contact wires and folded over.
A piece of 1/4" inch heat shrink tubing is slid over the end of the bulb and the connecting wires.
A secure connection is made after shrinking the tubing.
The bulb can be brightened a good bit by wrapping the back 2/3 of the glass in foil.
The foil is folded over the end and secured with a small piece of tape.
Here you can see how the foil acts as a reflector.
The bulbs are temporarily mounted in the "tree".
Now they are ready for painting!
A light coat of spray paint did the trick.
Flat black paint for the base.
The bulbs are inserted from the rear and hot melt glued in place.
The wiring for the bulbs terminates in a 10 conductor plug.
Here is a close-up of the connector.
The finished "Christmas Tree" has a wooden base and a plastic pipe support.
The box at the bottom holds the eight TIP101 Darlington transistors that drive the bulbs. The connector at the very bottom is for the 12 volt power that goes to the bulbs. Note that the power supply must be DC even though the bulbs themselves will work on DC or AC. The voltage of this power supply should be adjusted to match the voltage of the bulbs.
|Sensor Test Routine
A routine has been added that allows the operator to confirm that the two start and the two finish sensor are working properly. To access this routine press the "Start" button while the copyright screen is being displayed.
The first set of zeros in the third line shows the number of times the test routine has gone through its loop while the sensor was being blocked. while the second set of zeros shows the end sensors.
Here you see that the start sensor in lane 1 has been blocked while the test routine went through 25 cycles and the lane 2 sensor was blocked for a bit more time as it shows 33 cycles. The count goes from 0-255 when it resets to 0 and starts counting again. This method of testing is useful as you can observe if outside interference gives false readings. If you enter the test routing and the counts remain at zero until you manually break the IR beam no outside interference is being seen. On the other hand, if one or more of the sensors shows random increases sunlight or some other source of interference may be causing a problem. Remember that flash photography can briefly blind the sensors causing erroneous readings.
|New Sensor Design
A revised sensor design places the emitter and detector lower and farther to the side. This design also fits nicely between the ties. In this photo one sensor is shown. The emitter is to the right and the detector to the left.
Here is a pair of sensors after painting.
Each sensor is made of 9 pieces of styrene, one IR led and one IR detector. In this photo two pieces of styrene have been glued together to make a right angle piece.
These sensors are complete except for painting
This view is of the IR led end of the sensors.
Here are the detectors. Note the capacitor on the right detector. It has not yet been added to the left unit.
Once the circuit has been prototyped and tested a pair of custom circuit boards can be made. The layout below is for the main microcontroller board.
This board will accommodate the 8 power transistors that power the incandescent "Christmas Tree"
Schematic 16F873a (28 pin PIC)
|Power Board for Incandescent Lights
|Software - PIC 16F873a
Marlin P. Jones Power Supply
I needed two identical power supplies for
testing the drag strip so I ordered two of these:
from Marlin P. Jones in Florida.
For the price ($14.95 + shipping) they can't be beat!
The terminals to the left connect to 110 volts.
Once connected the screw terminals are "hot" so I thoroughly covered them and
any exposed wire with a large helping of hot melt glue. I also added a
wire strain relief which you can see to the left. The line input from the
110 volt cord (the black wire) goes to the "L" terminal and the neutral (white
wire) goes to the "N" terminal. If you use a grounded plug the ground wire
(green) goes to "FG".
The two "-V" terminals are the negative DC output
while the two "+V" terminals are positive. The voltage can be adjusted
between 20 and 29 volts by turning the small white potentiometer under the "V
ADJ" label. It is glued in place so a bit of effort may be needed to
change its setting.
Ultimately this power supply will be placed into
another enclosure so that there will be no chance of anyone coming into contact
with the AC line input voltage.