2
\$\begingroup\$

I am a fencing coach, and the electronic scoring equipment is very expensive. As a project, I wanted to make a device that could check if a scoring touch happened that could interface with my laptop through USB. I wrote a basic scoreboard program in C# that could show the scores , but I have no experience writing software to interface with hardware.

With the electrical equipment, this is done simply by checking on whether or not the circuit was completed when the tip of the button was pressed. A closed circuit is a point, an open circuit is a miss.

What would I need to do to build a machine that could send the information about whether or not the circuit is closed to the program on my computer?

(Additional Information) Two fencers each have a foil that has a button on their tip. A wire runs from each fencer's sword and connects to the machine. They both also have metallic vests that are connected to the machine. When the button is pressed on the vest, the circuit is completed. When pressed off the vest, it is off target.

I have the electronic foils and vests. I have the wiring. What I need is the machine that checks whether or not the circuit is completed, and then sends that information through USB to the laptop program.

\$\endgroup\$
  • \$\begingroup\$ Could you provide a more detailed description of the scenario? Do the fencers have any connection between them? Is it wired? What part of the equipment do you have already, if any? \$\endgroup\$ – Samuel Oct 4 '13 at 20:25
  • \$\begingroup\$ Just to clarify the problem - each weapon would be fitted with a 'touch button' at its tip so two wires must run back along the weapon. All the rigs I have seen have a wire connected to the fencer as well as the weapon with the circuit being made through a metallic covering on the fencers body when the weapon touches. Also is it important to distinguish who hit first? \$\endgroup\$ – JIm Dearden Oct 4 '13 at 20:26
  • \$\begingroup\$ (Additional Information) Two fencers each have a foil that has a button on their tip. A wire runs from each fencer's sword and connects to the machine. They both also have metallic vests that are connected to the machine. When the button is pressed on the vest, the circuit is completed. When pressed off the vest, it is off target. \$\endgroup\$ – chancedurant Oct 4 '13 at 20:32
  • \$\begingroup\$ I have the electronic foils and vests. I have the wiring. What I need is the machine that checks whether or not the circuit is completed, and then sends that information through USB to the laptop program. Thanks again \$\endgroup\$ – chancedurant Oct 4 '13 at 20:34
  • \$\begingroup\$ I can use code in the laptop's program to check who touches first, so it is not a priority for the machine to be able to do that. Your description Jim of the wiring to the fencers and metallic covering seems accurate. \$\endgroup\$ – chancedurant Oct 4 '13 at 20:59
1
\$\begingroup\$

You have three problems:

  1. The actual events may be brief, but they may also suffer "contact bounce" in which what a human would consider one event actually consistent of many unique electrical make/break events, which should not all be counted.

  2. You need to logically "AND" the button and the continuity test to detect points, but due to bounce they may not actually be simultaneous, so you'll need to look for correspondence within a small window of time.

  3. You need to get the data into a computer via USB.

I think the simplest (and most tunable) environment in which to implement the decisioning of the first two tasks would be software running on an embedded microcontroller. And the simplest way to get events into a computer over USB is virtual serial port.

Therefore, the solution I would recommend is a small amount of custom software, experimentally developed for a cheap embedded board which has a USB-serial communication channel back to the computer.

The most well known such candidate would be an Arduino or equivalent. However, there are additional options - if you want to program in C# everywhere there is the Netduino. If you'd like to dig more into the underlying implementation details, ST offers some $10 class "discovery" eval boards. In reality almost every chip maker has something in the way of a cheap demonstration or evaluation board for at least one of their USB-capable chips on the market.

If this will be your first project of this sort, you'll probably find a greater variety of immediately applicable support resources for the Arduino than for anything else.


Now that I think of it, there is one alternative software organization on the same hardware which might make more sense for you. Instead of doing decisioning, you could have the embedded board run in a tight loop, reading an 8-bit digital port (up to two pairs of fencers) and outputting that value over serial. An interrupt (or on an Arduino UNO the baud rate of the serial port itself if run in bare bones mode rather than using the buffered API) can be used as a timing source to regularize the measurements. For example, at 115200 baud you would get on the order to 10,000 samples per second - likely insuring that any event will be sampled at least once. You could then write software on the desktop which would parse this stream of data, looking for button and continuity event groups which coincide. Personally, I'd prefer to do that on the embedded board and make the system self contained, but doing it on the desktop might make it easier for you to experiment with the grouping algorithm, visually plot the signal bounce (to an imperfect degree) let you put in sliders for tuning the tolerances, etc. Really it's a matter of your preference.

\$\endgroup\$
0
\$\begingroup\$

One very simple approach would be to use an off-the-shelve USB-RS232 converter (or an FT232 chip if you'd prefer bare chips) and have your circuit connected to some of the handshake pins. You can check the level of the handshake pins from most windows serial port libraries.

I would be a bit worried (or rather more than a bit) about connecting an electric vest directly to a computer, so there should probably be some optocouplers in the circuits, and batteries to power the isolated (human) part.

Does this give you enough direction?

\$\endgroup\$
  • 1
    \$\begingroup\$ As the touch events may be very brief this is unlikely to work unless the RS232-USB converter "pulse stretches" events on the status lines to at least the length of the USB polling interval. Also there may not be 4 lines on one converter. \$\endgroup\$ – Chris Stratton Oct 4 '13 at 21:08
  • \$\begingroup\$ The vest itself is not electric, but simply allows the flow of the current. The amount of electricity needed is only that to show that the current is completed or broken. Outside of that, there is no need of an electric charge. Do you still feel that there is a danger to hooking it directly to the computer? \$\endgroup\$ – chancedurant Oct 4 '13 at 21:10
  • \$\begingroup\$ @Chris: what is the polling interval? No need to limit to just one usb-serial converter... @ chancedurant: yes. \$\endgroup\$ – Wouter van Ooijen Oct 4 '13 at 23:04
  • \$\begingroup\$ USB slaves only get to talk when addressed by the master, so it's not very good for discrete sampling of realtime events, though moving packets of samples regularly timed by something external can work. \$\endgroup\$ – Chris Stratton Oct 4 '13 at 23:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.