Hi,
Im hoping someone can help me with some advice around the suitability of an Arduino for a project, and potentially some assistance with some design decisions.
Background
Our slotcar club presently uses an old PC (386 sx40), running DOS, with a compiled QBASIC app for lap counting.
There is a photo interrupter embedded in each slot, which the guide on the slot car cuts to count a lap. This then interfaces with some circuitry into the computer via a physically wired keyboard (old AT connector and the wires are soldered to the back of the individual key microswitches). The keyboard then sends key-presses to the s/w to create lap timestamps.
Issues with Current Setup
The PC needs to be replaced, as its getting very tired. The keyboard interface causes us issues as well, due to it being hard-wired and using an AT interface (rather than PS2 or USB). This makes it hard to replace either the keyboard or the PC due to old AT connector.
The main problem with the current system, hardware age and replace-ability issues aside, is just not accurate enough. A good driver can turn consistent laps <= 1/10th of a second, with total laptimes of ~ 3.8 to 6 seconds. We get a LOT of groupings where the computer reports identical lap-times for a driver, and we often get deadheats in qualifying where we need to count back 3 or 4 laptimes to find qualifying placings.
Apparently as a stepping point, I should be able to hack a USB keyboard and wire into the matrix. This would at least take me partially there in terms of resolving the hardware supportability issues.
I initially looked into using Phidgets as an option for providing USB connectivity, but it appears the combination of the digital IO and USB will only provide a resolution of about 8ms. This is probably far better than what the present system gives (research suggests 55ms precision due to software clock in DOS), but if Im going to go to the effort of writing new s/w and a new input system, then I want to do it properly!!
So;
Requirements
- Support 4 lanes
- Accurate to 1 millisecond (0.001 sec)
- Interface with a PC-based race-control system (to be written)
- New lap-time data needs to arrive in PC s/w with-in 0.5 seconds (preferably < 0.25 sec update times)
- Able to cope with doing the above for 4 lanes, where lap-times >= 3 secs
- Controlling things such as turning off the track power at race end
Thoughts / Questions
Im thinking that the PC should be the primary time keeper / controller, and the Arduino should effectively just send timestamps to the PC for new laps, and get instructions back such as 'turn off power' (possibly with a second board) etc. Some of this does appear to be a bit of a pain with the serial comms from PC to Arduino.
From what Ive researched so far, I think the Arduino should handle what I want to do, but it seems that the best way to do it would be with interrupts. Since the Uno only has two external interrupts, Im thinking that that would suggest that the Mega would be the right option as it has 6 external interrupts.
What Im concerned about is whether the serial comms will be able to keep up with the dataflows while the lap counter interrupts are going on. The protocol would have to be quite robust to allow it to be interruped and restarted all the time due to the counter interrupts.
Hoping someone can provide some input, thoughts, and direction around this?
Cheers,
Rob.