The challenge of slot car racing is to accelerate and brake the car just in the right moment. When we want to automate this by a microcontroller, we must know where the car actually is. Magnets which are fixed to the car´s wheels and hall effect switches around the track are therefore a perfect way to identify the position of the car: Whenever the car passes by a hall effect sensor, it sends an impulse to the Arduino.
And this is how the Arduino sketch works: Every time when the slot car passes by a hall effect sensor, an Interrupt routine is being called. There the hall sensor which caused the interrupt is identified and a speed value is read out of an Array. The analogWrite() command gives us a PWM signal which is amplified by a transistor circuit and led to the track. So the speed of the slot cars is being controlled.
The placement of the hall effect switches and speed values in the Arduino sketch determine, how hard it is to win the race! Have fun!
Watch video to learn more about the details and see it in action.
Comments