Monday, 20 January 2014

Hall sensors have it

It's been a long time since we first came up with the idea of a digital board game, and dismissed hall effect sensors as too expensive. But here we are, months and months down the line, and we're no really much further on.

We've tried different ways of detecting playing pieces above a playing surface (inductors, capacitance, pin-to-pin contacts, copper tape, custom keypad membranes, magnets, washers and ball-bearings) but they've all generated problems in one way or another. So we're right back where we started, only this time we're concentrating on getting a consistently working board game, rather than focussing on the price point first.

About 18 months ago, we were dubious as to whether a board game enthusiast would be willing to drop a hundred quid on a playing surface - no matter how cool or clever it might be. But with the recent explosion of board games and table top gaming on Kickstarter, it's becoming obvious that people are willing to pay a premium for new and interesting ideas. There are games launching with a rulebook and a few dozen miniatures for over a hundred pounds - all of which leads us to think that we should just make our electronic board game and stop worrying about the price!

So all that said, it's time to see if hall effect sensors are any good (after all, we've investigated and dismissed pretty much every other approach we've tried!)

Our hall sensors arrived from Farnell this morning, so we knocked up a quick SOT-23 breakout board and tested one with a simple LED. We're using 2xAA batteries for a 3v source, connected to pins 1 and 2 of the hall effect sensor. The LED is connected to the 3v supply and the cathode to the output of the hall effect sensor.

When activated, the output of the sensor goes low (it's an open collector connected to ground) which in turn makes the LED light up. We tried the sensor out with one of our playing pieces, with a tiny 3mm neodymium magnet embedded in the base.


Some of our pieces have one, offset-from-centre magnet, some have two.

What we noticed during testing was that the tiny magnets activated the sensor when placed directly over it, but the "hot spot" was very small - by rotating the playing piece, it was possible to get the LED to go out, even when the piece was placed such that we wanted the sensor to continue to detect it. Although this was encouraging, we really need the board to sense the playing piece when it's placed roughly in the centre of a square, irrespective of which way around it's facing.

Now some people say that hall effect sensors become more sensitive at higher voltages. So we tried the same thing but with a 5v supply (note the PIC programmer in the later video, providing 5v from the laptop's USB port). The LED lit up more brightly, but the sensor was no more sensitive than before. What we need is a bigger magnet!

Luckily, we have some larger, 10mm x 1mm disc magnets. These worked much better. Once the sensor was activated, it remained switched on until the magnet was removed - rotating the magnet made no difference to the output. 

When we last worked with larger magnets, we had the opposite problem to the one here - as a piece was lifted off the board, multiple squares detected the presence of a "ghost piece" as it floated over the top of the playing surface. The magnet was so strong as to activate a "cluster" of up to 9 squares at a time, as the playing piece was lifted up and moved over the board. So we needed to devise a test to make sure that wasn't happening again.

The LED in this video lit up much more brightly than the previous one - it's just that we've had to turn on the backlight on the camera (it was getting dark) so it doesn't appear anywhere near as bright. It is, though, honest!

This time we had exactly the result we were looking for!
The playing piece activated the sensor up to 5mm or 6mm above the board, but the magnet wasn't so strong that it could activate nearby sensors inadvertently. As the playing piece is moved away from the centre of the square, the sensor shuts off as expected - but with enough room to allow the playing piece to be rotated or moved slightly off-centre without affecting the output.

We quite like the single-sided, copper-side up approach of earlier designs. Keeping the mcu on the underside is nice but not critical (there's no reason why we couldn't put a surface mount SOIC style chip on the top and cut a hole for it in the mdf layer). But our board edge connectors are critical - and the through-hole versions of these work really well (plus, we've not found any surface mount alternatives to these, if everything went SMT). So we're quite happy to stick with through hole components, and keep the mcu and connectors on the "bottom/underside" of the PCB. This does mean, however, that we need our hall sensors on the same side as the copper (so through-hole versions won't cut it). Which means using SC59/SOT-23 style SMT versions of the hall effect sensors.

So here's a PCB using SMT hall sensors


Hopefully we can get this etched and assembled tomorrow - and who knows, we may even end up with a working electronic board game! Hang the cost, let's just get it working!