Race track application

alwyn

New Member
Hi all - this is my first post

I'm trying to create an information screen for a 2 car race track.
From searching the forum I see that others have attempted this in the past

Below is a list of my initial ideas:-
  • 2 lane scalextric race track - ie 2 cars racing
  • AXE033 Serial LCD screen to display sector and lap times
  • 3 sector sensors per track - 6 magnetic reed switches under the track
  • PICAXE 28x2 plus 16MHz crystal for accurate timing - I already have these from a previous project!
  • Start button to initialise the system
  • Red, Amber & Green LEDs to start the race
  • Start the PIC timer when green led lights up
  • Get and display elapsed times on the screen when the car mangets pass over the sector reed switches
  • Display the lap time on the screen when the cars pass over the start line again

I'm fairly confident with getting the hardware and basic software up at running
The bit I'm struggling with is the timer function in the PICAXE
I want to start the timer when the Green LED turns on
I then want to get values from the timer and display them on the LCD screen as the cars go over the reed switches and turn the picaxe inputs high

Any info on how to do this would be great - assuming its all possible with one timer in the PICAXE

This is an image of the race track layout:-
track.JPG

This is my circuit diagram:-
circuit.JPG
 

JimPerry

Senior Member
I'd strongly suggest using an OLED display (AXE133Y or even AXE134Y) much easier to see/read :confused:

Oh - and welcome to the forum :)
 

techElder

Well-known member
Are these the typical "slot" cars? Are these really slow cars? Is it a really long track? What kind of lap times are you expecting? Will updating the display for every lap mean anything?

Will you use some math and keep up with averages and such?
 

alwyn

New Member
Thanks Jim

The only reason I'm using the AXE033 is because I already have one from another project.
However, I will have a look at the OLED one - thanks for the suggestion.
 

alwyn

New Member
Hi Tex

Yes these are typical off the shelf slot cars.

Initially it will be a a fairly small (3 meters max) track - so typical lap times of 5 -10 seconds!

However I hope to make the track much bigger (10m) once I get hopefully get it working

You are right about updating the display - I will only update the sector and lap times if they are faster!

I'm hoping to keep the math to a minimum - especially if I can access the count directly from the timer when a sensor pin is pulled high.
This is the bit I'm not really sure about - how to setup and read the timer
There will be some math to calculate the average speed and acceleration
 

AllyCat

Senior Member
Hi,

Why not take the reed switches to ground and use pullup resistors? Then you can use the internal "Weak Pullup Resistors" (PULLUP command) and don't even need the SIL package.

The only disadvantage (apart from forum members complaining that you've "forgotten" the pullups ;) ) is that the "Active Low" concept might be difficult for novices. But your LEDs, the Start Button and the Reset are all Active Low already!

Cheers, Alan.
 

alwyn

New Member
Hi Alan

Thanks for the advice on using the weak internal pull-ups - makes sense and saves on a component.
The only reason I did it the other way is because its easier to see active high signals in the simulation panel of logicator.

To be honest, I'm ok with the hardware side of things - its understanding how the timer works thats the issue.
There seems to be very little info on the "time" variable and how to enable or disable time incrementing

Thanks
Alwyn
 

AllyCat

Senior Member
Hi,

It's important to appreciate the difference between the "time" variable in M2 devices and the "Timer" in X2 devices. I don't use X2s (nor Logicator) for my projects, but I think that basically "time" is a software function (one second ticks), but "Timer" needs a greater understanding of the chip hardware.

Most of the required information appears to be in the SETTIMER command in Manual 2. However, the numbers which need to be used are not particularly "convenient" because the timer counts up to a "rollover" after a count of 65,535. Also, the timing period depends whether the clock is internal or external (and its frequency) and further complicated because there is a binary "prescaler" division stage by 256 or 65,536.

Cheers, Alan.
 

Greyling

New Member
I am no expert in these things but you might want to consider using a something like an 08M2 just to "monitor" the reed switches and have it send a signal out so the 28X2 does not have to poll the switches. It might help with timing and updating the display faster.
 

techElder

Well-known member
:D Here we go with mission creep! :D

It's a 28X2. This simple app doesn't need more than that. Run it hard and fast. It can easily keep up.

Arrange your lane switches so you know when they are open (as in somebody pulled the wires again).

That means normally closed (NC) or active high.

A reed switch can be really slow at the speed those little cars travel.
 
Top