Jump to content
43oh

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

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...