Design with Hall Effect Sensors

by Brian

Comparing Reed switches and Hall Sensors

Reed switches work really well, but can be difficult to work with, because they are so fragile. Also if you mount them horizontally then it is a bit hit and miss with piece detection, because the magnet actuates the reed at either end but not the centre of the switch. This problem can be eliminated by mounting the switches vertically, and this I have done very successfully with my previous board.

The hall effect sensors are more robust,and easy to wire up with 1 wire connected to all 64 5v pins, a second to all 64 0v pins then the last pin of each sensor connected to 64 inputs of the 4, 16 to 1 analogue mux’s. no diodes are required. For piece detection only it can be programmed to work identically to reed switches.

Design using Hall Sensors

I wanted to experiment with actual piece recognition using hall effect sensors, the plan was to mount magnets on the pieces with different polarity for white and black, then varying the gap for the 6 different piece type.

Because the magnet needs to be directly over the sensor for a reliable reading I found that 10mm magnets were just too position dependant, so I moved to 25 mm diameter magnets and this worked much better. As long as any part of the magnet is over the sensor the reading stayed relatively constant.

Because the magnets are so big, I decided to use a big set that I cast myself using moulds and plaster.

But  found it too difficult to mount the magnets accurately, so these pieces have the 10mm magnets cast inside them, and this board works fine as piece detection only.

I plan to make different thickness stands for each piece with the 25mm magnet fixed to the bottom of each piece, with the stand varying the gap between the magnet and the board.

Observations from Experimentation

The Arduino readings from the sensors vary from 200(max northpole) to 500(nomagnet) to 800(max southpole) depending on gap and polarity, but all sensors are not identical so I scan the board with no magnets and store the results. then monitor the difference when magnets placed.

Also it is tricky to choose the best gaps so there is no overlap between caused by variations in the sensors.

To play a game is not optimal because the piece recognition is not perfect (yet, I’m still working on it). but it is good enough to set up a position while monitoring the board on the pi. and is certainly good enough for playing a game using just piece detection.

Picochess

Picochess is opensource chess system written in Python for DGT boards.Buttons are used to select from 8 engines, levels, time controls, opening books. score, hint move, take back.

It also includes speech (in multiple languages) and a web server to display the board remotely.

I modified it to work with my Arduino based board and added the board display for  the raspberry pi screen.  The Arduino  sends move information and control button presses.

My modified version of Picochess can be download from

https://github.com/Ernisius/Picochess-nonDGT

The Arduino code is for my reed board only at the moment.