2013 update: Jörg Janssen contacted me via email -- he built one of my box, updated the source code, and found a bug or two. Jörg says: "First, I happened to find what seem to be some discrepancies between the schematic and PCB layout; furthermore in the PCB layout, two resistors appear to have been swapped. I have therefore appended a corrected schematic and the corresponding PCB layout (which now also contains a ground plane), together with the CadSoft Eagle project that I used for preparing them. Further, I am also sending you the adjusted code for the microcontroller - I used a PIC16F627A instead of the now obsolete PIC16F726-P/10 - for compatibility with current compilers and to reflect FIE regulation changes in 2004 for touch and lockout times." You can find Jörg's files here.
In 2001, a friend and I decided to have a go at producing a fencing control box. (Note for non-fencers: in electric fencing, each fencer is connected via cable back to a central control box, which beeps and flashes coloured lights to signify a hit.) The solution presented below is our second attempt. It is, to the best of our knowledge, FIE compliant for foil and epee. It does not support sabre.
We went for a two-chip solution, making the box simple and cheap. One of the chips is a Microchip PIC16F627, a microcontroller; which is to say, a tiny computer, complete with program memory, data memory, I/O lines, the whole bit. The second chip is a serial-to-parallel chip, used to expand the output capacity of the microcontroller. These chips (and indeed all the necessary parts) are quite easy to source from somewhere like JameCo or Altronics or whatever.
We are releasing this board and the microcontroller code under the GPL, so you can make your own from our design, and you can even sell 'em, if you are so inclined. The low cost makes the box suitable for club use or even personal use; though the small lights, lack of extension light socket and lack of official FIE certification makes it unsuitable for use in national or international tournaments.
Here is a schematic, PCB artwork, diagram showing how to populate the board, C source code and object hex file, ready for loading onto the chip. For printing, note that the artwork is at 300dpi.
LEDs come in a variety of package sizes, viewing angles and brightnesses. Wide viewing angle is good. Bright is good, but due to the cheaty way that LED brightness is specified (looking only from directly front-on to the LED), you will sometimes see very very "bright" LEDs with a very narrow viewing angle. Don't buy these. You want a viewing angle of at least 12 degrees, and wider is better.
You want LEDs that are vaguely matched for brightness, and your white LEDs will probably be the limiting factor. So see what brightness white LEDs you can get for a not-unreasonable price, and pick the rest of your LEDs to be no more than 10 times this bright. (The blue LEDs you only have to see close up, so it doesn't matter if they're dimmer than the rest.) You may find that your white LEDs cost more than the rest of the LEDs put together.
You can buy any size of LEDs you like: 3mm, 5mm, 8mm, 10mm. Bigger is nicer. Different sizes is OK, though it'd be good if the red and green were the same size.
If you like, you can buy half as many LEDs of each colour: you can load either one or two LEDs at each position in the board (except for the blues). Two is better than one; it gives double the brightness, double the viewing area, and makes it easier to trouble-shoot problems. If you buy less LEDs, you can buy less resistors, too; but the cost of resistors is trivial.
The hardest two items on the pick list are the first two: the PCB and the programmed microcontroller. There are a number of ways to do your own printed circuit board:
After you've printed and etched your board, you'll need to drill it. The best kind of drill to use is one that is relatively low-speed and light-weight. A 7.2V cordless would be good. A drill press would be good too, if you can get access to one.
If you use a high-speed drill or a Dremel, the tip of the drillbit may overheat. If you see any blackening or smell any burning, keep a small container of water handy, and dip the tip of the drill bit in it as required to cool it.
As you drill, make sure you keep everything straight -- if you flex the drill bit while drilling, it will snap.
When drilling the holes for the chip, you may wish to use a bit of Veroboard or stripboard with pre-drilled holes as a template. Or just eyeball it. :-) If you Dalo-penned the board, you'll want to use Veroboard as template for the chips and the LEDs.
The other tricky component is the microcontroller. You'll need a programmer board like one of these. (I've got the Kit-96, but newer kits might be niftier.) You'll need loader software, like PICALLW. If you want to change our code, or compile it for yourself, you'll need a compiler, like this really nice one. The loader and compiler are free for the sort of use we're putting them to; but the programmer board isn't.
The alternative approach would be to ask me nicely. It may be that we can work something out along the lines of me programming chips and sending them to you.
Once the holes are drilled, it's time to start loading components and soldering them into place. Solder wire links and low-profile components first, and bulky components last. So the resistors, chip sockets, crystal and wire links go in first; and the big LEDs and capacitors go last. For the chip socket, solder in two diagonally opposite legs first, to hold it in place while you do the rest. Soldering in general may be easier if you have the board in a vice.
The resistors can go in either way around: they're not polarised. But since I'm kinda obsessive, I tend to load them all with the tolerance band (the brown or gold band by itself at one end) down, or to the right. The small 33pF capacitors aren't polarised either; Captain Obsessive says insert 'em so that the text on them will be readable in the final assembled board. The push-button is polarised, but the board is designed so that we don't care.
Pretty much everything else on the board has to go on a particular way around. In general, the board has little '+' and '-' signs marked to show you which way in things go. The 7805 goes in such that once it's lying down flat on the board, the text on it will be face up -- see the picture below. The 18-pin chip socket goes in such that the little notch at one end is nearest the crystal. The 16-pin goes the other way round; so that its notch is furthest from the crystal. LEDs often have a shaved flat side on the rim that shows you the side that goes towards minus. (Minus is towards the bottom of our board.) If they don't have a shaved flat side, then the short leg is the side that goes towards minus. Nearly almost always.
If you get the 7805 in backwards, it will probably get very very hot when you power the board up, and not work. Ditto with the microcontroller. Once you swap it around the right way, though, it should be fine. Powering up the micro backwards might corrupt the software, so you might have to erase and reprogram it.
If you get electrolytic caps in backwards, they may explode. Really. I am not making this up. So be sure you get this right. The minus side of the cap is usually marked with a black band with minus signs in it, and arrows pointing to the minus side of the cap.
The big electrolytic cap may look neater if it is laid down on its side. Depending on how you are planning to package the final product, this may be necessary in order to reduce the capacitor's height to less than that of the push-button.
There is unlikely to be room for the piezoeletric buzzer on the front of the board; so solder it on the back. I've given you a range of solder pads for it, so it doesn't matter exactly how far apart the legs on your piezo are; you're likely to be able to find holes that fit. Or get one with wires tailing off it; then you can solder the wires to the board, and glue the piezo inside the box.
You may want to put a heatsink on the 7805 voltage regulator. If you're running from a relatively low voltage source, say 9 to 12V, you're probably OK; but if you're running from a higher voltage supply, a heat sink is good. (Nothing bad happens to the board if the heatsink gets too hot; eventually the regulator just shuts itself off. But it's easy to accidentally burn yourself on a hot unheatsinked component.) If you heatsink it, you should use a little thermal transfer goo, too. You may wish to drill a hole through the board at the marked point and bolt the regulator down; or not. Use a nylon bolt, so it doesn't short to something important on the back of the board.
Here's a pic of the assembled board. The piezo buzzer is soldered onto the back, so you can't see it.
Now it's time to put the board in a nice case. Most fencing control boxes are installed in as flat a box as the designer can manage; but I don't see why. Installing in a nice deep box makes it less likely to fall over.
You'll need a box with enough height and width to fit the board, and whatever depth you happen to get. Some cases come in two halves, in a sort of clamshell design; some come with a box which forms five sides and a lid which forms the sixth. Either style may be suitable, though many clamshell cases will not stand up nicely on their long side. Make sure you get a case with suitable mount points to hold the board.
Now, how do we make the LEDs visible from outside the box? There are several options:
The throw-away-the-lid option can work nicely with some clamshell cases; sometimes you can use each half of the clamshell to form a complete case-minus-lid, and then of course you add your own perspex lid.
You'll need to mount connectors on your case: three banana plug sockets for the ground leads going to each reel, optionally one or two more banana plug sockets for piste ground lines, and a power socket. Each of these things can be panel mount, which means the socket screws onto the side of the case, and you run wires back to the board; or PCB mount, which means that you solder the connector direct to the PCB, and drill a hole in the case to allow access from the outside world. Me, I prefer PCB mount, but PCB mount banana plug sockets are hard to find, and the case has to be a pretty exact fit to the board.
You may not wish to put a power socket on your box -- you can instead direct-connect your power supply to the PCB. It doesn't matter which way round + and - go; that's what we have a bridge rectifier for. :-)
Lots of fencing control boxes put the connectors along the top, but I don't like this -- again, they make the box more likely to overbalance. I recommend putting the connectors on the sides, with the big ground lead connectors as low on each side as they will comfortably go.
You'll also need to drill a hole for the push-button. A 10mm hole is big enough if you can drill the hole in exactly the right spot; so start with 10mm and go bigger if you need. The depth at which your board is mounted in your case now becomes relevant: ideally the board will sit 15mm or less behind the front of the case, so that the LEDs fit inside (if that's the way you're doing it), but the push-button is still reachable. The top of the push-button is about 14mm above the board.
Here's a pic of an assembled box. You can see I've used a big rectangular case, and drilled oversized holes for the LEDs and pushbutton. The panel-mount banana sockets for the red fencer are visible on the left. The PCB is mounted in the box by cutting the board to be the exact correct height for the box, and cutting channels in the ribs in the top and bottom of the box. This is visible in the pic of the assembled PCB, above.
As you read these instructions, you'll probably think at some point, "But how do I...?" It is entirely possible that you are thinking this because there is something that I have neglected to explain. So if you have questions, please ask -- it'll help me improve this document.