SlotForum banner
1 - 9 of 9 Posts

· Registered
Joined
·
14 Posts
Discussion Starter · #1 · (Edited)
Hi folks, I bought a slot car set for my nephew this Christmas and then realized it didn't have a lap counter so I thought I would just build one with an Arduino. I did some searching and didn't find anything really workable so I ended up designing one from scratch.
Light Circuit component Technology Engineering Electricity

I finished the project and it works great so I thought I would share the design as I came across a few others kind of looking for the same thing I was, and not being too successful. It's pretty inexpensive, considering what store bought controllers go for.
The controller supports up to 4 lanes, has a pause and restart feature, individual lap timer displays for each racer, live leader board (though really small), and final results lists. Timing precision is to the ms, and even though it's only one microcontroller it can detect simultaneous lap crossings of any or all racers so should never miss a lap.

The parts list (other than wires)
Arduino Nano - $7
4 x 20 LCD display - $8.00 - $10
4, 8-digit 7-segment LED bars - $8-$12 for all 4
4x4 membrane keypad - $1.5
Passive Buzzer (or mini speaker for a toy) - grab an old toy's speaker or buzzer or buy 12 for $5
1 resistor 10kOhm

I wrote up the whole project for the Arduino Project Hub and I've loaded the software with details about the implementation on GitHub. Those posts have a ton of details regarding how everything works under the hood, but if you have the parts above, you can download the completed, ready to use code, upload it to the Arduino, and wire up the parts without needing to worry about all those details.
Arduino Race Timer, Lap Counter, and Controller on Hackster
Race Timer and Controller code on GitHub

A demonstration video of the program interface and usage can be found on YouTube.

I don't think my nephew really gave a poop about the slot car set, but it was a fun challenge to build the race controller and maybe someone out there will find some use for the effort.
 

· Registered
Joined
·
2,902 Posts
Wow! Really good project. It's a joy to read a project so well and comprehensively presented on the Arduino project hub. It looks relatively easy to put together even if you aren't particularly Arduino savvy. Looking forward to building this.

Many thanks for taking the time to write it up and sharing (y)
 

· Registered
Joined
·
14 Posts
Discussion Starter · #3 ·
Wow! Really good project. It's a joy to read a project so well and comprehensively presented on the Arduino project hub. It looks relatively easy to put together even if you aren't particularly Arduino savvy.
Thanks, I appreciate the comment. I have been frustrated by many "how-to" articles on the internet, especially software and electronics projects, that assume certain key background knowledge, or a similar thought process to the author, failing to explain important steps in the logical progression of the solution. So I tried to be conscious of writing something that can hopefully be digestible by most anyone willing to put in the time to read it.
 

· Registered
Joined
·
421 Posts
That is a very thorough write up! Thank you for putting this together. I did a very similar project a few years ago, and got it working but man it was painful. I would add a word of caution that the approach shown will work with mechanical detection of the cars (with paper clips as you have done, or some sort of limit switch with a contact arm). I started off using dead strips as inputs to the Arduino with interrupts and had nothing but problems. The signal is so noisy that the amount of time you are making "contact" is highly variable. The amount of time you can count on ends up being very short, which then makes your lap trigger signal difficult to distinguish from noise. Or, if you make long deadstrips you risk the cars coming to a stop. I also found that the Arduino inputs were highly susceptible to EMI (which direct contact with the motors was generating a ton of). I tried many different combinations of passive filtering arrangements but nothing satisfactory presented itself. I had multiple cars I was using as test cars, and I could never get all of them to "work" with the system at the same time (with a single filtering arrangement). Knowing what I know now, I think I could go back and make it all work, but I've never taken the time to try it.

If you go to some sort of infrared lane detector (which is what I did when I gave up on the dead strips), there is one more "gotcha" buried in the Arduino hardware. There is a capacitance in the A to D converter that must be dealt with between reads of the lanes. This is only an issue if all of the circuits the analog inputs are reading are high impedance (which is the case here). I ended up wiring one of the Analog pins to ground and forcing a read of that ground between lane reads. If you don't do something to discharge that capacitor, you will trigger false reads on the other lanes whenever any lane triggers. If you are using interrupts as shown in your example, I think it is sufficient to simply have one of the pins read grounded, you don't have to "force" a read.
 

· Registered
Joined
·
14 Posts
Discussion Starter · #5 ·
I started off using dead strips as inputs to the Arduino with interrupts and had nothing but problems. The signal is so noisy that the amount of time you are making "contact" is highly variable. The amount of time you can count on ends up being very short, which then makes your lap trigger signal difficult to distinguish from noise.
Great feedback. I started with, and have only tried mechanical contact switches. Using leaf contacts or spring wire contact, like the paperclip, seemed the most robust and are easy to customize by bending them to suit the particular track setup and needed contact duration. I had come across this article on using dead strips that some might find helpful if they attempt that with this controller. The last 2 pages have 2 filtering circuit options for using a dead strip with an Arduino. Maybe you tried these, I have not.
Dead Strips 11.pdf
I don't have any experience with dead strips, but it looks like if the car bridges the gap between the live track and the dead strip part, in addition to the voltage induced into the switch circuit fooling with the signal level, it may also be creating a ground loop or mismatch in the ground references, if the track ground is not directly connected to the Arduino ground. This would likely cause a host of intermittent, hard to pin down signal errors. If it's ensured that the track and dead strip circuits never mix, something else the article mentioned as a source of issues is the motor polarity.

It would be great to have folks share different working Arduino sensor options here if they come across this thread and have working solutions.
 

· Registered
Joined
·
421 Posts
Oh yes, I've seen that document. I tried everything except the optocoupler.

There is a big difference in what you can get away with between a software strategy that uses the interrupts and one that runs as poling loop of analog reads. The interrupt is extraordinarily sensitive, so your filtering has to be beyond rock solid in order to avoid false counts. Fun fact, you can count laps for one car just by putting the Arduino physically next to a dead strip. You dont even have to hook up the wires!

One intermediate solution I came up with just ran a loop of analog reads for each lane. This worked fine, but in theory you could have a collision between a lap count and a write to the lcd. The solution I came up with for that was to only write to the display when all cars were inside the minimum lap time.

The loop of analog reads is much more robust against noise as the micro is only responding to the pin during the read event.

Kudos to you for getting the interrupt based solution working.
 

· Registered
Joined
·
14 Posts
Discussion Starter · #7 ·
Good to know. I went for the easiest switch I could implement without being destructive to my my track, in case things didn't pan out. I feel like I cheated a bit using a pre-made, actual lap counter. This puts my contacts pretty far away from the car, relatively speaking which is, I'm sure helping. But it's not something anyone can do with any set, or with 4 lanes. To really be a complete low budget solution, I'd like to have worked out a simple switch that anyone can make themselves with stuff around the house. That can be modded into any lane, with some mild track mods that won't interfere with using other equipment in the future.
One reason I steered away from poling initially was because I had the impression it was going to always give an advantage to the first racer poled or would miss a lap regularly because it had too much other stuff to do. Though that still holds true if the code isn't well thought out, I think in reality, well written poling would operate effectively the same as the interrupts. Slightly different overlaps in timing, and corner cases, but overall the same "fairness". The interrupt period, though checking all lanes simultaneous, is not operating instantly so there's a block of time that has to be considered the same constant value. Any additional racers crossing during that period would all be considered the same time when read on the following interrupt. A poling loop would probably run just as fast while checking lanes and the whole loop could be considered a constant time. Your solution sounds like a good one if someone has trouble with the interrupts.
 

· Registered
Joined
·
14 Posts
Discussion Starter · #8 ·
I updated the project write up to include some single pin sensing options and example uses, that I've copied below.
Sensor Options
Here is a brief list of potential switch options that can work with this project.
Mechanical Switches - any button like, mechanical mechanism that closes the circuit can be used. See the project lap counter example implementation.
Magnetic Detection Switches
Proximity Sensing
  • IR proximity sensing - Several types of infrared proximity sensing ICs and integrated boards exist that can be used to provide a single pin response. This link is an example of Arduino integration of IR proximity sensor, and here is an example of a Sharp GP2Y0D805Z0F implemented into a slot car track.
  • Ultrasonic Proximity - These generally require additional pins to be driven so unless an intermediate circuit is used to manage the sensor and returns only the output to the race controller, this is not a direct solution.
 

· Registered
Joined
·
7 Posts
Hi folks, I bought a slot car set for my nephew this Christmas and then realized it didn't have a lap counter so I thought I would just build one with an Arduino. I did some searching and didn't find anything really workable so I ended up designing one from scratch.
View attachment 295160
I finished the project and it works great so I thought I would share the design as I came across a few others kind of looking for the same thing I was, and not being too successful. It's pretty inexpensive, considering what store bought controllers go for.
The controller supports up to 4 lanes, has a pause and restart feature, individual lap timer displays for each racer, live leader board (though really small), and final results lists. Timing precision is to the ms, and even though it's only one microcontroller it can detect simultaneous lap crossings of any or all racers so should never miss a lap.

The parts list (other than wires)
Arduino Nano - $7
4 x 20 LCD display - $8.00 - $10
4, 8-digit 7-segment LED bars - $8-$12 for all 4
4x4 membrane keypad - $1.5
Passive Buzzer (or mini speaker for a toy) - grab an old toy's speaker or buzzer or buy 12 for $5
1 resistor 10kOhm

I wrote up the whole project for the Arduino Project Hub and I've loaded the software with details about the implementation on GitHub. Those posts have a ton of details regarding how everything works under the hood, but if you have the parts above, you can download the completed, ready to use code, upload it to the Arduino, and wire up the parts without needing to worry about all those details.
Arduino Race Timer, Lap Counter, and Controller on Arduino Project Hub
Race Timer and Controller code on GitHub

A demonstration video of the program interface and usage can be found on YouTube.

I don't think my nephew really gave a poop about the slot car set, but it was a fun challenge to build the race controller and maybe someone out there will find some use for the effort.
Thank you for this! I've been wondering if an Arduino could be used for this (I received an Arduino starter kit as a gift). I'm repairing a 3-lane track that will need a new lap counting system. I've bookmarked your GitHub URL to revisit when ready. I'd toyed with using small 5X7 dot matrix LED displays to create an 'score board' as part of the on-track, in-scale scenery (plus a seperate display for lap times).
 
1 - 9 of 9 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top