Jump to content
Sign in to follow this  
morry

Carrera Slot Car Timer using Stellaris Launchpad

Recommended Posts

Hey guys,

 

this was my very first project on the awesome TI Stellaris Launchpad.

I don't know if these Carrera Slot Cars are famous all over the world, but in Germany this was a Must-Have for every kids toy collection. :-)

Carrerabahn_124.jpg

(Picture from Wikipedia, looping is missing ;-) ).

 

You set two cars on the track and control their speed with a small controller.

The fastest car wins the race but main goal is actually to stay on track.  ;)

 

1. The Mission

I wanted to have a display, that shows me the current time for each track and the best driven time for each track.

 

2. How to detect the cars?

After some considerations about light switches etc. I realized that the cars are hold on track by a small magnet in the back of each car. Perfect for use with Reed-Contacts.

In the picture you can see the mechanical lap counter and the adaptor board to the Stellaris launchpad. The Reed contacts are mounted from the bottom side next to each track.

2013-03-09%2022.26.31%20%28Small%29.jpg

 

3. Display

There might be good LCD-libraries even for Cortex M4, but for better learning I decided to write my own routines for the display.

It's a 4 Line LCD with a KS0066 controller (HD44780 compatible) in "good old" 4Bit mode.

Here's the display with the launchpad adaptor board (and poti for contrast control):

2013-03-09%2022.33.43%20%28Small%29.jpg

 

4. The code

Basically there are two timers set to 1ms intervall, one for each track.

The reed contacts trigger a GPIO-interrupt, which starts the timers.

A third timer sets a displayrefresh-flag, which is polled in the main loop.

 

Here is the code as CCS-Project: https://dl.dropbox.com/u/773191/TI/carrera/carrera.zip

 

5. LCD-Library

If you want to use a KS0066 or HD44780-Display, here are my LCD.c and LCD.h for it:

https://dl.dropbox.com/u/773191/TI/carrera/LCD.c

https://dl.dropbox.com/u/773191/TI/carrera/LCD.h

Works also for displays with 1 or 2 lines of course.

2013-03-09%2022.47.14%20%28Small%29.jpg

 

6. Some more pictures

"The Sandwich":

2013-03-09%2022.48.12%20%28Small%29.jpg

 

Complete setup:

2013-03-09%2022.48.20%20%28Small%29.jpg

 

 

Greets

Moritz

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×