I want to do something with a chess board and for that i need to connect 64 LEDs and 64 hall effect sensors to an arduino mega. For the LEDs i want to use LED strips or 74HC595 shift registers, but I can't figure out how to handle the sensors. Is there a way of multiplexing them or building a matrix somehow?
If the hall effect sensors have a digital output, you can use shift registers. If the hall effect sensors have an analog output, you can use a cascade of multiplexers.
I have seen this done before and you may have an easier time using photosensors and remembering where the pieces are.
The complication is detecting when two pieces are simultaneously raised - if not detected, they can be swapped. Oh, and have photocell 65 sense the ambient light so that the threshold can be adjusted appropriately.
If you use reed switches instead of the hall sensors, you could arrange the 64 LEDs and 64 reed switches in a matrix. Use 74hc595 to source current to the led rows, 74hc165 to read the switches and tpic6b595 to sink current from the columns. You will need a small diode (eg. 1N4148) in series with each reed switch, 10K pull-up resistors for the '165 pins, and 390R series resistors for the '595 outputs. And a 0.1uF bypass cap for each chip. The '595 cannot source more than around 8~9mA per row, but if you chose high brightness LEDs that should be enough.