Shop OBEX P1 Docs P2 Docs Learn Events
slotcar lap timer — Parallax Forums

slotcar lap timer

CrosswindsCrosswinds Posts: 182
edited 2010-01-08 19:25 in Propeller 1
Hello!


Im going to make my own simple laptimer for a slot car racetrack!

It will be using photocell sensors, and just a simple 4line text LCD display to display, best laptime, and current, and also lapcount.

Nothing real advance [noparse]:)[/noparse]

But my question is what i should use to keep track of the time, should i use the RTC DS1302 time keeping chip?

I want it to be able to show hundreds, can the ds1302 keep up with that, or would it be possible for the propeller itself to calculate the times accurly?

It will be 4 lanes / times to keep track of!


Any ideas?

Comments

  • DynamoBenDynamoBen Posts: 366
    edited 2010-01-03 19:04
    The DS1302 only goes down to seconds, personally I would just use the on board timer/counter that should be accurate enough for what you are doing.

    Further consider placing each lanes time keeping in its own cog. Since all the cogs reference the same clock source they won't fall out of sync. Doing this then gives you 3 cogs to add an LCD or anything else (maybe tv or vga out) that you like. Overall this seems like a fairly straight forward project codewise.

    Post Edited (DynamoBen) : 1/3/2010 7:16:06 PM GMT
  • StefanL38StefanL38 Posts: 2,292
    edited 2010-01-03 19:11
    Hello Crosswinds,

    The DS1302-chip has only seconds.

    The propeller himself can do that.
    If you use a chrystal to generate the clocksignal it is pretty accurate for shorter timelengths. (Minutes to hour)

    If it is enough to compare the times between the 4 lanes and it doesn't matters if the measured times derivate 0,2 seconds from the real time.
    What type of sensor do you mean by the term photocell?
    Photosensitive resistors have a long reaction time. I guess longer than 0,01 seconds.

    If you setup one cog per lane it should be doable

    best regards

    Stefan
  • CrosswindsCrosswinds Posts: 182
    edited 2010-01-03 19:34
    Hello!

    Thank you very much for the information!

    So that if i use an external chrystal to run the prop against, it would be accurate enough? that sounds great, actually i didnt think it would be very accurate!

    And for the photocell/sensors, im not really sure what to use.

    It seems maybe best to have a IR-setup,

    with the: http://www.parallax.com/Store/Components/Optoelectronics/tabid/152/CategoryID/50/List/0/Level/a/ProductID/179/Default.aspx?SortField=ProductName,ProductName
    in each lane, and a bridge over the track with IR-LED´s that is directly angled at the recievers in the track.

    I think this would be best, since the car will cover it directly, but i dont yet know the responsetime on the infrared phototransistor.

    But do you think that that setup should work?
  • DynamoBenDynamoBen Posts: 366
    edited 2010-01-03 19:39
    I think this is all very doable, and should work fine.
  • CrosswindsCrosswinds Posts: 182
    edited 2010-01-03 19:43
    Yes, i think it would be a fun project to do for my raceway build [noparse]:)[/noparse] Its boring to use some out of the box solution! [noparse]:)[/noparse]


    Just need to read more about the sensors, to see what will be best. after som initial reading it seems like a regular photoresistor is very sensitive to a IR-LED and should work real nice.

    just worrying of the reaction time..
  • kwinnkwinn Posts: 8,697
    edited 2010-01-03 21:11
    Crosswinds, a phototransistor has a response time of less than 50 microseconds so it is fine.

    The prop crystal is accurate to about 40ppm so it will also be fine for timekeeping.

    A phototransistor in the track looking up at the room lights works well in most cases, but if you are really fussy you could have them mounted above the track with IR leds in the track.
  • JonnyMacJonnyMac Posts: 9,208
    edited 2010-01-03 21:31
    Since you don't need time between power-ups you can use a software RTC -- I wrote an object that you can use that will give you time down to milliseconds:

    * obex.parallax.com/objects/532/

    Since this runs in its own cog you could run one per lane.
  • CrosswindsCrosswinds Posts: 182
    edited 2010-01-08 19:07
    Jonny Mac! Thank you for that object!


    Just want to check with you guys how you would approach this..

    Ive solved the sensor, so there is no problem there. My question is how to really measure the time in practice.


    Is this an idea:

    Take a snapshot of the current time when i start the lap, and when the car passes the sensor again, take the current time again, and then compare the time difference?
  • JonnyMacJonnyMac Posts: 9,208
    edited 2010-01-08 19:25
    Depending on your sensor scanning resolution you may want to...

    a) grab current time
    b) scan track sensors
    c) any active?
    -- if yes, xor with last scan to isolate new activity (assuming you can scan more than once per car length)
    -- assign end time to new tracks
    -- save scan result for use with next
    d) back to (a) until all tracks done
Sign In or Register to comment.