Shop OBEX P1 Docs P2 Docs Learn Events
Pinewood Derby/Raingutter Regatta timer? — Parallax Forums

Pinewood Derby/Raingutter Regatta timer?

ArchiverArchiver Posts: 46,084
edited 2003-11-17 23:17 in General Discussion
Ok,

like some of you may also be, I'm a dad with a 7yr old in cub scouts. I
recently got picked to create the Raingutter Regatta (that'll teach *me*
to show up to meetings on time! [noparse]:)[/noparse] which is like a pinewood derby except
with two raingutters and the boats are powered by the kids using their
lungs to blow the boat down the track.

Anyway, I's like to use a Basic Stamp to make a "winner" detector that
would take the "judges" out of the picture so no one can complain of
favoritism. [noparse]:)[/noparse] So, before I go about re-inventing the wheel, does anyone
have a bit of code or schematic for something like this?

FWIW: I'm planning on using two laser pointers as my "beam" source, a
couple of CDS or phototransister as receivers and a servo holding a
checkered flag at 90 degrees that will drop to 0 degrees or 180 degrees
to announce the winner. All I need is some code to tell me which sensor
is activated first. I have a BSI, a BSII and a BSIIsx that I could use
depending on need.

At first I though about polling inputs in a tight loop, but that would
allow the possibility of one input being detected as first when the other
one was actually first (depending on the loop position). Anyway, if
anyone has already done this and is willing to share the code, I'd be
much obliged! [noparse]:)[/noparse]

Vern

--
Vern Graner CNE/CNA/SSE | "If the network is down, then you're
Senior Systems Engineer | obviously incompetent so why are we
Texas Information Services | paying you? Of course, if the network
http://www.txis.com | is up, then we obviously don't need
Austin Office 512 328-8947 | you, so why are we paying you?" VLG

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-10-09 23:37
    Hi Vern,

    This is a very interesting and intriging question. But it is also a bit
    hypothical.

    I'll give you my thoughts from the 'waterland' Holland:

    Think of the BS2sx running at about 10.000 instructions per second, so the
    respons time of your time measurement system will probably be below 1 ms
    with a tight loop.

    Let us say that e small boat powerd by human breath will move at a speed of
    10 centimeters per second. In a millisecond the boat will move 10 cm/1000 =
    0.1 mm.

    What is the diameter of the beam your laserpointers give and at which level
    of accuracy are you able to position them? Probably the error here will be
    much more much more than the 0.1 mm accuracy of the BS2sx.

    So, my first thoughts say there will not be a real problem here.

    Regards,

    Klaus



    Oorspronkelijk bericht
    Van: Vernon Graner [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=DIxj9keHgF4lWGXsn9sFl9fy_kpPvJepAHmzPAPxPxnYkTWyGwzag4_i98YtCBD1RS-S]vern@t...[/url
    Verzonden: donderdag 9 oktober 2003 22:48
    Aan: basicstamps@yahoogroups.com
    Onderwerp: [noparse][[/noparse]basicstamps] Pinewood Derby/Raingutter Regatta timer?


    Ok,

    like some of you may also be, I'm a dad with a 7yr old in cub scouts. I
    recently got picked to create the Raingutter Regatta (that'll teach *me*
    to show up to meetings on time! [noparse]:)[/noparse] which is like a pinewood derby except
    with two raingutters and the boats are powered by the kids using their
    lungs to blow the boat down the track.

    Anyway, I's like to use a Basic Stamp to make a "winner" detector that
    would take the "judges" out of the picture so no one can complain of
    favoritism. [noparse]:)[/noparse] So, before I go about re-inventing the wheel, does anyone
    have a bit of code or schematic for something like this?

    FWIW: I'm planning on using two laser pointers as my "beam" source, a
    couple of CDS or phototransister as receivers and a servo holding a
    checkered flag at 90 degrees that will drop to 0 degrees or 180 degrees
    to announce the winner. All I need is some code to tell me which sensor
    is activated first. I have a BSI, a BSII and a BSIIsx that I could use
    depending on need.

    At first I though about polling inputs in a tight loop, but that would
    allow the possibility of one input being detected as first when the other
    one was actually first (depending on the loop position). Anyway, if
    anyone has already done this and is willing to share the code, I'd be
    much obliged! [noparse]:)[/noparse]

    Vern

    --
    Vern Graner CNE/CNA/SSE | "If the network is down, then you're
    Senior Systems Engineer | obviously incompetent so why are we
    Texas Information Services | paying you? Of course, if the network
    http://www.txis.com | is up, then we obviously don't need
    Austin Office 512 328-8947 | you, so why are we paying you?" VLG


    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.


    Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2003-10-09 23:59
    At 02:47 PM 10/9/2003, you wrote:

    >Anyway, I's like to use a Basic Stamp to make a "winner" detector that
    >would take the "judges" out of the picture so no one can complain of
    >favoritism. [noparse]:)[/noparse] So, before I go about re-inventing the wheel, does anyone
    >have a bit of code or schematic for something like this?
    >


    Hi Vern,

    This idea may not be popular here on the list, but maybe you don't
    need a Basic Stamp for your winner detector. How about having the beam
    break of each lane trip and latch a double poll, double throw relay? The
    power to each relay coil could be wired in series through one set of
    contacts of the other lanes relay - that way when one lanes relay tripped
    it would disconnect and disable the other, preventing it from
    tripping. The other set of contacts of each relay could operate the winner
    flag. What do you think?

    Tim


    Timothy Medema
    CrystaLite, Incorporated
    3307 Cedar St. (425) 745-6000 800-666-6065
    Everett, WA 98201 Fax: (425) 257-0232

    www.crystaliteinc.com
    <mailto:timm@c...>timm@c...


    The information transmitted is intended only for the person or entity to
    whom it is addressed and may contain confidential and/or privileged
    material. Any review, retransmission, dissemination or other use of, or
    taking of any action in reliance upon, this information by persons or
    entities other than the intended recipient is prohibited. If you received
    this in error, please contact the sender and delete the material from any
    computer.
  • ArchiverArchiver Posts: 46,084
    edited 2003-10-10 01:11
    I found this code on the 'net the other day. It's a three-lane
    pinewood derby timer. I think it came from Nuts and Volts; check the
    Parallax website. The code is quoted in full here; read the article
    for a full description of how it works.

    Michael

    ' Program Listing 24.2. BASIC for Beginners Race Timer with Display
    ' Program RACE2.BAS (Three-lane race timer with display)
    ' This program shows how the BS1 (or Counterfeit) can
    ' be used to time a three-lane Pinewood Derby race.
    ' It converts a raw count of program loops into
    ' units of 1/100th of a second and presents them on
    ' a serial LCD display.
    SYMBOL time1 = w2 ' Word variable for lane-1 time.
    SYMBOL time2 = w3 ' Word variable for lane-2 time.
    SYMBOL time3 = w4 ' Word variable for lane-3 time.
    SYMBOL start = pin7 ' Start-switch on pin 7; 0=start.
    SYMBOL status1 = bit0 ' Status of lane 1; 1=racing, 0=done.
    SYMBOL status2 = bit1 ' Status of lane 2; 1=racing, 0=done.
    SYMBOL status3 = bit2 ' Status of lane 3; 1=racing, 0=done.
    SYMBOL win = bit3 ' Flag to indicate race winner.
    SYMBOL stats = b0 ' Byte variable containing status bits.
    SYMBOL pos = b11 ' Printing location.
    SYMBOL digits = b10 ' Digits to display.
    SYMBOL timeDat = w1 ' Timing data to convert/display.
    SYMBOL iPre = 254 ' Instruction prefix for LCD.
    SYMBOL clrLCD = 1 ' Clear LCD screen.
    SYMBOL blank = 8 ' Blank the LCD (but retain data).
    SYMBOL restore = 12 ' Restore LCD.
    SYMBOL topLft = 128 ' Move to top-left of LCD screen.
    SYMBOL topRt = 136 ' Move to top-right of LCD screen.
    SYMBOL btmLft = 192 ' Move to bottom left of LCD screen.
    SYMBOL btmRt = 200 ' Move to bottom right of LCD screen.

    begin:
    stats = %111 ' All cars in the race to begin.
    time1=0:time2=0:time3=0 ' Clear timers.
    serout 3,n2400,(iPre,clrLCD) ' Clear the display.
    pause 5
    ' The line below is sneaky--it prints "Race in Progress" to the
    ' LCD, then blanks the LCD so that the message is hidden. That
    ' way, the program can display the whole 16-byte message by just
    ' sending a 2-byte 'unblank display' instruction.
    serout 3,n2400,("Race in Progress",iPre,blank)

    hold:
    if start =1 then hold ' Wait for start signal.
    serout 3,n2400,(iPre,restore) ' Restore "Race in Progress" to LCD.

    timing: ' Time the race.
    stats = stats & pins & %111 ' Put lowest 3 pin states into stats.
    if stats = 0 then finish ' If all cars done, then race over.
    time1 = time1 + status1 ' If a car is in race (status=1) then
    time2 = time2 + status2 ' increment its timer. If it's done
    time3 = time3 + status3 ' (status=0) don't increment.
    goto timing ' Loop until race over.

    finish:
    serout 3,n2400,(iPre,clrLCD) ' Clear display.
    pause 5
    serout 3,n2400,(iPre,btmRt,"-FINAL-") ' Print FINAL.
    timeDat=time1: pos=topLft:gosub Display ' Display race times.
    timeDat=time2: pos=topRt:gosub Display
    timeDat=time3: pos=btmLft:gosub Display
    END ' End program--reset to time another race.

    ' This subroutine converts the loop count in the variable timeDat
    ' into a number of hundredths of a second, then prints that value
    ' (as seconds, with decimal point) at the screen location specified
    ' by the variable pos.

    Display:
    serout 3,n2400,(iPre,pos) ' Move to display location.
    if timeDat > time1 OR timeDat > time2 OR timeDat > time3 then noWin
    serout 3,n2400,("*") ' Put * by winner (or winners, if tie)
    goto skip1

    noWin:
    serout 3,n2400,(" ") ' Put space by non-winners.
    skip1:
    timeDat = timeDat*8/27 ' Convert to 100ths of a second.
    digits = timeDat/100 ' Print hundreds place followed
    serout 3,n2400,(#digits,".")' ..by decimal point.
    digits = timeDat//100 ' Now print remainder.
    if digits > 9 then skip0 ' If remainder is less than 10,
    serout 3,n2400,("0") ' ..print "0" (i.e., convert

    skip0: ' "6" to "06" for correct display.
    serout 3,n2400,(#digits)
    return ' Return to program.


    --- In basicstamps@yahoogroups.com, "Vernon Graner" <vern@t...> wrote:
    > Ok,
    >
    > like some of you may also be, I'm a dad with a 7yr old in cub scouts. I
    > recently got picked to create the Raingutter Regatta (that'll teach *me*
    > to show up to meetings on time! [noparse]:)[/noparse] which is like a pinewood derby except
    > with two raingutters and the boats are powered by the kids using their
    > lungs to blow the boat down the track.
    >
    > Anyway, I's like to use a Basic Stamp to make a "winner" detector that
    > would take the "judges" out of the picture so no one can complain of
    > favoritism. [noparse]:)[/noparse] So, before I go about re-inventing the wheel, does anyone
    > have a bit of code or schematic for something like this?
    >
    > FWIW: I'm planning on using two laser pointers as my "beam" source, a
    > couple of CDS or phototransister as receivers and a servo holding a
    > checkered flag at 90 degrees that will drop to 0 degrees or 180 degrees
    > to announce the winner. All I need is some code to tell me which sensor
    > is activated first. I have a BSI, a BSII and a BSIIsx that I could use
    > depending on need.
    >
    > At first I though about polling inputs in a tight loop, but that would
    > allow the possibility of one input being detected as first when the
    other
    > one was actually first (depending on the loop position). Anyway, if
    > anyone has already done this and is willing to share the code, I'd be
    > much obliged! [noparse]:)[/noparse]
    >
    > Vern
    >
    > --
    > Vern Graner CNE/CNA/SSE | "If the network is down, then you're
    > Senior Systems Engineer | obviously incompetent so why are we
    > Texas Information Services | paying you? Of course, if the network
    > http://www.txis.com | is up, then we obviously don't need
    > Austin Office 512 328-8947 | you, so why are we paying you?" VLG
  • ArchiverArchiver Posts: 46,084
    edited 2003-10-10 01:28
    From: "Vernon Graner" <vern@t...>
    >
    > At first I though about polling inputs in a tight loop, but that would
    > allow the possibility of one input being detected as first when the
    > other one was actually first (depending on the loop position).
    >
    Haven't tried it, Vern, but I think you had the right idea: poll in a tight
    loop.

    To get around the problem of seeing one pin change before the other, just
    examine them both at once. Again, this is not tested code, but something very
    like the code below should work. The important points are in this loop:

    DO
    TriggerValue=INA&%00000011
    LOOP UNTIL 0<>TriggerValue


    First, it captures the state of both input pins in the same instruction. (This
    is not the same as "simultaneously".) Second, the pin values are moved into a
    declared variable that will not change before we have time to examine it in code
    that follows the loop. This code cannot resolve ties that occur within the short
    time interval of that loop, but a millisecond is surely close enough for a
    Raingutter Regatta, isn't it? Are you limiting bowsprit lengths?<g>

    Good luck,

    Gary

    '{$STAMP BS2}
    '{$PBASIC 2.5}
    '
    [noparse][[/noparse] The Finish Line ]
    FlagHigh CON 1000 ' Or whatever pulse width causes your servo
    ' to raise the checkered flag

    FlagLow CON 250 ' Again, substitute the calibrated pulse width
    ' for the flag low position in your servo

    '
    [noparse][[/noparse] Variables ]
    TriggerValue VAR Byte
    cntI VAR Nib

    '
    [noparse][[/noparse] Main Code ]
    Main:
    OUTS=%1111111111111111 'Preset high as a general practice to avoid problems
    DIRS=%1111111111111100 'All outputs except the two trigger pins.

    'At this point Pin0 and Pin1 are inputs, Pin2 is an output

    GOSUB RaiseTheFlag

    DO
    TriggerValue=INA&%00000011
    LOOP UNTIL 0<>TriggerValue
    GOSUB LowerTheFlag
    IF 1=IN0 THEN
    DEBUG "The RIGHT boat wins!",CR
    ELSEIF 1=IN1 THEN
    DEBUG "The LEFT boat wins!",CR
    ELSE
    DEBUG "Gary's code blew it somehow!",CR
    ENDIF

    END

    RaiseTheFlag:
    FOR cntI=1 TO 30
    PULSOUT 2,FlagHigh
    PAUSE 20
    NEXT
    RETURN

    LowerTheFlag:
    FOR cntI=1 TO 30
    PULSOUT 2,FlagLow
    PAUSE 20
    NEXT
    RETURN


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-10-10 02:18
    > Hi Vern,
    >
    > This idea may not be popular here on the list, but maybe you
    > don't
    > need a Basic Stamp for your winner detector. How about having the beam
    > break of each lane trip and latch a double poll, double throw relay? The
    > power to each relay coil could be wired in series through one set of
    > contacts of the other lanes relay - that way when one lanes relay tripped
    > it would disconnect and disable the other, preventing it from
    > tripping. The other set of contacts of each relay could operate the
    > winner
    > flag. What do you think?
    >
    > Tim


    I built something like this early on in my electronics career (1979 ish!)
    to use for a high school quiz show. We noticed that one of the channels
    seemed to win more often and during some testing, found this actually was
    the case.

    It turned out that one of the relays had a little less spring tension so
    it would tend to close quicker (that was the consensus when we couldnt
    figure out why one channel was "sweeter" than the other). I'm sure this
    would be ok, but I have to admit I have a hankerin' to do this with the
    basic stamp so I can tell the folks a computer timer with laser sensors
    will determine the winner! Just sounds more impressive... plus I have the
    gear already, it's just a matter of cobbling it all together... [noparse]:)[/noparse]

    Vern
    --
    Vern Graner CNE/CNA/SSE | "If the network is down, then you're
    Senior Systems Engineer | obviously incompetent so why are we
    Texas Information Services | paying you? Of course, if the network
    http://www.txis.com | is up, then we obviously don't need
    Austin Office 512 328-8947 | you, so why are we paying you?" VLG
  • ArchiverArchiver Posts: 46,084
    edited 2003-10-10 02:26
    Thanx a bunch! I definetly will be researching this! I knew you folks
    would come through for (lazy!) me! [noparse]:)[/noparse]

    Vern

    --
    Vern Graner CNE/CNA/SSE | "If the network is down, then you're
    Senior Systems Engineer | obviously incompetent so why are we
    Texas Information Services | paying you? Of course, if the network
    http://www.txis.com | is up, then we obviously don't need
    Austin Office 512 328-8947 | you, so why are we paying you?" VLG




    webbm03 said:
    > I found this code on the 'net the other day. It's a three-lane
    > pinewood derby timer. I think it came from Nuts and Volts; check the
    > Parallax website. The code is quoted in full here; read the article
    > for a full description of how it works.
    >
    > Michael
    >
    > ' Program Listing 24.2. BASIC for Beginners Race Timer with Display
    > ' Program RACE2.BAS (Three-lane race timer with display)
    > ' This program shows how the BS1 (or Counterfeit) can
    > ' be used to time a three-lane Pinewood Derby race.
    > ' It converts a raw count of program loops into
    > ' units of 1/100th of a second and presents them on
    > ' a serial LCD display.
    > SYMBOL time1 = w2 ' Word variable for lane-1 time.
    > SYMBOL time2 = w3 ' Word variable for lane-2 time.
    > SYMBOL time3 = w4 ' Word variable for lane-3 time.
    > SYMBOL start = pin7 ' Start-switch on pin 7; 0=start.
    > SYMBOL status1 = bit0 ' Status of lane 1; 1=racing, 0=done.
    > SYMBOL status2 = bit1 ' Status of lane 2; 1=racing, 0=done.
    > SYMBOL status3 = bit2 ' Status of lane 3; 1=racing, 0=done.
    > SYMBOL win = bit3 ' Flag to indicate race winner.
    > SYMBOL stats = b0 ' Byte variable containing status bits.
    > SYMBOL pos = b11 ' Printing location.
    > SYMBOL digits = b10 ' Digits to display.
    > SYMBOL timeDat = w1 ' Timing data to convert/display.
    > SYMBOL iPre = 254 ' Instruction prefix for LCD.
    > SYMBOL clrLCD = 1 ' Clear LCD screen.
    > SYMBOL blank = 8 ' Blank the LCD (but retain data).
    > SYMBOL restore = 12 ' Restore LCD.
    > SYMBOL topLft = 128 ' Move to top-left of LCD screen.
    > SYMBOL topRt = 136 ' Move to top-right of LCD screen.
    > SYMBOL btmLft = 192 ' Move to bottom left of LCD screen.
    > SYMBOL btmRt = 200 ' Move to bottom right of LCD screen.
    >
    > begin:
    > stats = %111 ' All cars in the race to begin.
    > time1=0:time2=0:time3=0 ' Clear timers.
    > serout 3,n2400,(iPre,clrLCD) ' Clear the display.
    > pause 5
    > ' The line below is sneaky--it prints "Race in Progress" to the
    > ' LCD, then blanks the LCD so that the message is hidden. That
    > ' way, the program can display the whole 16-byte message by just
    > ' sending a 2-byte 'unblank display' instruction.
    > serout 3,n2400,("Race in Progress",iPre,blank)
    >
    > hold:
    > if start =1 then hold ' Wait for start signal.
    > serout 3,n2400,(iPre,restore) ' Restore "Race in Progress" to LCD.
    >
    > timing: ' Time the race.
    > stats = stats & pins & %111 ' Put lowest 3 pin states into stats.
    > if stats = 0 then finish ' If all cars done, then race over.
    > time1 = time1 + status1 ' If a car is in race (status=1) then
    > time2 = time2 + status2 ' increment its timer. If it's done
    > time3 = time3 + status3 ' (status=0) don't increment.
    > goto timing ' Loop until race over.
    >
    > finish:
    > serout 3,n2400,(iPre,clrLCD) ' Clear display.
    > pause 5
    > serout 3,n2400,(iPre,btmRt,"-FINAL-") ' Print FINAL.
    > timeDat=time1: pos=topLft:gosub Display ' Display race times.
    > timeDat=time2: pos=topRt:gosub Display
    > timeDat=time3: pos=btmLft:gosub Display
    > END ' End program--reset to time another race.
    >
    > ' This subroutine converts the loop count in the variable timeDat
    > ' into a number of hundredths of a second, then prints that value
    > ' (as seconds, with decimal point) at the screen location specified
    > ' by the variable pos.
    >
    > Display:
    > serout 3,n2400,(iPre,pos) ' Move to display location.
    > if timeDat > time1 OR timeDat > time2 OR timeDat > time3 then noWin
    > serout 3,n2400,("*") ' Put * by winner (or winners, if tie)
    > goto skip1
    >
    > noWin:
    > serout 3,n2400,(" ") ' Put space by non-winners.
    > skip1:
    > timeDat = timeDat*8/27 ' Convert to 100ths of a second.
    > digits = timeDat/100 ' Print hundreds place followed
    > serout 3,n2400,(#digits,".")' ..by decimal point.
    > digits = timeDat//100 ' Now print remainder.
    > if digits > 9 then skip0 ' If remainder is less than 10,
    > serout 3,n2400,("0") ' ..print "0" (i.e., convert
    >
    > skip0: ' "6" to "06" for correct display.
    > serout 3,n2400,(#digits)
    > return ' Return to program.
    >
    >
    > --- In basicstamps@yahoogroups.com, "Vernon Graner" <vern@t...> wrote:
    >> Ok,
    >>
    >> like some of you may also be, I'm a dad with a 7yr old in cub scouts. I
    >> recently got picked to create the Raingutter Regatta (that'll teach
    >> *me*
    >> to show up to meetings on time! [noparse]:)[/noparse] which is like a pinewood derby
    >> except
    >> with two raingutters and the boats are powered by the kids using their
    >> lungs to blow the boat down the track.
    >>
    >> Anyway, I's like to use a Basic Stamp to make a "winner" detector that
    >> would take the "judges" out of the picture so no one can complain of
    >> favoritism. [noparse]:)[/noparse] So, before I go about re-inventing the wheel, does
    >> anyone
    >> have a bit of code or schematic for something like this?
    >>
    >> FWIW: I'm planning on using two laser pointers as my "beam" source, a
    >> couple of CDS or phototransister as receivers and a servo holding a
    >> checkered flag at 90 degrees that will drop to 0 degrees or 180 degrees
    >> to announce the winner. All I need is some code to tell me which sensor
    >> is activated first. I have a BSI, a BSII and a BSIIsx that I could use
    >> depending on need.
    >>
    >> At first I though about polling inputs in a tight loop, but that would
    >> allow the possibility of one input being detected as first when the
    > other
    >> one was actually first (depending on the loop position). Anyway, if
    >> anyone has already done this and is willing to share the code, I'd be
    >> much obliged! [noparse]:)[/noparse]
    >>
    >> Vern
    >>
    >> --
    >> Vern Graner CNE/CNA/SSE | "If the network is down, then you're
    >> Senior Systems Engineer | obviously incompetent so why are we
    >> Texas Information Services | paying you? Of course, if the network
    >> http://www.txis.com | is up, then we obviously don't need
    >> Austin Office 512 328-8947 | you, so why are we paying you?" VLG
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    > Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2003-10-10 02:28
    Wow! Thanx Gary! Looks like you wrote the whole thing! Above and beyond
    the call I'd say.. [noparse]:)[/noparse] Thanx a bunch I've got some great starting points!

    Vern

    PS: When I get it done, I'll put up some pictures & share the final code...
    --
    Vern Graner CNE/CNA/SSE | "If the network is down, then you're
    Senior Systems Engineer | obviously incompetent so why are we
    Texas Information Services | paying you? Of course, if the network
    http://www.txis.com | is up, then we obviously don't need
    Austin Office 512 328-8947 | you, so why are we paying you?" VLG




    Gary W. Sims said:
    > From: "Vernon Graner" <vern@t...>
    >>
    >> At first I though about polling inputs in a tight loop, but that would
    >> allow the possibility of one input being detected as first when the
    >> other one was actually first (depending on the loop position).
    >>
    > Haven't tried it, Vern, but I think you had the right idea: poll in a
    > tight loop.
    >
    > To get around the problem of seeing one pin change before the other, just
    > examine them both at once. Again, this is not tested code, but something
    > very like the code below should work. The important points are in this
    > loop:
    >
    > DO
    > TriggerValue=INA&%00000011
    > LOOP UNTIL 0<>TriggerValue
    >
    >
    > First, it captures the state of both input pins in the same instruction.
    > (This is not the same as "simultaneously".) Second, the pin values are
    > moved into a declared variable that will not change before we have time
    > to examine it in code that follows the loop. This code cannot resolve
    > ties that occur within the short time interval of that loop, but a
    > millisecond is surely close enough for a Raingutter Regatta, isn't it?
    > Are you limiting bowsprit lengths?<g>
    >
    > Good luck,
    >
    > Gary
    >
    > '{$STAMP BS2}
    > '{$PBASIC 2.5}
    > '
    [noparse][[/noparse] The Finish Line
    > ]
    > FlagHigh CON 1000 ' Or whatever pulse width causes your servo
    > ' to raise the checkered flag
    >
    > FlagLow CON 250 ' Again, substitute the calibrated pulse width
    > ' for the flag low position in your servo
    >
    > '
    [noparse][[/noparse] Variables
    > ]
    > TriggerValue VAR Byte
    > cntI VAR Nib
    >
    > '
    [noparse][[/noparse] Main Code
    > ]
    > Main:
    > OUTS=%1111111111111111 'Preset high as a general practice to avoid
    > problems
    > DIRS=%1111111111111100 'All outputs except the two trigger pins.
    >
    > 'At this point Pin0 and Pin1 are inputs, Pin2 is an output
    >
    > GOSUB RaiseTheFlag
    >
    > DO
    > TriggerValue=INA&%00000011
    > LOOP UNTIL 0<>TriggerValue
    > GOSUB LowerTheFlag
    > IF 1=IN0 THEN
    > DEBUG "The RIGHT boat wins!",CR
    > ELSEIF 1=IN1 THEN
    > DEBUG "The LEFT boat wins!",CR
    > ELSE
    > DEBUG "Gary's code blew it somehow!",CR
    > ENDIF
    >
    > END
    >
    > RaiseTheFlag:
    > FOR cntI=1 TO 30
    > PULSOUT 2,FlagHigh
    > PAUSE 20
    > NEXT
    > RETURN
    >
    > LowerTheFlag:
    > FOR cntI=1 TO 30
    > PULSOUT 2,FlagLow
    > PAUSE 20
    > NEXT
    > RETURN
    >
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    > Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2003-10-10 02:31
    In a message dated 10/9/2003 6:21:16 PM Pacific Daylight Time, vern@t...
    writes:
    Hi Vern,
    >
    > This idea may not be popular here on the list, but maybe you
    > don't
    > need a Basic Stamp for your winner detector. How about having the beam
    > break of each lane trip and latch a double poll, double throw relay? The
    > power to each relay coil could be wired in series through one set of
    > contacts of the other lanes relay - that way when one lanes relay tripped
    > it would disconnect and disable the other, preventing it from
    > tripping. The other set of contacts of each relay could operate the
    > winner
    > flag. What do you think?
    >
    > Tim


    I built something like this early on in my electronics career (1979 ish!)
    to use for a high school quiz show. We noticed that one of the channels
    seemed to win more often and during some testing, found this actually was
    the case.

    It turned out that one of the relays had a little less spring tension so
    it would tend to close quicker (that was the consensus when we couldnt
    figure out why one channel was "sweeter" than the other). I'm sure this
    would be ok, but I have to admit I have a hankerin' to do this with the
    basic stamp so I can tell the folks a computer timer with laser sensors
    will determine the winner! Just sounds more impressive... plus I have the
    gear already, it's just a matter of cobbling it all together... [noparse]:)[/noparse]

    Vern
    --
    Vern Graner CNE/CNA/SSE | "If the network is down, then you're
    Senior Systems Engineer | obviously incompetent so why are we
    Texas Information Services | paying you? Of course, if the network
    http://www.txis.com | is up, then we obviously don't need
    Austin Office 512 328-8947 | you, so why are we paying you?" VLG
    ++++++++++++++++++++++++++++++++++++=

    If interested, I built such a device from a few logic gates and a 555 timer.
    I can fax a schematic, but not until next week as I am out of my office until
    then.

    Ken


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-10-10 04:19
    Not to belabor the obvious about untested code, but in case someone digs
    this example out of the archives, please note that I just realized I omitted
    the test for the case where we have a tie and after talking about it at
    length I used the input pins themselves instead of the capture variable.

    The evaluation statement should read:

    IF (1=TriggerValue) THEN
    DEBUG "The RIGHT boat wins!",CR
    ELSEIF (2=TriggerValue) THEN
    DEBUG "The LEFT boat wins!",CR
    ELSEIF (3=TriggerValue) THEN
    DEBUG "We have a tie!",CR
    ELSE
    DEBUG "Gary's code blew it somehow!",CR
    ENDIF

    Or using one of the features of PBasic 2.5:

    SELECT TriggerValue
    CASE =1
    DEBUG "Left boat wins.",cr
    CASE =2
    DEBUG "Right boat wins.",CR
    CASE =3
    DEBUG "We have a tie!",CR
    ENDSELECT

    Just for the record<g>,

    Gary
  • ArchiverArchiver Posts: 46,084
    edited 2003-10-10 04:41
    Let's not forget Tracy Allen's example

    http://www.emesystems.com/BS2fsm.htm#Game%20show



    At 08:19 PM 10/9/03 -0700, you wrote:
    >Not to belabor the obvious about untested code, but in case someone digs
    >this example out of the archives, please note that I just realized I omitted
    >the test for the case where we have a tie and after talking about it at
    >length I used the input pins themselves instead of the capture variable.
    >
    >The evaluation statement should read:
    >
    > IF (1=TriggerValue) THEN
    > DEBUG "The RIGHT boat wins!",CR
    > ELSEIF (2=TriggerValue) THEN
    > DEBUG "The LEFT boat wins!",CR
    > ELSEIF (3=TriggerValue) THEN
    > DEBUG "We have a tie!",CR
    > ELSE
    > DEBUG "Gary's code blew it somehow!",CR
    > ENDIF
    >
    >Or using one of the features of PBasic 2.5:
    >
    >SELECT TriggerValue
    > CASE =1
    > DEBUG "Left boat wins.",cr
    > CASE =2
    > DEBUG "Right boat wins.",CR
    > CASE =3
    > DEBUG "We have a tie!",CR
    >ENDSELECT
    >
    >Just for the record<g>,
    >
    >Gary
    >
    >
    >
    >To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    >from the same email address that you subscribed. Text in the Subject and
    >Body of the message will be ignored.
    >
    >
    >Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2003-11-12 23:30
    Well I have the basic code all done for my Raingutter Regatta race winner
    system (Thanks Gary! [noparse]:)[/noparse] I ended up using this code method (suggested by
    Gary) to detect the sensors:

    DO
    TriggerValue=INA&%00000011
    LOOP UNTIL 0<>TriggerValue

    Works great with a couple of toggle switches to stand in for sensors. The
    only thing I face now is the actual design of the sensors.

    I plan to use some low-cost LED laser pointers as the light source (I can
    claim "laser" precision and also, hey it just *looks* cool!) but I'm
    still trying to find a way to make a detector that will accurately
    produce a binary 1 or 0 for the stamp to read depending on the
    presence/absence of light from the pointer.

    I tried CDS cells, but they seem to be intermittent and quite susceptible
    to ambient light interference.

    So, does anyone have a quick circuit that can be used to reliably detect
    the light from a laser pointer?

    Vern

    --
    Vern Graner CNE/CNA/SSE | "If the network is down, then you're
    Senior Systems Engineer | obviously incompetent so why are we
    Texas Information Services | paying you? Of course, if the network
    http://www.txis.com | is up, then we obviously don't need
    Austin Office 512 328-8947 | you, so why are we paying you?" VLG
  • ArchiverArchiver Posts: 46,084
    edited 2003-11-12 23:47
    Now this is coming from a different Gary !! here is a simple circuit that
    might help you out. i used it for my laser perimiter alarm. circuit might
    need minor alterations but to give you and idea. hope it works. Gary D


    Original Message
    From: "Vernon Graner" <vern@t...>
    To: <basicstamps@yahoogroups.com>
    Sent: Wednesday, November 12, 2003 3:30 PM
    Subject: Re: [noparse][[/noparse]basicstamps] Pinewood Derby/Raingutter Regatta timer?


    > Well I have the basic code all done for my Raingutter Regatta race winner
    > system (Thanks Gary! [noparse]:)[/noparse] I ended up using this code method (suggested by
    > Gary) to detect the sensors:
    >
    > DO
    > TriggerValue=INA&%00000011
    > LOOP UNTIL 0<>TriggerValue
    >
    > Works great with a couple of toggle switches to stand in for sensors. The
    > only thing I face now is the actual design of the sensors.
    >
    > I plan to use some low-cost LED laser pointers as the light source (I can
    > claim "laser" precision and also, hey it just *looks* cool!) but I'm
    > still trying to find a way to make a detector that will accurately
    > produce a binary 1 or 0 for the stamp to read depending on the
    > presence/absence of light from the pointer.
    >
    > I tried CDS cells, but they seem to be intermittent and quite susceptible
    > to ambient light interference.
    >
    > So, does anyone have a quick circuit that can be used to reliably detect
    > the light from a laser pointer?
    >
    > Vern
    >
    > --
    > Vern Graner CNE/CNA/SSE | "If the network is down, then you're
    > Senior Systems Engineer | obviously incompetent so why are we
    > Texas Information Services | paying you? Of course, if the network
    > http://www.txis.com | is up, then we obviously don't need
    > Austin Office 512 328-8947 | you, so why are we paying you?" VLG
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2003-11-12 23:50
    forgot the link

    http://www.turbodeuce.com/images/Laser_rcvr.JPG


    Original Message
    From: "Gary Denison" <gdii@c...>
    To: <basicstamps@yahoogroups.com>
    Sent: Wednesday, November 12, 2003 3:47 PM
    Subject: Re: [noparse][[/noparse]basicstamps] Pinewood Derby/Raingutter Regatta timer?


    > Now this is coming from a different Gary !! here is a simple circuit that
    > might help you out. i used it for my laser perimiter alarm. circuit might
    > need minor alterations but to give you and idea. hope it works. Gary D
    >
    >
    >
    Original Message
    > From: "Vernon Graner" <vern@t...>
    > To: <basicstamps@yahoogroups.com>
    > Sent: Wednesday, November 12, 2003 3:30 PM
    > Subject: Re: [noparse][[/noparse]basicstamps] Pinewood Derby/Raingutter Regatta timer?
    >
    >
    > > Well I have the basic code all done for my Raingutter Regatta race
    winner
    > > system (Thanks Gary! [noparse]:)[/noparse] I ended up using this code method (suggested by
    > > Gary) to detect the sensors:
    > >
    > > DO
    > > TriggerValue=INA&%00000011
    > > LOOP UNTIL 0<>TriggerValue
    > >
    > > Works great with a couple of toggle switches to stand in for sensors.
    The
    > > only thing I face now is the actual design of the sensors.
    > >
    > > I plan to use some low-cost LED laser pointers as the light source (I
    can
    > > claim "laser" precision and also, hey it just *looks* cool!) but I'm
    > > still trying to find a way to make a detector that will accurately
    > > produce a binary 1 or 0 for the stamp to read depending on the
    > > presence/absence of light from the pointer.
    > >
    > > I tried CDS cells, but they seem to be intermittent and quite
    susceptible
    > > to ambient light interference.
    > >
    > > So, does anyone have a quick circuit that can be used to reliably detect
    > > the light from a laser pointer?
    > >
    > > Vern
    > >
    > > --
    > > Vern Graner CNE/CNA/SSE | "If the network is down, then you're
    > > Senior Systems Engineer | obviously incompetent so why are we
    > > Texas Information Services | paying you? Of course, if the network
    > > http://www.txis.com | is up, then we obviously don't need
    > > Austin Office 512 328-8947 | you, so why are we paying you?" VLG
    > >
    > >
    > >
    > > To UNSUBSCRIBE, just send mail to:
    > > basicstamps-unsubscribe@yahoogroups.com
    > > from the same email address that you subscribed. Text in the Subject
    and
    > Body of the message will be ignored.
    > >
    > >
    > > Your use of Yahoo! Groups is subject to
    http://docs.yahoo.com/info/terms/
    > >
    > >
    > >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2003-11-13 19:31
    Cool! Thanx for the pic. I've been experimenting with CDS cells, but I
    think this might be the better. Thanx again! [noparse]:)[/noparse]

    Vern

    --
    Vern Graner CNE/CNA/SSE | "If the network is down, then you're
    Senior Systems Engineer | obviously incompetent so why are we
    Texas Information Services | paying you? Of course, if the network
    http://www.txis.com | is up, then we obviously don't need
    Austin Office 512 328-8947 | you, so why are we paying you?" VLG




    Gary Denison said:
    > forgot the link
    >
    > http://www.turbodeuce.com/images/Laser_rcvr.JPG
    >
    >
    >
    Original Message
    > From: "Gary Denison" <gdii@c...>
    > To: <basicstamps@yahoogroups.com>
    > Sent: Wednesday, November 12, 2003 3:47 PM
    > Subject: Re: [noparse][[/noparse]basicstamps] Pinewood Derby/Raingutter Regatta timer?
    >
    >
    >> Now this is coming from a different Gary !! here is a simple circuit
    >> that
    >> might help you out. i used it for my laser perimiter alarm. circuit
    >> might
    >> need minor alterations but to give you and idea. hope it works. Gary D
    >>
    >>
    >>
    Original Message
    >> From: "Vernon Graner" <vern@t...>
    >> To: <basicstamps@yahoogroups.com>
    >> Sent: Wednesday, November 12, 2003 3:30 PM
    >> Subject: Re: [noparse][[/noparse]basicstamps] Pinewood Derby/Raingutter Regatta timer?
    >>
    >>
    >> > Well I have the basic code all done for my Raingutter Regatta race
    > winner
    >> > system (Thanks Gary! [noparse]:)[/noparse] I ended up using this code method (suggested
    >> by
    >> > Gary) to detect the sensors:
    >> >
    >> > DO
    >> > TriggerValue=INA&%00000011
    >> > LOOP UNTIL 0<>TriggerValue
    >> >
    >> > Works great with a couple of toggle switches to stand in for sensors.
    > The
    >> > only thing I face now is the actual design of the sensors.
    >> >
    >> > I plan to use some low-cost LED laser pointers as the light source (I
    > can
    >> > claim "laser" precision and also, hey it just *looks* cool!) but I'm
    >> > still trying to find a way to make a detector that will accurately
    >> > produce a binary 1 or 0 for the stamp to read depending on the
    >> > presence/absence of light from the pointer.
    >> >
    >> > I tried CDS cells, but they seem to be intermittent and quite
    > susceptible
    >> > to ambient light interference.
    >> >
    >> > So, does anyone have a quick circuit that can be used to reliably
    >> detect
    >> > the light from a laser pointer?
    >> >
    >> > Vern
    >> >
    >> > --
    >> > Vern Graner CNE/CNA/SSE | "If the network is down, then you're
    >> > Senior Systems Engineer | obviously incompetent so why are we
    >> > Texas Information Services | paying you? Of course, if the network
    >> > http://www.txis.com | is up, then we obviously don't need
    >> > Austin Office 512 328-8947 | you, so why are we paying you?" VLG
    >> >
    >> >
    >> >
    >> > To UNSUBSCRIBE, just send mail to:
    >> > basicstamps-unsubscribe@yahoogroups.com
    >> > from the same email address that you subscribed. Text in the Subject
    > and
    >> Body of the message will be ignored.
    >> >
    >> >
    >> > Your use of Yahoo! Groups is subject to
    > http://docs.yahoo.com/info/terms/
    >> >
    >> >
    >> >
    >>
    >>
    >> To UNSUBSCRIBE, just send mail to:
    >> basicstamps-unsubscribe@yahoogroups.com
    >> from the same email address that you subscribed. Text in the Subject
    >> and
    > Body of the message will be ignored.
    >>
    >>
    >> Your use of Yahoo! Groups is subject to
    >> http://docs.yahoo.com/info/terms/
    >>
    >>
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    > Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2003-11-14 15:48
    You could also replace the photo transistor with an LED, I have used
    1000 mcd red LED,s connected directly to the pin and had good results.

    Craig

    > Message: 11
    > Date: Thu, 13 Nov 2003 13:31:51 -0600 (CST)
    > From: "Vernon Graner" <vern@t...>
    > Subject: Re: Pinewood Derby/Raingutter Regatta timer?
    >
    > Cool! Thanx for the pic. I've been experimenting with CDS cells, but I
    > think this might be the better. Thanx again!
    >
    > Vern
  • ArchiverArchiver Posts: 46,084
    edited 2003-11-14 17:15
    Does it matter what MCD rating the LED has? Is it the 1000mcd rating
    required to make it sensitive enough to trigger a logic "1" or "0" to
    the stamp pin? Just curious, since this sounds like a cool idea. Do
    you tie the opposite end to "+" or GND? If you have a schematic
    example or description, that would be cool... [noparse]:)[/noparse]

    Vern


    --- In basicstamps@yahoogroups.com, Craig Gardner <csgardner@a...>
    wrote:
    > You could also replace the photo transistor with an LED, I have
    used
    > 1000 mcd red LED,s connected directly to the pin and had good
    results.
    >
    > Craig
    >
    > > Message: 11
    > > Date: Thu, 13 Nov 2003 13:31:51 -0600 (CST)
    > > From: "Vernon Graner" <vern@t...>
    > > Subject: Re: Pinewood Derby/Raingutter Regatta timer?
    > >
    > > Cool! Thanx for the pic. I've been experimenting with CDS cells,
    but I
    > > think this might be the better. Thanx again!
    > >
    > > Vern
  • ArchiverArchiver Posts: 46,084
    edited 2003-11-14 20:36
    I remember many, many, many years ago sawing the top off 2n2222a transistors
    exposing the die inside and activating them as a switch with a light bulb.
    Certainly a very cheap phototransistor and probably good enough to detect a
    pinewood derby car entering the field blocking the light. You need to bias
    the base circuit just below the trigger level when blocked and with the lamp
    on the die it should turn on the transistor. This is more sensitive than a
    diode used to detect light in that you can bias the base circuit. With a
    diode, you need to add gain with an op amp or transistor. Run each detector
    into some ttl or cmos logic to accept the first one and your application is
    done.
    jim
    http://www.geocities.com/jimforkin2003/


    Original Message
    From: Vern Graner [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=gFVHPhD6zdCxZ47H1rTtvLbTeszT9eqbu8_q5p7Dklko4lTRghg4iaPQCLMWiGZKaXjvDgEuWQ]vern@t...[/url
    Sent: Friday, November 14, 2003 12:15 PM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] Re: Pinewood Derby/Raingutter Regatta timer?


    Does it matter what MCD rating the LED has? Is it the 1000mcd rating
    required to make it sensitive enough to trigger a logic "1" or "0" to
    the stamp pin? Just curious, since this sounds like a cool idea. Do
    you tie the opposite end to "+" or GND? If you have a schematic
    example or description, that would be cool... [noparse]:)[/noparse]

    Vern


    --- In basicstamps@yahoogroups.com, Craig Gardner <csgardner@a...>
    wrote:
    > You could also replace the photo transistor with an LED, I have
    used
    > 1000 mcd red LED,s connected directly to the pin and had good
    results.
    >
    > Craig
    >
    > > Message: 11
    > > Date: Thu, 13 Nov 2003 13:31:51 -0600 (CST)
    > > From: "Vernon Graner" <vern@t...>
    > > Subject: Re: Pinewood Derby/Raingutter Regatta timer?
    > >
    > > Cool! Thanx for the pic. I've been experimenting with CDS cells,
    but I
    > > think this might be the better. Thanx again!
    > >
    > > Vern


    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.


    Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2003-11-17 23:17
    Why would you replace the Photo transistor with an LED the photo transistor
    is being used as a receiver here not a transmitter. when the laser light
    hits the photo transistor it provides a forward BIAS to the 2N2222A
    transistor creating +V to whichever pin you have. you can replace the
    resistor attached to the photo transistor with a 10K Pot for sensitivity
    control. the photo transistor is prefered method for laser detecting circuits.
    as i am about to use them in a Laser tag project. keep me posted on how you
    project turns out.



    05:15 PM 11/14/2003 +0000, you wrote:
    >Does it matter what MCD rating the LED has? Is it the 1000mcd rating
    >required to make it sensitive enough to trigger a logic "1" or "0" to
    >the stamp pin? Just curious, since this sounds like a cool idea. Do
    >you tie the opposite end to "+" or GND? If you have a schematic
    >example or description, that would be cool... [noparse]:)[/noparse]
    >
    >Vern
    >
    >
    >--- In basicstamps@yahoogroups.com, Craig Gardner <csgardner@a...>
    >wrote:
    > > You could also replace the photo transistor with an LED, I have
    >used
    > > 1000 mcd red LED,s connected directly to the pin and had good
    >results.
    > >
    > > Craig
    > >
    > > > Message: 11
    > > > Date: Thu, 13 Nov 2003 13:31:51 -0600 (CST)
    > > > From: "Vernon Graner" <vern@t...>
    > > > Subject: Re: Pinewood Derby/Raingutter Regatta timer?
    > > >
    > > > Cool! Thanx for the pic. I've been experimenting with CDS cells,
    >but I
    > > > think this might be the better. Thanx again!
    > > >
    > > > Vern
    >
    >
    >To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    >from the same email address that you subscribed. Text in the Subject and
    >Body of the message will be ignored.
    >
    >
    >Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Sign In or Register to comment.