Shop OBEX P1 Docs P2 Docs Learn Events
DS1302 & BS2 as ET Timing System — Parallax Forums

DS1302 & BS2 as ET Timing System

ryfitzger227ryfitzger227 Posts: 99
edited 2012-05-17 23:59 in BASIC Stamp
Hello all,

I have recently been working on a timing system for a local racetrack. I would like to know if the DS1302 & BS2 combo would work for what I need.

Here's how it works.
A Multi Beam Sensor (infared) is lined up with a reflector (=1). When the beam gets broke (car runs through it) it will now = 0. Think of it as a pushbutton on a stopwatch. In fact! That's all it is. Just a lot more accurate.

So when a car breaks the beam (=0) the timer needs to start.

The timing also needs to be in a 3 decimal format. So like it could me in miliseconds.
(99999ms = 99.999sec)

Before I decided to maybe use the DS1302 I decided to use a BS2 by itself. However, it's WAY off. But, here's an example program on how the BS2 program looked like.

InfaredINPUT = the 0/1 reading of the infared (broke/reflecting)
Broke = 0
Reflect = 1
Lap = variable for lap et


DO
' Nothing
LOOP UNTIL InfaredINPUT = Broke

DO
PAUSE 1
Lap = Lap + 1
LOOP UNTIL InfaredINPUT = Broke

DEBUG "Lap 1 Time: ", DEC Lap/1000,".",DEC3 Lap, " Seconds", CR,


So, as you can see, at the end it divided the Lap (ex: 99999 milliseconds) by 1000 to make it (99.999 seconds)

That's all I need done. Just remember think of the infared as a pushbutton.
So you "press" the "pushbutton" > it sends a signal to BS2 > the BS2 sends a signal to the DS1302 and starts the millisecond (or whatever it has) timer > times it until the "Pushbutton" is "pressed" again > Ds1302 sends time in ms or whatever to BS2 > BS2 displays time on DEBUG screen.

Will this work? Can you give me an example program maybe. It will probably take a while for me to get the hang of programming with an external chip (DS1302), so any help on that is appreciated!

If this will not work, can you supply me with another timer/stopwatch chip that will work. (Ex. Accurate 1ms timer sent a signal to bs2 every 1ms. Or just a stopwatch chip that simply times it.)

P.S. the old BS2 program is attached below.

Thanks!
-Ryan

Accutimg Pro v1.3.bs2

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2012-05-02 06:15
    The BS2 is incapable of doing timing with a resolution of 1ms and the DS1302 only provides a time to the nearest second and I'm not aware of any timer / stopwatch chip that will do what you want. You could build an external millisecond counter for the Stamp that's driven by a crystal oscillator. There are also all sorts of other microcontrollers that could be used to build what you want including the Propeller. Something as simple as a Propeller QuickStart Board would do as long as you're using a PC as the display.
  • ryfitzger227ryfitzger227 Posts: 99
    edited 2012-05-14 13:42
    The external millisecond counter for the stamp, driven by a crystal oscillator sounds like a good idea...

    Could you maybe give me more information on how to do this, or send me somewhere that will help?
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2012-05-17 23:59
    For simplicity I would have to second Mike's recommendation to use the Propeller microcontroller for this. The internal counters along can provide extremely high resolution for counting and timing.
Sign In or Register to comment.