Fencing Scoring Machine

Hey there i have an arduino uno, and ive been working on making a fencing scoring machine. I'm an engineer with only a beginners level of electronics knowledge and passable programming skills. So to my project.
The electronic fencing scoring systems work on the idea that each fencer has three wires running to them gernerally referred to A,B and C (or more speficing Ra, Rb,Rc, and La,Lb,Lc, for the fencer on the right and the on on the left) and there is a third wire for the grounded metal strip. For each weapon the wiring works a little different.
Epee - There are essentially 4 conditions
Rest - all connections are open
Touch - the A and B lines are connected for either side (Ra + Rb, or La + Lb) meaning the button on the top of the epee has been depressed - that sides colored light turns on.
Grounded Weapon - A and B are connected but also connected to the C of the other side (ie Ra+Rb+Lc) meaning the tip is depressed but is aso touching the other fencers weapon - nothing happens
Grounded - A and B are connected but also connected to the grounded strip no touch
Foil - 5 conditions
Rest - B+C are connected on both sides
Offtarget Touch - the B and C lines are disrupted for either side, meaning the button on the top of the foil has been depressed, and no other connections,, that sides white light turns on.
Touch - the B and C lines are disrupted for either side, and the B line is connect to the opposite A line, meaning the button on the top of the foil has been depressed, and is touching oppening on his conductive jacket, that sides colored light turns on.
Grounded Weapon -the B and C lines are disrupted for either side, and C is connected to the opposite sides C meaning the tip is depressed but is aso touching the other fencers weapon - nothing happens
Grounded - the B and C lines are disrupted and B is connected to grounded strip no touch
Sabre - not worried about yet

I can get a program that works for both individually, beicase i can do fun things with the ground and it all makes sense, but when i try to make a program that works for both foil and epee and just switches modes i get lost in the wiring. Any help at all would be great!

Edit: im working on a diagram that might help as well

Better post your code as well.

http://crossroadsfencing.com/pictures.html

I can, but the issue is that, right now the way both the foil and epee programs work is with different pin set ups than the combined version would require (i believe). My issue is that it seems to be is that i need to change how the pins are being defined depending on which weapon i am trying to work for, if this is possible then great! other wise i don't have a clue how to even set up the pins to the wiring in the first place.

You have 6 pins, right? It can't be that hard.

Yes, the connections are different depending on the weapons and the lights that turn on are different too.
The time periods are different for the 3 weapons as well.
See Appendix B

and
Part I Fencers’ Weapons And Equipment
Chapter 1 Weapons

I think I have it summarized correctly below:

The scoring machine has 3 lights for each opponent: Score, offtarget, ground.

Each fencer has a 3-wire body cord that connects thru a floor reel back to the scoring machine.

For epee - 2 wires connect make a switch that closed by the tip button being pressed. 3rd wire is ground and connects to the bellguard/weapon. If used, metalic floor is also grounded. If the tip is closed against anything non-grounded for 2mS or more the scorelight goes on. If the tip is closed against ground, the score does not go on, the ground light goes on. If both tips are closed/not grounded within 40mS, both sides score. Offtarget light is not used.
Any part of the body may be scored on.

For foil - 1 wire switch is normally closed to make contact with the blade which connects to 2nd wire. Lame connects to 3rd wire. If the button tip is pressed, it opens the switch. If it is opened with a touch against the opponents lame (metallic overjacket) the score light goes on. It the switch opens against something besides the opponents lame, the offtarget light goes on. If the score wire breaks, the offtarget light goes on. If the fencer touches his weapon to his own lame, the ground light goes on. (maybe against the opponents bellguard/weapon also). Need to revisit the timing.
Grounded metallic strip does not come into play except as offtarget - all scoring is done on the torso.

For sabre - similar to foil, but no switch. Two wires connect to the weapon/bellguard. 3rd wire connects to lame. mask wire connects mask to lame. If sabre touches opponent's lame/mask/cuff, the score light goes off. If one of the sabre score wires breaks, the offtarget light goes on. If weapon touches own lame, ground light goes on. Need to revisit the timing. I believe both score lights go off if touches are made within 40mS.
Grounded metallic strip does not come into play - all scoring is done from the waist up. You hit off target, too bad, better be ready with a parry!

Foil/Sabre use same wire to connect from reel to the lame & weapon. Epee uses different type of wire. Somewhere I have a diagram of which ABC wires from the reel connect to the different weapon. For epee, AB connect to the tip switch, C to the bellguard. For Foil/Sabre, it is Not C that connects to the lame.

I don't follow that description of foils and points and so on but I get the general idea that you have various things that can be connected to each other in different ways.

You need to come up with a scheme to turn these various wires into a set of inputs to the Arduino that indicate the various conditions you want to detect. For example, the contact switch on the tip could be processed just like any other switch, using a pull-up resistor and wiring the switch so that it pulled the signal down when it was closed. You will need to do something similar for the blade and jacket contacts, and I'm not familiar enough with the behaviour to describe a solution off the top of my head, but I'm sure there is a solution and I don't expect it will be very complicated. At the end of the day you just have a handful of wires that will be connected to each other in different combinations.

"At the end of the day you just have a handful of wires that will be connected to each other in different combinations."
Not so. Outcome is different based on where the contact is made. And then the outcome is different based on the weapon being used.
Older scoring machines used 8051 processors to do this. I made mine from the '328P, using ideas from here
http://www.sonic.net/~schlae/gplscoremach.html
For my epee machine, I send pulses out the A-line and see if I get nothing back (open switch) on the B-line, get the same data back (tip switch closed), or get a low back when high was expected (tip switch closed against ground).
The check is made for both fencers every pass thru loop, waiting to start a time when a valid touch is started. I have to look, but I think I needed 30 consecutive high/low pulse matches to confirm 2mS of good tip closure to count as a touch; so for example 1.8mS and then contact to Gnd (for example a foot touch that slid off and ended up on the metallic strip) would wipe out the touch and the count would have to restart, with the Gnd light being displayed for as long as the tip was closed against Gnd. Once the 2mS is met, the other fencer is allowed the balance of 40mS for a simultaneous touch to occur, then is locked out while the scoring lights go on and the bout timer (if used) is stopped.
I buffered my outputs with an open collector driver so that an output that was grounded did not damage the arduino output driver.
I never got around to writing the pulse & check for results for foil & sabre, ran out of time while between jobs.

CrossRoads:
"At the end of the day you just have a handful of wires that will be connected to each other in different combinations."
Not so. Outcome is different based on where the contact is made.

Sure, but can't he set up a "truth table" where outcome X depends on A, B and C being connected but D and E not being connected? Something like that?

No, because of the time interactions.
Epee: I start to score, I have to be in contact (tip switch closed on something not grounded) for 2mS - you can start at the same time, or up to 38mS later, and still score too, if you can maintain the contact for your 2 mS.
Foil & Sabre have their own times to follow also.

OK, so once you get a contact you need to remember when that happened? And then if something else happens within a certain time that has a certain meaning, otherwise a different meaning? I can see how it could get complex, but it would be manageable. :slight_smile:

I see the time-based handling of events as completely distinct from the electrical problem of how to connect those various switches and contacts up to the Arduino so that you all those conditions can be detected.

I'd hope to find there's a simple scheme for connecting that lot just using each circuit to pull-up / pull-down a small number of signals. If that isn't feasible I suppose the next option is to pulse each output in turn and see which input(s) it's connected to, and hope you can get round all the possible combinations fast enough.

The electrical part is pretty straightforward, as I described above.
Only 1 weapon is on at a time too.
This setup allows for any combination of driving & receiving back. The Arduino does not drive any line directly - there's a lot of wire going from scoring machine to the reel, the reel out to the fencer & weapon, and then back thru the other fencer & reel & floor cord back to the scoring machine.
As I said, I've only done epee so far, would like to get foil & sabre implemented for use at any club.
The signals at the bottom go to shift registers for the lights.
The diodes keep static electricity out.

I hope you don't mind me jumping in - we manufacture microprocessor-based scoring machines and related fencing equipment, and I, of course, have an arduino-powered one in my club :slight_smile:

There are two issues here:

  • Yes, there are 3 wires going to each fencer, but one (line C) has to be connected to the ground, as well as to the guard, and to the blade. That implies that there are only 2 wires per fencer to write to / read from. That's good news.

  • It is a bit more complicated than treating a fencing "sword" as a switch. The rules (referenced above) require that, for foil for example, you register a touch only when the LB-LC resistance rises above 500 ohm, or you'll be detecting off-target touches quite often with dirty-but-idle foil tips (then you also look up the LB-RA resistance to decide if it is on-target - below 200 ohm - or off-target touch - remember, line A is lame, foil fencer's conductive vest). Different resistances play similar role in epee and saber, both when detecting the touch, and, in epee, checking if it was on the fencing piste instead of the opponent's foot.

Here is my advice. If you want to follow the rules, you might be better off connecting both A and B lines to analog ports, with voltage dividers, so you can detect grounding at either line, and get anti-blocking feature (detecting valid touch in foil even when the opponent touches his foil to the lame, which used to ground lames in the past.) Reading the analog values for each of the four lines (RA, RB, LA, LB), and setting up a look-up table of voltage brackets, will easily tell you which light(s) to turn on. You may also add decoupling capacitors to address the issues that sometimes arise from long wires (about 220 ft, not shielded, not twisted)...

You may be interested in my arduino fencing box, still a few bugs, but working for Epee and Foil. Sabre on the way....

Cool to see so many fencers here.

Yes indeed.
What do your boxes look like?
Here's my main unit, does touches, sound, score, time countdown, interfaces with my RF remote, and one of my other 5 units which do touches/sound only (all similar, yet all unique as I tried different things with shift registers and 7-segment displays I had on hand).
I also have 6 repeater lights, which look like the smaller units with just a promini to receive/decode a 5 byte message and control 2 light-boards (in various stages of assembly here, and pictured with one of the Firefly scoring machine that we started with as a travelling club.

(and below for a view from across the length of my house)

Well done.

Wow - just realized those boxes have been running for 2.5 years now!

Any updates? Fencing Dad here. :slight_smile: