Need Help with Interface Board Design

Thread Starter

mightymike

Joined Feb 1, 2010
8
Miniature Race Car Track Timer

I have developed a software program written in VB6 which will ‘time’ the four race tracks simultaneously. It also tracks and computes all the data that relates to each individual racer throughout the event. My problem is I need someone that can design and build the Interface Board via the actual Race Track sensors and my Program. The race track (used by several children events) is about 30’ long and 16” wide. The cars are driven by gravity force from a slanted track at the beginning. I have to be able to lock-on to their ‘times’ within 1/1000 of a second using four individual timers. I am currently doing this using my program and tracking the times internally (using the computer as the timer) and using the ‘computer screen’ as the timer display. The display runs in Real-time and shows the times counting simultaneously during the race.
I purchased an USB Interface Board with 5 digital inputs that tracks the four individual finish sensors and the starting gate sensor. When I detect one of the finish track sensors via the interface board, I then stop that particular timer. When all four sensors have been tripped then the race is over for that heat. All worked well and I was able to track the events. But I have a serious problem! The Interface Board is too slow to respond in a timely manner. If the interface board is off-line and I use the keyboard to simulate my finish sensors, then all is fine, But once I put the interface board on-line, my counting sequence degrades dramatically to unrealistic results. The reason this is happening is because my program has to poll the board every 1/1000 of a second. The board simply can’t respond that fast which causes a ‘second’ to become more like ‘8 seconds’ in effect (the computer is waiting on the results from the board). If I set the program to poll the board every 1/100 of a second, the timing is more (but not great) effective, but the accuracy is severely impaired. If 2 cars trip their finish sensors within that same 1/100 of a second (very possible), then all information is lost on one of the two cars. Totally unacceptable as you can see.
The only work-around that I see is that the Interface Board itself has to track the four times individually and when these times are latched by their sensors (finish), the board then triggers an ‘event’ to my program. My program then reads these times and takes over from there. I don’t have enough knowledge to build something like this and I believe the board itself will have to have some ‘firmware’ attached to it also. The event (or firmware) has to be able to be read by VB6 program. VB6 is somewhat limited on catching external events. In other wards, instead of my program polling the board every 1/1000 of a second, I need the interface board to initiate a request to my program when an event takes place. I don’t know if the board can do this with one timer or if there needs to be 4 separate timers.
Please look at the attached pictures that I have included. Even though the board would actually track all the times, I would still like to be able to show the times on my computer screen counting in real-time if possible. If not feasible then I could simulate my own counting process for visual effects only, but use the ‘Real Times’ read from the Interface Board.
I was writing several different people before and had one individual respond giving me some thoughts he had on what had to be done and it sounds exactly what I need. He promised to help develop this board and he would then use the creation process for other projects that he designs. Unfortunately he never got back to me and now here I am again begging for any help from somebody that is qualified to do this. I don’t have money to pay to hire someone professionally to do this. I am hoping that someone will take it as a challenge or a student project. I can pay for materials and all the help I can offer. There is a chance that I might need several of these boards in the future, but that is another manner.
The requirements for this board needs to be USB driven and has to contain at least 5 digital inputs and possibly 2 digital outputs that can be read by my program using VB6. One digital input for the Gate sensor and four for the Finish sensors (1 for each track). I would like one digital output signal to drive a LED (green) at the starting gate that my program can activate that shows to the operator that the cars can be launched and the software is on-line and another digital output to drive a (red) LED indicating NOT to launch the cars until the program is reset and ready for the next heat.
Below I have included some of what that person had to say that would be required to build this board. I am including it as ‘food for thought’.
-----------------------------------------------------------------------
* move the Real-Time task of monitoring the I/O pins from the application program down to the interface board.
* Write custom ‘firmware’ that resides on-board.
* Implement a timer, a way to start the timer(s), a monitor to check the I/O pins and a buffer to Record the events.
Your software would then need to:
* Start the timer.
* Return the current contents of the events buffer.
* Stop the timer.
My Firmware would need to do:
* Start my hardware timer when I receive the ‘Start Timing’ command.
* Clear the events.
* Read the pins.
* Make an initial entry in the events buffer (pin values and timer value).
* Monitor the I/O pins looking for ‘state changes’ (current pin values different from previous values.
* Whenever a ‘state change’ is detected (car passing the sensor), add an entry to the ‘events buffer’ that includes the state of the pins and the value of the timer (elapsed time).
* Respond to any requests for the contents of the ‘event buffer’ by returning the current contents and then clearing the buffer.
* Respond to the ‘Stop Timing’ command by stopping the timer and halting the monitoring of the I/O pins.
-----------------------------------------------------------------
Anyway.... I think you get the idea. I would truly appreciate hearing from someone who thinks he or she could take on this task or if you know someone that could! These race events take place in late March or early April so I would like to have it in operation by then if possible.
Thank you for taking the time to read this and I hope I haven’t totally confused you in the process.
Best Regards,
Mike
Please Contact me at: <snip>
 
 
 
 
 
 
 
 
 

Attachments

Last edited by a moderator:

MikeML

Joined Oct 2, 2009
5,444
The last time I tried to do anything real-time using Windows I discovered that it is next to impossible. Your VB program might be put to sleep for 10s of milliseconds while Windows is off tracking the mouse or servicing the hard drive, or printer, or whatever.

You need to this in hardware, and only use VB to draw pictures after the dust settles.
 

SgtWookie

Joined Jul 17, 2007
22,230
Can't agree more with MikeML.

You'd do much better with a remote uC monitoring the time, and sending the actual times back.
 

bluebrakes

Joined Oct 17, 2009
252
you can buy laser sensor PDs from industrial automation companies.

They can have a range from 5cm to well over 3m. They have a simple transistor switch inside them...

Sensopart
http://www.sensopart.com/

http://www.sensopart.com/productcategory-4-photoelectric_switches_proximity.html

They have a very fast response time too. Use transistors too, so fast switching.

I agree with everyone about using a microcontroller to store the lap data. Maybe use a max232 to communicate with the PC via serial. MsComms activex in visual basic is very easy to use.
 

Thread Starter

mightymike

Joined Feb 1, 2010
8
Thanks for the info. I wonder how I could incorporate that into my program though? I need to be able to retain my software. Something I could look into though.
Best Regards
 

Thread Starter

mightymike

Joined Feb 1, 2010
8
Thank you BlueBrakes, I will look into that!

I am having a problem with the RS phototransistor going completely LOW when the sensor is blocked. It goes from +5v to +.10v not allowing the PIC Microprocessor to see the low (absolute zero) state. If you look at the schematic and look at the top right, you will see the diagram of the phototransistor location. I have used a 15k resistor to pull the source to ground when the phototransistor is blocked at RB0, RB1, RB2 and RB3 at the PIC. Apparently it is not working because it doesn't go to 0v (low). The PIC is looking for a 'high' when the sensors are not blocked. If I force the pins to ground, all works fine. I used the 15k resistor upon recommendation, but now I am thinking I should have used a 10K as normally suggested. I have the PCB completely assembled and installed, so it isn't that easy to pull out and start experimenting. If I know this could be a fix, I'll do just that but it would be nice to know before I start tearing things apart. Any suggestions?
Thanks all.

Using the Schematic shown, any idea on the minimun value resistors I can use pulling the phototransistor to ground when the phototransistors are blocked without doing any harm? I am currently using 15k and have a 5 volt source and the leads between the emittor and the resistor go to a PIC board drawing about 50ma which is looking for a 'high' or 'low'. Currently the resistors are only pulling the voltage down to about .21v and I need zero (0).
Thanks for any help.
Mike
 

Attachments

Last edited by a moderator:

hgmjr

Joined Jan 28, 2005
9,027
I have merged all of the related threads into the one thread. It is confusing to our members to scatter the same questions over multiple threads.

hgmjr
 

R!f@@

Joined Apr 2, 2009
9,918
Yeah. Thanks hqmjr.
I replied to the OP thread and there is it again another one ......
I was really confused just now....
I got a contact admin thing again.

it was there and then it wasn't there... I thought I am seeing things as I have been fighting with my supply and taking a break every hour or so to clear the mind, I log in to AAC.
I thought I was getting a bit woooooooozy!!
 
Top