9x9 Photocell Grid

I’m looking to detect if a game piece is on a certain spot of a game board. There are 81 possible locations, and I would like to do this by detecting the ambient light in the room. If a piece is on the sensor, no light will come through, and if not, light will go into the photocell.

Eventually, this will need to expand to a 19x19 grid. (Anyone a Go Player?) Knowing that I will need to be able to read the values of 361 sensors, I need the following:

• An inexpensive sensor. I don’t care if it’s a photoresistor, phototransistor or photodiode.
• I only need to detect on/off states, not intermediate values. Should I be using something that gives me a simple on/off signal instead of analog input.
• It’s a casual board game, it does not need to be super fast response times.

My initial thought would be to operate the sensors in a way very similar to how an LED cube would work. I could read a single row at a time, and turn the columns on/off by changing the ground. Does this sound reasonable? Is there a better way?

That is going to work if you know in advance what thresholds will work and you can condition those signals to come through as digital high and low.

I would look into using an analog multiplexer chip to bring all those signals into an Arduino analog input. More costly on chips but you don't need a transistor at each sensor to amplify the signal up to the digital levels.

An LDR and a suitable resistor at each station should work, with a digital input. No need for any other components.

The hard part would be to find a resistor appropriate to the light levels in any room where the game will be played. Get that to work first with a single LDR/resistor combination before considering an array of them.

To multiplex a 9x9 array will be an interesting challenge. A straightforward design could use eleven 8 bit shift registers in series (to ground 81 LDRs) and 1 to 9 digital inputs, but there are many other possibilities.

Thank you for the reply!

Obviously there are several options, and I'm doing my best to narrow them down. I've been able to find a resistor that works with different light levels with a single LDR for analog readout. Basically, when I do an analog read, if it's greater than 500, there's no piece on top of it.

Are you suggesting trying to get that threshold to a digital (1/0) signal? I'm not sure how I would do that calculation, but that would be awesome.

If I cannot get it to a digital signal, could I still use a method similar to an LED cube, but for analog inputs?

I also need to hook up a 10x10 grid of LED's and I'm quickly running out of pins on my UNO.

Or, would something like using a capacitor with timing work better? (Like mentioned in the Bonus section here: Overview | Photocells | Adafruit Learning System)

Are you suggesting trying to get that threshold to a digital (1/0) signal? I’m not sure how I would do that calculation, but that would be awesome.

Yes. The threshold for “1” is given in the Electrical Characteristics section of the data sheet as Input High Voltage, 0.6 or 0.7 Vcc, depending on Vcc range.

You could try the method described here but with the diodes suggested in one of the replies (not shown in the image below).

Would it have to distinguish what kind of piece is on it?
What is the microcontroller going to do with the information?

Yes, it needs to know which area. I need to be able to tell if a piece is on one of the 81 sensors, and then it will send that board state to a phone via BT.

I will also need to identify a spot on the board. (A spot is considered an intersection of lines) Instead of putting the LED's on the line (which would mess them up), I put them in the center spots. When I want to highlight a location, I highlight the 4 LED's around it.

I've attached a picture of my board for reference. I used photocells for this one, but if diodes will work better, I can make another.

This is for the board game Go, one of the oldest board games in the world. The game is traditionally played on a 19x19 board, but I wanted to start smaller, because 361 sensors would have been crazy!

I'm currently tackling the LED lights, and debating if I should hook them up in an LED cube type order, or if a few shift registers will do the trick.

For the sensors, I'm leaning towards some Analog Multiplexers, but definitely open to suggestions here.

I appreciate all of the helpful feedback!

Alright, the 10x10 LED grid is in and working! Each one is individually addressable by using a method similar to an LED cube. I've also got Bluetooth working with an nrf8001 breakout board.

I'm still coming back to the sensors now. Is there a way to arrange a standard CdS photocell in a similar pattern. @DaveEvans based on that link, it seems like it could work with an additional 81 Diodes, but I'm not sure that I understand it well enough to build it.

Perhaps I should just use some analog multiplexers and measure each of the 81 sensors?

How about magnetic board pieces and a small hall effect sensor or reed switch? Guaranteed to have a digital response.

Otherwise LDRs should work indeed. You can easily read them as digital inputs here. Use them in series with a resistor (10-50kΩ probably). I just tried an LDR under my desk light: 8-10k when exposed to the light, about 100k when not. So with a 30kΩ pull up resistor and 5V Vcc you'd go from 1.25V when lit (definitely a LOW) to 3.8V when dark (definitely a HIGH). In brighter light your LDR will have lower resistance so the voltage on the pin drops even further. If you design your board well your pieces will cover the LDR better than my finger in this quick test (no stray light from the sides, for starters).

You could use three shift registers on one side to select the row to read, then another set of three shift registers to read that whole row in one go. That would be the fastest. Doing >10 scans a second should be no problem, assuming the inputs can react fast enough with such a high input impedance.

No matter what that's a lot of soldering involved :slight_smile: