Shop OBEX P1 Docs P2 Docs Learn Events
A request for a Pinewood Derby Timer — Parallax Forums

A request for a Pinewood Derby Timer

Eric AdamsEric Adams Posts: 11
edited 2004-09-15 15:46 in General Discussion
Grandkids are fantastic but somehow they always think Pop Pop's can do anything.· The latest request is from a Cub Scout Pack my grandson belongs to.· They need a electronic timer for a 4 lane Pinewood derby track so that the kids and the audience will know who finished in what position and what their overall time was.· Since Pop Pop is a· computer person (BS2P) he can do it they said.··So I became the official builder of the track timer,· without even·a word froom me.·· So my problem is figuring out now how to use one of my favorite playtoys the Parallax Stamp which has no internal timer and monitor·4 lanes and display the results on a 4 digit led which will show the position of finishing.· That will be a·number from ·1-4 on the LED that will light up depending on that lanes finish.

Before I go further into wasting my time trying to accomplish this on the Stamp I would like to get the opinions of my fellow stampers if this can be accomplished.· I have belonged to this group for years and some of the·ideas that surface here are just brilliant.· Am I heading down the wrong path trying to use my playtoy to accomplish this?·· Thanks for the help.

Comments

  • KenMKenM Posts: 657
    edited 2004-09-04 00:48
    If I were going to attempt to monitor the time of four different lanes, the majority of the project would be with external counters and an external free running clock with the counters and free running clock controled by the stamp.

    Four counters would be cleared before the start of the race (manual button).

    The free running clock would go to the clock input of each counter via an AND gate. The second input to each of the four AND gates would go HIGH (stamp controled) when the race is started. I assume the start is done via a mechanical means, of which could be electrically coupled to a stamp input.

    When the car crosses the finish line, an optical sensor (photo receiver mounted below a hole at the finish line.....or a sensitive tape switch) monitored by the stamp would make the corresponding and gate for that lane low, thereby stopping any more pulses from getting to the counter.

    Once the finish line has been crossed by all four cars, the stamp could get the number of pulses from each lane (fastest time) via a parallel to serial shift register (assuming the counters are a parallel output.

    I am sure more (probably better) ideas will come in......this is just my quick and dirty method without putting a lot of thought into it.

    And the very expensive solution is to use 4 stamps, one for each lane.
    Eric Adams said...

    Grandkids are fantastic but somehow they always think Pop Pop's can do anything.· The latest request is from a Cub Scout Pack my grandson belongs to.· They need a electronic timer for a 4 lane Pinewood derby track so that the kids and the audience will know who finished in what position and what their overall time was.· Since Pop Pop is a· computer person (BS2P) he can do it they said.··So I became the official builder of the track timer,· without even·a word froom me.·· So my problem is figuring out now how to use one of my favorite playtoys the Parallax Stamp which has no internal timer and monitor·4 lanes and display the results on a 4 digit led which will show the position of finishing.· That will be a·number from ·1-4 on the LED that will light up depending on that lanes finish.

    Before I go further into wasting my time trying to accomplish this on the Stamp I would like to get the opinions of my fellow stampers if this can be accomplished.· I have belonged to this group for years and some of the·ideas that surface here are just brilliant.· Am I heading down the wrong path trying to use my playtoy to accomplish this?·· Thanks for the help.


  • KenMKenM Posts: 657
    edited 2004-09-04 00:53
    Also,

    If you google Pinewood derby timer, there are a plethora of circuits or prebuilt timers.
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-09-04 13:24
    You could do it with the BS2p. Use an DS1307 or similar RTC to handle the timing for you. At the start you clear all registers and as each car crosses the line you grab the 100ths and seconds registers. Assuming that a race is not going to be more that 256 seconds, you could multiply the secs by 100 then add the the 100ths register to get the track time in 100ths for comparison with the other tracks.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • Tracy AllenTracy Allen Posts: 6,656
    edited 2004-09-06 02:15
    My first cut would be to write the main timing loop as a state machine, relying only on the resonator in the BS2p for the timing, not on any external clock or timer hardware.

    ' set all counters to zero (not shown)
    SA = %1111   ' bit will go to zero one by one as cars finish, one bit per lane
    S0 = INA   ' initial read of the finish switches
    DO:LOOP UNTIL gun  ' loop here until starting gun
    DO
      S1 = INA   ' read all stop switches at this point in time
      SX = S1 ^ S0 & S0   ' detect event where car crosses finish (1-->0) transisiton assumed)
      S0=S1   ' update state
      SA = SA & ~SX    ' finish accumulator, b=1 means not finished, bit=0 means finished
      X0 = X0  + SA.bit0    ' time for 1st lane;  increments only for cars that have not finished
      X1 = X1  + SA.bit1    ' 2nd lane ditto
      X2 = X2  + SA.bit2    ' 3rd lane ditto
      X3 = X3  + SA.bit3    ' 4th lane ditto
    LOOP UNTIL SA=0  ' until all have finished
        ' may also need a means to exit in case one does not finish.
        '  show results.... etc.
    



    A loop like that will run around and around in with a few milliseconds resolution on the BS2p. Multiplication (**) by a constant after the finish will convert the times X0..X3 into real time. All of the switches are sampled at the same instant, so it is fair, and there is a possibillity of a tie, which adds to the excitment.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • KenMKenM Posts: 657
    edited 2004-09-08 02:00
    Tracy,

    I have a question relating to your timing idea. I think your code works as follows....please confirm.

    The code will not return an actual time for the race (at first glance), but rather the order of finishers.

    Each time through the loop, each lane (Xn) is incremented until the car crosses the·finish line·(bit = 0). Subsequent passes through the loop while other cars have not finished, the·car(s) that already finished, thier·"counter" is not incremented.

    If one wanted to convert the "finished count" to a time, you could add a pin going high at the start of the loop then low at the end of the loop and use an o-scope to determine the time for a loop, or, use your documented timings for instructions to calculate how long the loop should take?

    Thanks,

    Ken
    Tracy Allen said...
    My first cut would be to write the main timing loop as a state machine, relying only on the resonator in the BS2p for the timing, not on any external clock or timer hardware.

    ' set all counters to zero (not shown)
    SA = %1111   ' bit will go to zero one by one as cars finish, one bit per lane
    S0 = INA   ' initial read of the finish switches
    DO:LOOP UNTIL gun  ' loop here until starting gun
    DO
      S1 = INA   ' read all stop switches at this point in time
      SX = S1 ^ S0 & S0   ' detect event where car crosses finish (1-->0) transisiton assumed)
      S0=S1   ' update state
      SA = SA & ~SX    ' finish accumulator, b=1 means not finished, bit=0 means finished
      X0 = X0  + SA.bit0    ' time for 1st lane;  increments only for cars that have not finished
      X1 = X1  + SA.bit1    ' 2nd lane ditto
      X2 = X2  + SA.bit2    ' 3rd lane ditto
      X3 = X3  + SA.bit3    ' 4th lane ditto
    LOOP UNTIL SA=0  ' until all have finished
        ' may also need a means to exit in case one does not finish.
        '  show results.... etc.
    



    A loop like that will run around and around in with a few milliseconds resolution on the BS2p. Multiplication (**) by a constant after the finish will convert the times X0..X3 into real time. All of the switches are sampled at the same instant, so it is fair, and there is a possibillity of a tie, which adds to the excitment.

  • DntGvaShtDntGvaSht Posts: 65
    edited 2004-09-08 03:47
    2 cents:
    You could use an actual PC for keeping and displaying times, since they do that pretty well, receiving signals from the stamp when events occur.

    You could use a little of Tracy's code for monitoring all 4 lanes simultaniously, and DEBUG when pinstate changes.· The software you write on the PC could handle starting and stopping times, as well as display the positions of the winners, along with race times and the time difference between 1st 2nd 3rd 4th places (preferrably in large easy to read fonts)

    ...and on a side note:· if you were to have a spring-loaded·wall·retained by a solonoid, you could hit a button on the computer, send the stamp a message, the stamp activates a relay which energizes the solonoid (maybe sounding a starter or other noise-maker also),·dropping the wall and starting the race, simultaniously starting the clocks.

    Just a few ideas [noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "OIOOIOOO OIIOOIOI OIIOIIOO OIIOIIOO OIIOIIII OOIOOOOO OIIIOIII OIIOIIII OIIIOOIO OIIOIIOO OIIOOIOO OOIOOOOI"
    schat.jpghttp://68.11.58.106:69/ircchat2/jicra-1.2.2/index-js.html

  • Tracy AllenTracy Allen Posts: 6,656
    edited 2004-09-08 15:24
    Ken, You have it exactly right on how the counters increment. The main DO:LOOP takes the same amount of time no matter how many cars have finished. So it captures both the order of finishing and the time in the form of the counts. Once all have finished, the counts need only be multiplied by a constant to convert them into real time milliseconds. It should be the same constant for all the tracks. To do that, run a pinewood derby with a stopwatch on the side. Use the time from the stopwatch (averaged over several runs!) to determine the multiplier to enter in the Stamp program. The stopwatch could be a real one, or an oscilloscope (not too accurate though), or a timer chip like the one from Peter Anderson or from Steve Parkis.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • AllanL5AllanL5 Posts: 12
    edited 2004-09-15 15:46
    For most of the competitions I have seen, simply knowing the finish order is sufficient.· This simplifies the project, since you don't need a connection to the starting gate in that case, nor do you need a real-time clock to tell what the actual duration of the race was.

    The best approach is to use photo-transistors put in to the track, with LED's in a finish gate structure above the track shining light into the photo-transistors.· Use the BS2 to read all 4 bits at the same time.· I don't know if you'll need any de-bounce here -- I would suspect not.

    You can use LED's above the finish gate to indicate order of finish.· You can blink them in patterns to indicate the order -- constant on is the winner, blink twice and pause for second, blink three times and pause for third, leave off for fourth.· Or, since you're using a BS2 anyway, you might try to put in 7-segment LED's, and indicate 1, 2, 3, and 4.

    Note this kind of thing is available from www.microwizard.com for $150 to $200 depending on options.
Sign In or Register to comment.