General Idea for a Timing System? Will it work?
ryfitzger227
Posts: 99
Hello everyone!
I've been using the BASIC Stamp for a while now and would like to upgrade.
My project I've been working on is a timing system.
The way I have it planned to work is that a BS2 would work as a "controller/decider." And then the Propeller would be the timer. All of the controls will be done through a VB.NET program. The program is for a racetrack that wants to use this for qualifying.
Let me explain a little further. I have an infrared that works like a pushbutton. When it's broke it equals 0 and when it's reflecting it equals 1. You will have 3 cars on the track at one time and you will input all of the data (Car #s) into the VB program. This means that the propeller will need 3 separate timers. One for the first car, one for the second car, and the final one for the third car. The BS2 will talk to the VB.NET program to find out where the cars are. For example if the second car out passes the first car, the BS2 needs to know that because that means that the next time the infrared beam is broke then it needs to actually stop the second car's timer instead of the first car. Sound a little confusing but it's actually pretty simple.
User inputs data for the cars in the GUI. The GUI sends a string (via the Serial Port) of, lets say, "1" to the BS2. The BS2 knows that this means the operator is ready to begin the timing. Now the BS2 is monitoring the infrared status. The first time the beam is broken, it starts the First Car's timer. The second time it starts the Second Car's timer. And the third time it starts the Third Cars timer. Now, lets say that car #8, the second car out, passes car #73, the first car out. The user will change the #8's position to first and the #73's position to second. Next the GUI will send this info via the serial port to the BS2. Basically this is telling the BS2 that the second car out is now first, and the first car out is now second so the BS2 knows that when the first car breaks the beam again, it's actually the second car out and will stop the second car's timer. The propeller(s) will then send the time that it calculated to the GUI and it will display it to the user.
The way I'm thinking about connecting the BS2 to the Propeller(s) is through transistors. Basically you have two transistors per timer. One start and one stop. Kinda like a user pressing a pushbutton except it will be all electronic.
So here's my first question. I'm pretty sure the propeller can do this, but I need the timing to be in thousandths of a second. So like 19.985. One thousandth of a second is equal to 1ms. So just to make sure, can the propeller time at a resolution of 1ms?
Next question. I need three timers. In the BS2 (if you don't care about accuracy) if you want to time something you use the following code:
This "locks" up the program until the timing is finished. I can't have that. I need the microcontroller to be timing while doing other things, like monitoring the I/O pins for when to start/stop certain timers. So I'm technically basing this off of my knowledge from using a BS2. If I were to use a BS2 for this project I would need 3 separate ones for the timing. (Except the timing at this resolution with the BS2 is WAY off.) So will I need 3 Propellers or just 1?
Another question. How would I connect the Propeller to the serial port. I haven't started with the Spin language yet, so this might be a very easy question. With the BS2 you use SEROUT/SERIN. Is there an equivalent to that in the Spin language? Or would I need to use something like a RS232 or other chip?
This project is still in the planning phase and if you have any suggestions, feel free to throw them out.
Thanks for all of the help you may bring!
- Ryan
I've been using the BASIC Stamp for a while now and would like to upgrade.
My project I've been working on is a timing system.
The way I have it planned to work is that a BS2 would work as a "controller/decider." And then the Propeller would be the timer. All of the controls will be done through a VB.NET program. The program is for a racetrack that wants to use this for qualifying.
Let me explain a little further. I have an infrared that works like a pushbutton. When it's broke it equals 0 and when it's reflecting it equals 1. You will have 3 cars on the track at one time and you will input all of the data (Car #s) into the VB program. This means that the propeller will need 3 separate timers. One for the first car, one for the second car, and the final one for the third car. The BS2 will talk to the VB.NET program to find out where the cars are. For example if the second car out passes the first car, the BS2 needs to know that because that means that the next time the infrared beam is broke then it needs to actually stop the second car's timer instead of the first car. Sound a little confusing but it's actually pretty simple.
User inputs data for the cars in the GUI. The GUI sends a string (via the Serial Port) of, lets say, "1" to the BS2. The BS2 knows that this means the operator is ready to begin the timing. Now the BS2 is monitoring the infrared status. The first time the beam is broken, it starts the First Car's timer. The second time it starts the Second Car's timer. And the third time it starts the Third Cars timer. Now, lets say that car #8, the second car out, passes car #73, the first car out. The user will change the #8's position to first and the #73's position to second. Next the GUI will send this info via the serial port to the BS2. Basically this is telling the BS2 that the second car out is now first, and the first car out is now second so the BS2 knows that when the first car breaks the beam again, it's actually the second car out and will stop the second car's timer. The propeller(s) will then send the time that it calculated to the GUI and it will display it to the user.
The way I'm thinking about connecting the BS2 to the Propeller(s) is through transistors. Basically you have two transistors per timer. One start and one stop. Kinda like a user pressing a pushbutton except it will be all electronic.
So here's my first question. I'm pretty sure the propeller can do this, but I need the timing to be in thousandths of a second. So like 19.985. One thousandth of a second is equal to 1ms. So just to make sure, can the propeller time at a resolution of 1ms?
Next question. I need three timers. In the BS2 (if you don't care about accuracy) if you want to time something you use the following code:
DO timer = timer + 1 PAUSE 1 LOOP UNTIL pushbutton = 0
This "locks" up the program until the timing is finished. I can't have that. I need the microcontroller to be timing while doing other things, like monitoring the I/O pins for when to start/stop certain timers. So I'm technically basing this off of my knowledge from using a BS2. If I were to use a BS2 for this project I would need 3 separate ones for the timing. (Except the timing at this resolution with the BS2 is WAY off.) So will I need 3 Propellers or just 1?
Another question. How would I connect the Propeller to the serial port. I haven't started with the Spin language yet, so this might be a very easy question. With the BS2 you use SEROUT/SERIN. Is there an equivalent to that in the Spin language? Or would I need to use something like a RS232 or other chip?
This project is still in the planning phase and if you have any suggestions, feel free to throw them out.
Thanks for all of the help you may bring!
- Ryan
Comments
What happens if 2 cars pass the infrared at nearly the same time? You would not be able to measure a time for the 2nd one in this case.
1ms is not a problem, poor propeller has to wait a lot ;o) The propeller has 8 cores which work independently, so no blocking. I don't see why you would need an additional BS2.
There is an object in the object exchange which gives you a lot of functions which you know from BS2. I never used it, but I think it also supports the serial interface. Another possibility is to use FullDuplexSerial from the object exchange.
Perfect question! This is a very hard thing to overcome. However we do have 4/10 of a mile to work with. And all cars run fairly close to their time. In the case of a very slow car that runs times away from all other cars (but we don't have these in the classes that we qualify) then we'll run that (those) car(s) by themselves. Right now I'm more worried about how to get everything to communicate the way I want it to and do the timing the way I want it to. Then we'll worry about how to overcome this problem.
Hahaha! Well that's a good thing! I want a very accurate time for my system considering the one they have now hasn't been calibrated since 1987! And I probably don't! I did it more of the simplicity in coding, but once I get into the spin language I might just change to one single propeller then!
Alright! That's good. All I wanted to know is just to make sure I didn't have to use an external chip and could just connect it "directly" to the computer.
Thanks for all of your help! One last question. I've been reading some topics about how learning the spin language is kind of hard with doing it through books/publications from Parallax. What's the easiest way to learn it? Should I use the QuickStart board or the BOE? I need to learn the language fairly quick. I only have about 2 months to have this finished.
Thanks!!
- Ryan
Here are of couple of posts about my opinion on the subject.
http://forums.parallax.com/showthread.php?143903-NXT-2.0-or-Parallax-BoeBot&p=1143008&viewfull=1#post1143008
and
http://forums.parallax.com/showthread.php?143877-Recommended-propeller-book(s)&p=1142684&viewfull=1#post1142684
I already programmed for centuries ;o) before I started with the propeller. I did not have any problems learning spin from what parallax published. The propeller education kit lab (see sticky thread) was a pretty good start.
This forum has a lot of very helpfull participants, so if you have problems learning SPIN just ask! If your code is not closed source, you can directly post what you have and you'll receive exactly the help you need!
Have you considered an active device on the cars to identify each car (I'm assuming cars but any vehicle would be applicable).
a poor man's version of AMB units.
I'd like to work with you.
Present project is telemetry on a sidecar used both on roadrace courses and at Bonneville.
Rick
It's so cool to actually see someone on the Parralax Forums that is doing somewhat of the same thing. I've always wanted to build a transponder system. Just for the heck of it. But I could never figure out how the loop wire and transponder "communicated." For example, I get how the loop wire recognizes a car. But how does the transponder say "oh that's me!"
Could you share some knowledge on that with me please? Haha!
That's what system this racetrack was looking at - MyLaps (used to be AMB ;-) ). But hey, If I can design one, why can't I do that?!
However, I still need to complete this one. If a transponder system is a valid idea, then that would be for next year. That doesn't mean we can't talk about it though! Hah!
Thanks!
- Ryan
Actually this would work, I've seen the RFID Transponder Systems online. But not a lot of big time tracks have them... I think? But yes, this is the overall goal - to have a loop wire underground and then each car has transponders. However, this is the first goal. When I asked about the transponder system they were stuck on next year. They really want a system involving an infrared for this season.
Sounds complicated - are these running in lanes, or can they finish anywhere ?
To simplify information flying around, I would send beam info to the PC, and let the PC decide whose time is which.
If you send both edges, Make and Break, you time both ends of a vehicle, and in the case of an overlap, you manually (photo?) define a 'winner' and then the SW uses Leading-Leading timing for Winner, and Trailing-Trailing for the close second.
The Prop can time to 12.5ns to 53.687s easily, or you could slow it down to run 1us LSB, to give a Full scale of 1.1930 Hours or 10us to 11.9 hours (etc)
You can use one timer to Drive a Pin, and then Count edges on that pin with the other timer, to get a Soft-scaled timing system.
PC would send the desired decimal point/LSB and you would start from there.
The benefit of scaling your timer, is you never need worry about reset, or roll over.