Toy race car winner detector?

strantor

Joined Oct 3, 2010
6,875
Correct. It's reading or scanning the inputs from 1 to 4. Possible car 1 could cross the line before say car3 depending on which line of code the program was at but it would be within micro seconds.
This is not arduino but as I said I know nothing about picaxe; but if it was arduino, digitalRead() takes about 5μs. At 4 reads per cycle, 20μs plus whatever else, IDK, I'll say 30μs.

I assume this is about pinewood derby cars..
According to this website:
The actual speeds hover around a more modest 10 mph
10mph = 176 in./s
(4470mm/s)
(4.470mm/mS)
(0.00470mm/μS)
×30μs = 0.1341mm
That's nearly 3 whole pubic hairs.

Further according to the same website:

Six tenths of a second. That is all that separates the slowest car from the fastest! (Out of 37 cars)
The chart doesn't have enough resolution to say conclusively what the time difference is between cars but look at for example car #26 vs car #27:

Screenshot_20230820-004152_Chrome.jpg


3 pubes might actually matter.

With arduino there is direct port manipulation where you can read 8 inputs at once in 62.5nS. If picaxe has a similar function then i would suggest using it. Or if it is just blazing fast without the overhead of arduino's padded corners then disregard.
 

sghioto

Joined Dec 31, 2017
8,635
The TS mentioned Hot Wheels cars so don't know the average speed at the finish because of the different types of track. The max speed of the picaxe micro is 32mhz or appx 125us per line of code.
Appx 625us to check all 4 "if" lines. Even at that slow processing speed I don't think it would make any difference. I don't know if the picaxe can monitor all four inputs simultaneously. Although the TS preferred not to use a micro the circuit was put out there as an example of how easy using a micro can be especially with the simple laymans language coding of the picaxe system.
I prefer the 555 circuits because they run simultaneously with faster reaction times.
 

MrChips

Joined Oct 2, 2009
34,905
If two cars cross the finish line within a window of 1μs or 1ms, do you declare it as a tie?

Using independent flip-flops, you can resolve the winner down to 10ns.
 

strantor

Joined Oct 3, 2010
6,875
the TS preferred not to use a micro the circuit was put out there as an example of how easy using a micro can be especially with the simple laymans language coding of the picaxe system.
I prefer the 555 circuits because they run simultaneously with faster reaction times.
If two cars cross the finish line within a window of 1μs or 1ms, do you declare it as a tie?

Using independent flip-flops, you can resolve the winner down to 10ns.
Yeah I think this is a rare case where TS preference of discretes/avoidance of microcontrollers has more merit than "because I am intimated of programming."
 

BobTPH

Joined Jun 5, 2013
11,566
Yeah, hot wheels races must be adjudicated to less than 1usec.

A micro can read 8 bits in a single read.

The way I would implement it, would be to trigger an interrupt in any input, then read them all at once. If more than one bit is set, it’s a tie.
 

AnalogKid

Joined Aug 1, 2013
12,173
In a parallel approach such as post #17, software or hardware scanning-delay errors are removed. RN1 is basically a resistive AND gate - if any input goes low, the output (pin 1) goes low enough to turn on Q1, latching the states of all 8 inputs. C1 slows the response time to allow for switch bounce, and would be removed in your application where you want to catch the first edge of the first change. The theory is that the the odds of two or more cars breaking their sensor beams within 50 nanoseconds or so are very, very low.

I'll get to an improved schematic.

ak
 

djsfantasi

Joined Apr 11, 2010
9,237
The only downside I can see for me is the programming- something I am not used to at all. I will have to learn a whole new skill...
BTW, my Instructable includes all the code you need. Download directly from the Instructable. No or very little coding at all. If you need to add another lane, I can modify the code for you.
 
Top