Hi all,
I have started looking into electronics after over a decade since I last touched it, with the idea of making a chess board which automatically detects the moves made on a chess board. I will be using a Raspberry Pi inside of it as it should be powerful enough for any future features I add, and I have a few laying around.
My idea is to have a magnet under each piece, one polarity per color, and use a matrix of Hall effect sensors (one sensor per square) to detect if I have a piece on a square or not, and its color. I can deduce the move made in that case provided it was a legal move by using the rules of chess (already have written a library for that).
I guess my first question is: is APX9141 the right sensor for the task? I can see it has two outputs, one per polarity, so it looks promising!
If so, I was wondering how I could wire an 8x8 matrix of these sensors to get the state of the board. My current idea is to use 6 GPIO pins (3 to specify the desired column and 3 to specify the desired row) as inputs to the detecting circuit and 2 GPIO pins to read its output (one pin per color).
I was thinking of using a 3:8 decoder to power only the row I am interested in. Then each row passes that power as Vcc only the sensor for the column we are looking (using another 3:8 decoder per row), and I OR the north outputs together and the south outputs together to get 2 bits of output per row (one per color).
I would then OR the white ouptut and the south output of each row to get two output signals, one indicating if there was a white piece in the (r, c) square and the other indicating if there was a black piece in the (r, c) square.
Is this a reasonable approach? I can see it is based on the assumption that a sensor whose Vcc and GND are put to ground will output low and not a random value, not sure how reasonable this assumption is!
I can probably spare a few pins, so I'd be happy to go with other approaches which use more pins if they are easier! I guess I could read a whole row in one go and place the read in a shift register, I am not sure if that would draw too much current from a pin though.
Thanks in advance
I have started looking into electronics after over a decade since I last touched it, with the idea of making a chess board which automatically detects the moves made on a chess board. I will be using a Raspberry Pi inside of it as it should be powerful enough for any future features I add, and I have a few laying around.
My idea is to have a magnet under each piece, one polarity per color, and use a matrix of Hall effect sensors (one sensor per square) to detect if I have a piece on a square or not, and its color. I can deduce the move made in that case provided it was a legal move by using the rules of chess (already have written a library for that).
I guess my first question is: is APX9141 the right sensor for the task? I can see it has two outputs, one per polarity, so it looks promising!
If so, I was wondering how I could wire an 8x8 matrix of these sensors to get the state of the board. My current idea is to use 6 GPIO pins (3 to specify the desired column and 3 to specify the desired row) as inputs to the detecting circuit and 2 GPIO pins to read its output (one pin per color).
I was thinking of using a 3:8 decoder to power only the row I am interested in. Then each row passes that power as Vcc only the sensor for the column we are looking (using another 3:8 decoder per row), and I OR the north outputs together and the south outputs together to get 2 bits of output per row (one per color).
I would then OR the white ouptut and the south output of each row to get two output signals, one indicating if there was a white piece in the (r, c) square and the other indicating if there was a black piece in the (r, c) square.
Is this a reasonable approach? I can see it is based on the assumption that a sensor whose Vcc and GND are put to ground will output low and not a random value, not sure how reasonable this assumption is!
I can probably spare a few pins, so I'd be happy to go with other approaches which use more pins if they are easier! I guess I could read a whole row in one go and place the read in a shift register, I am not sure if that would draw too much current from a pin though.
Thanks in advance