Arduino Fencing Scoring Apparatus




This is a tutorial on how to build a fencing scoring machine using the Arduino Uno. It supports all 3 fencing disciplines of foil, epee and sabre.

Fencing boxes or scoring machines are normally very expensive and I have, for a long time, been wanting to create an open-source box. Now finally here is it! The hope is that this benefits clubs out there that don't have the money to by scoring boxes for hundreds of dollars and can make this one for around $25.

All the source code, firmware and hardware designs are released under the GPL licence so it is free to use and distribute. It can all be found on the github website here.

Bill of Materials:

  • 1 x Arduino Uno or equivalent (You will need 6 ADC pins and at least 7 digital I/O pins)
  • 6 x 20kR resistors
  • 1 x Green LED Matrix
  • 1 x Red LED Matrix
  • 2 x White Matrix
  • 2 x Yellow LEDs
  • 6 x 220R resistors
  • 1 x Buzzer
  • 7 x Banana Plug Sockets (3 Green, 3 Red, 1 Black)
  • Breadboard or Veraboard

Step 1: Configuring Your Arduino

It is assumed that you already know how to upload code to your Ardruino, if not, Google is your friend.

This instructable uses the all_weapon box Arduino code. The file to be found here. Upload the all_weapon_box code to your Arduino and you are ready for the next step

If you haven't used an Arduino board before, it is really easy and there are plenty of tutorials online. Google is your friend.

I used an Arduino Nano, it is pretty much equivilent to the Uno in terms of IO and the Micro Controller Unit. Now that you have the heart of the scoring box and just need to build the rest of the circuit.

Step 2: Hardware: Scoring LEDs

I have used a couple of RGB matrices for the scoring lights. These are pretty cool because you can use on matrix for both on target and off target hits, you can also use them for the short circuit lights. Getting RGB Matrices to make colours other then RGB requires the use of PWM to control the power to each set of LEDs. Basically turning all the colours on at the same current doesn't give a white light as come colours are brighter then others at the same current.

The LEDs need to be controlled using a transistor switch as the arduino IO pins cant supply enough current to drive the LEDs properly. See the image in this step.

[Show how the LED matrix is connected up]

This is the solution that I have used for the LEDs. Feel free to come up with you own solution and please share it in the comments below if you do.

Step 3: Hardware: Weapon Change Button

The weapon mode button switches the scoring box between foil, epee and sabre. This is easy to connect up and debounce is take care of in software. The Arduino has an internal pull up resistor on most digital pins which leaves us with one less resistor to connect! Yah! Just connect a normally open push button between pin 2 and ground.

Note: Internally the code uses a interrupt to manage the button. The Uno and Nano only have external interrupts on pins 2 and 3.

Step 4: Hardware: Buzzer

The buzzer is also a pretty easy one. Just connect the buzzer between ground and pin 3. A simple piezo buzzer is good enough and can be driven directly from the Arduino IO pins.

Step 5: Hardware: Weapon and Lame Interface

The weapons are connected to the box via 4mm banana sockets. They are spaces 15mm and 20mm apart. These sockets are connected directly to the Arduino's analog pins with pull up and pull down resistors, as per the circuit image.

Note: These resistors should be around 1k ohms, much larger and you will create an RC filter with the capacitance between the 2 long wires and the pull up/down resistor which makes the hit signal from the decay slowly instead of a sharp edge. This will only be measurable with an oscilloscope. But blah. Don't worry about this, just use 1k resistors.

Step 6: Hardware: Power Supply

The power supply solution is dependent on the Arduino that you use. I used the Nano so I need to power it over the mini USB connector. The Uno does have a power jack, so just source a compatible power supply. But I prefer to do it over USB. There are a number of options with USB, power banks, wall plug USB adapters or even a computer or laptop.

A power bank doubles is pretty much a battery so you could just build it into your box if it requires a battery.

Step 7: Enclosure

We have come up with the enclosure that you can see in the images. I hope to upload a template for it at a later stage, but I encourage you to 3D print or design your own enclosure. I would love to see your idea and designs.

Step 8: How the Code Works

The Arduino code samples each of the ADC pins on each loop. It compares the read values to what is expected for the currently selected weapons and checks if it has been depressed for enough time to register a hit. Then the lockout timer is started and if the 2nd hits hasn't occurred before the time-out then the single hit is registers and the correct lights turned on.

On the Uno/Nano the loop runs about at over 2000 times per second. This allows us to easily capture the shortest possible hit, which is foil at 2ms.

For a more details about how the code works see the comments in the source files. It is well commented and it explains what each thing is doing. All_weapon_box

Again any feedback is much appreciated.

Step 9: Testing Your Scoring Box

Well the best way to test the box is to use it. Check things like hits on bell guards don't trigger hits, double hits etc.

If you want to test the timing of the box you will need an oscilloscope which can check out the signals and tell how long a tip was depressed for or the difference in time between hits for lockout. This is a very specialise piece of equipment so properly not worth it. Trust me that I have used my oscilloscope to test it properly and the timings are a function of the code and I am happy that they are FIE compliant.

If you do come across any issues or bugs please let me know and Ill update the code.

Step 10:

Well that is it folks. Please leave your feedback and ideas. Ill try and update this inscrutable with more details in the near future.




  • Barbecue Challenge

    Barbecue Challenge
  • Sew Tough Challenge

    Sew Tough Challenge
  • Growing Beyond Earth Maker Contest

    Growing Beyond Earth Maker Contest

33 Discussions

Marek Irek

Question 2 months ago on Step 5

Hi, I built this box for training using sketch of wnew, but I have a problem with detecting hits on the piste and guard as also blocking on this time of lights. The published circuit shows that analog inputs A0 and A5 should be connected to conducting parts of epee (socket GUARD) and via a resistor to ground of supply. Meanwhile, the table shows that there should be 1,7V voltage at rest . How it's possible? Is this correct? I will be grateful for tips what must to do on how to get the system working properly. I can’t find in the sketch where the A0 and A5 inputs are supported. I know electronics but with Arduino it is my first experience. Thank you in advance for help.


8 months ago

I know this is a really stupid question but if I make something like this, we can just connect our body wires to this without a reel and it will work although need a reel to actually fence, right? The power going through the weapon would be provided by the Arduino?

1 reply

Reply 8 months ago

That is correct.


Question 1 year ago on Step 8

In the code for a on target hit in foil:

if (400 < weaponA && weaponA < 600 &&
400 < lameB && lameB < 600)

What do the 400 and 600 signify, the rules say:

"The registering of a valid hit must be guaranteed when there is a break of contact
of 13–15 ms, when the exterior resistance is between 0 and 500 ohms."

So I'm struggling to see the correlation. I'm new to arduino and I was looking to build the scoring box.

3 answers

Answer 1 year ago

Hi Alistair,

The 400 and 600 are analog values of the ADC pins on the arduino, there is no correlation between this and the rules, other than that if allows us to tell if a particular pin is in contact with another pin. We read the voltage of our pins as a value between 0 and 1024, which maps to 0 and 5v. I have pull up and pull down resistors on the pins so I can tell when they are in contact this way. Sorry for the explanation, but you need to have an understanding of ADCs, pull up and down resistors and some arduino knowledge to put this in context.

Good luck building the box, please share pictures with us when you do.


Reply 8 months ago

Sorry, I still don't understand why you specifically chose 400 and 600 as the limits which in effect translates to 1.5 and 2.9 volts?

I have no background in electronics but I'm slowly making sense of it all.


Reply 8 months ago

Good question, after some testing, it turned out that these were the best values split the 5v up into 3 zones. I think this is due to the voltage drop over the long wires so the total is more like 4.5v rather than 5v.


8 months ago

Can u send the circuit diagram of this circuit....anyone plzzz quick....


2 years ago

First of all, this is a great project. Thanks for posting!

Just one question... did you try to make it wireless? I was thinking if its possible to use an arduino nano with small cell battery and a nrf24l01 directly installed on the epee cup. Do you think that would work? Thanks!

3 replies

Reply 1 year ago

A better solution would be to have a small box go in the back pocket and have the body cord go there.

So I'm currently working on a wireless scoring system project. It's a bit trickier than just adding some wireless transmitters and receivers.

You have two problems, first is detecting off target vs on target vs hitting the bell. The only way to do that is using capacitance. You'll have to measure the capacitance (i.e. rise and fall in voltage through a pull up and pull down resistor). And secondly doing the networking such that the touch signals don't arrive at the main box delayed. You also need to worry about the box getting those signals and processing that information in time. The box should light up within 1ms of a touch. That is not easy to do with nrf chips.

On the bright side it is doable, you've got favero, touche, and now leon paul. So it isn't impossible.


Reply 1 year ago

Thanks for the comments. I think you under estimate the complexities in designing a wireless system for 3 weapons. The 1st problem that you need to overcome is that there is no common ground, so it is easy to detect an off target hit, but on target is a lot harder. Basically the jacket cant send a signal back thought the weapon because there is no common ground.

The second problem is that of synchronising the timing between the 2 fencers. Here I am talking about sampling time of the ADCs. If one is more than 1ms behind the other then any lockout is worthless. This requires highly accurate clocks and a way of syncing them every few seconds.

The 3rd and probably easiest of the problems is transferring that data back to the central control unit and ensuring that the correct hit/s is displayed. This has been solved before.

It took Leon Paul long enough to implement this, dont underestimate how long it will take a lone engineer.


Reply 1 year ago

Thank you for the comment, you bring up good points.

There is a lot I didn't mention. In regards to the no common ground, I am using the rise/fall in voltage from the pull up/pull down resistors to estimate capacitance. That can give a good idea of what you're hitting. Since capacitance varies based on surface area the lame will have a much larger capacitance than the blade' s bell.

And in regards to the synchronization that's why I said networking, I could have probably explained more. One issue that can fix the synchronization is to have the slave machines synchronize time with the master after every master hit check and when a touch is scored record the current time of that hit. That way you would know when each touch landed. Now this is still simplifying the problem. It is really complicated and probably why there are only 3 working companies with scoring machines out there. Although the bigger problem isn't synchronization, that has been done time and time again, it's synchronizing (which takes more time than a desynchronized master slave sysyem) and still being able to send the data fast enough that the fencers or referee don't feel a gap in between the hit and light.


Tip 1 year ago

One other thing you can do is use a power source other than the 5v off the arduino to power the leds. The VIN on the arduino has a voltage regulator on it, and the boxes I have built use a 12v power supply to power both the leds and the board itself.


Answer 1 year ago

This will work, but you dont need the resistor below the transistor. As the current is already limited by the resistor above it transistor.

Technically is you are only driving a small LED then you dont need the transistor, but if you want to drive a light/LED that draws more current, then you would have to have the transistor otherwise you would destroy the Arduino pin.


Question 1 year ago on Step 5

Sorry. I would like to send this picture.

Sans titre.png

Question 1 year ago on Step 5


Is it the good solution?

| R
| |
12 |-----------R---Transistor
| | |

Thank you.


1 year ago

This does look like an awesome project. If I get round to making one myself, I will include code and a switch to change the buzzer sound as it's confusing in a club setting with all the boxes making the same noise.


Question 1 year ago on Step 2

Is it possible to see how the LED matrix is connected up. I'm a begginer in arduino and electronic....
Thank you very much for this very good lesson.