Every once in a while I cherish the idea of building a routed track and buy a few slot cars to play with, and so I browse some websites and forums on the subject, looking for examples, construction techniques and wiring schemes.
One of the aspects that increases the fun is a lap counter/timing system which also allows to play alone "against the clock". Other than commercial ready to use systems, there are a lot of DIY solutions from software running on a PC to standalone devices built using an arduino or other microcontroller. After looking at some of these examples, I thought that the Atari 2600 would serve the purpose just fine: it has several I/O pins available on the controller ports to read the sensors and also, for example, controlling a starting light and a relay to automatically power on/off to the track, and a video output to display the data. Moreover, in my scrap-parts bin, I had an old 5" B&W CRT surveillance monitor with some burn-in and geometry issues, but otherwise working and that would be ok for just displaying some numeric values, and a board from a 6-switch 2600 which only display in B&W (That's actually the console I mentioned in my very first post here, many years ago...)
So after a few weeks, I came up with this:
The thing is entirely made out of recycled parts (even switches, leds and connectors were scavenged from old electronics), because I'm cheap I care about the environment.
I also mounted a practical handle for transportation.😄
The monitor has a few dents and scratches, which gives it a worn look. I like it this way.
The software manages tracks with up to 4 lanes, displays lap times and gaps with 0.01s resolution and it's extremely simple to use as there's no configuration and the only option is to set the time and number of laps for race duration.
The display shows rather simple graphics (sufficient for this application), the digits are flicker free and easy to read (at least with up to 3 lanes. With 4 lanes, the resulting 13 rows of text are quite a bit compressed vertically), and there are enough cycles free to check the inputs often enough (5 scanlines is the maximum time between two consecutive polls of the sensors. That is, if I counted cycles correctly).
Among the features there's the ability to control an external starting light and/or a relay for power and the transmission of the lap times to a PC through a serial connection.
Here are some pictures of the inside.
To free some room, I removed the power supply section of the monitor, so now it's powered by an external regulated 12V power supply rather than directly by the 220v mains. I had to shorten the Atari board to make it fit inside the metal case, mounted vertically on one side of the tube, and then restore some of the tracks that were cut with jumpers. I also removed all the components which were not needed, like those for the color generation circuit, including the extra PAL oscillator, and also had to relocate some components (the quartz crystal interfered with the CRT tube). I used a bare cartridge board to mount the eprom with the custom program and modified the cart connector so that it ends being parallel to the main board.
Still, I need to loosen and rotate the yoke around the CRT neck, if I want to unplug the board (I had to do that a couple of times to reprogram the eprom because of late bug-fixes)
Finally I wired the connectors and switches I needed to the corresponding RIOT and TIA I/O pins. I used a single 9 pin male socket for connection to the track. There are 4 (RIOT) pins used as inputs from the sensors, 1 (TIA) input to select polarity of the pulses, and 2 (RIOT) pins as outputs to drive a starting light and/or a relay. The female 9 pin connector is RS232 serial port to optionally transmit data to a PC. The port includes a TTL to RS232 kevel converter circuit built using discrete (recycled of course) components. I also added a small audio driver for a speaker, with volume pot and on/off switch (a bit overkill, as the sounds only consist in a few beeps...). Finally there are 3 push buttons to control the software: two on the front for the main functions (wired like the SELECT and RESET switches on a full console, but with inverted logic, because the switches I used are normally closed) and a smaller one, mounted on the rear panel wired to the pin normally used for the right difficulty switch, which is rarely needed (it's used to abort a race, to skip the starting procedure, or to reboot the software).
I still had the old plastic 1/43 scale track from when I was a kid in the attic, and used that to test the thing.
I decided to go with optical sensors, consisting in IR emitters mounted on a "bridge" positioned over the track (which also holds the starting lights) and photodiodes mounted under the surface.
Again I used scrap parts: a small piece of aluminum square tube, and some sheet plastic cut and glued together.
The IR emitters are from a couple of old remotes, while the photodiodes are scavenged from "dusk to dawn" sensor light bulbs.
here a few pictures.
You can see the two sensors mounted on the base, the track section where the bridge is positioned has two corresponding holes drilled.
Here are the IR emitters, on the bottom of the bridge
In this video you can see a short 5 laps race test (I found impossible to control both cars at the same time, so I just run them at reduced speed to shot the video). The laptop on the left is connected through the serial port (actually an usb to serial adapter), and you can see the lap times displayed in the terminal window on each pass. The system seems to work reliably, with no missed laps in my tests.
I also made a version of the software that works on a standard console, so that I could quickly test it in Stella and on real hardware with an Harmony cart.
Apart for the slightly difference in managing the console switches, this version is in color (😄), and can optionally display a (blocky!) starting light on screen.
Here are the roms (for different TV systems), in the unlikely case someone wants to give it a try (You can simulate the car passing over the sensors by connecting a joystick to the right controller port. the 4 lanes correspond to UP,DOWN,LEFT and RIGHT directions).
Here's the manual (in Italian or Poor English...).
P.S. if you can't find an opponent to race against, a TI 99/4A computer can act as a substitute!