Software Fencing Score Box

I have just started a new open source project to create a fencing score box system.  The idea is to use an old laptop or other low cost system to emulate the hardware of an electric fencing score box.  My son has been competitively fencing for just over a year now and I have been looking for an affordable way of enabling him to train at home.  The best value for money system I have come across is the one used by his coach, the Epee Hitmate.

However, that is still somewhat out of our price range at present.  As a result, I have started investigating the possibility of emulating the control box hardware with software and then interfacing this to the actual weapon switches.  The ideal solution would be to connect wirelessly to something like the HitMate’s transmitter units, but failing that a conventional wire spool connection would do.

I have also noticed that fencing referees are increasingly using smart-phone apps to run bouts and I thought it would be an interesting exercise to see if a smart-phone could be used as a remote control for such a project.  To avoid having to develop a version for each OS, I decided to embed a small webserver so that any mobile browser app could be used as the controller.  The screen shot below shows this running on an iPhone simulator:

iPhoneBrowser

For those unfamiliar with fencing, the basic information is quite simple:  there is a score for each fencer, one to the left of the referee (red) and one to the right (green) and there is also a count down of the time remaining in the current bout.  The buttons enable the referee to start and stop the timer and adjust the scores for left and right.

The main program is a conventional application written in FreePascal.  This can be compiled to run on Linux or Windows (and possibly a Mac as well!) and has no external dependencies, although you can add an optional WAV file if you want a buzzer to sound during a hit. The following screenshot shows this running on Linux :

RaspberryPi

In fact, the keen eyed amongst you will probably have noticed the little perspex box and realised this is actually running on a Raspberry PI!  This was compiled with the PI FreePascal compiler I created last year.  To be honest, I haven’t done anything with the RPI since then as, until now, I had not thought of a practical use for it.  However, the PI is actually an ideal platform for this project.  Also the world of FreePascal on the PI has moved on tremendously and there really isn’t any need to build the compiler from source now.  Further more, Thaddy de Koning has created a Pascal interface for the PI’s OpenVG library, giving access to the powerful GPU for 2D graphics.  This will go a long way to compensate for the PI’s somewhat underpowered CPU.

So if you would like to take a look at this project, it is available on Bitbucket:

https://bitbucket.org/PaulFMichell/allez/

A pre-compiled windows binary is available here:

https://bitbucket.org/PaulFMichell/allez/downloads/Allez.exe

If you want to test the embedded webserver it  connects on port 8080 to aviod clashing with any other webserver that might be running on the default port 80.  So to access it on the local machine requires the following URL:

http://localhost:8080/

This is still very much a test system and it is a long way from being a completed project. However, it does demonstrate some of the capabilities of FreePascal and will serve as a good starting point for a more focused endeavour and if there are any Fencing – Electronics – Raspberry PI enthusiasts out there who have any bright ideas about linking the weapon switches, I would love to hear from you!