Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Design Problem: Electronic board game

Status
Not open for further replies.

spook

New Member
I would like to translate a classic board game into an electronic standalone board.

The boardgame is called Go (japanese boardgame) and has 19 x 19 positions (=361) which can each contain either a black or a white stones.

I would need something to notice whether there is a black/white/no stone at a certain position.
To detect this, I was concidering to attach a small stereo audio jack to each stone.
A stereo audio jack has 3 wires (tip, ring, ground). For black stones I would shortcut the tip with ground, for black stones I would shortcut the ring with the ground.
So I would plug the stones on the board.

I've been wondering if it's better to use an embedded system or a microship. My problem is that I have a huge number of inputs (361) I'm not sure how to setup a system with that many inputs.
Does anybody have experience or ideas?

In the first place it would be nice if I have the inputs, I don't need outputs per se, I could just setup a registration system for the game. In other words, the computer does not need to play, I would just use the game board to write down games in a file.

But if I was planning to use 2x19x19 (722) LEDs to let the computer make a move in the game. Then what would I need to get a system with 361 inputs + 722 outputs. I guess I can never create such a system at an affordable price ?
 
You reduce the number of wires by using a 19 x 19 matrix scanner. Thus you continually scan the rows and columns to detect the location of the stones.

You can use the same matrix type of circuitry to generate the LED outputs.

You can use address decoders to controller the scanners, thus minimizing the number of outputs required by the micro-controller.

Such a scheme may require diode isolation or other techniques at each node to prevent interaction and false indication from the unscanned nodes.

Look up matrix keyboard scanners for ideas on how to do this.
 
It might be difficult, though, to reliably tell the difference between the black and white stones.
Perhaps, but I think the black would reflect less light than white which can be translated into two distinct voltage levels.
 
Last edited:
The contrast between black and white can be less in the IR than visible, so you'd have to experiment to see how much difference there is.
 
the sensor-idea is nice. I've made a price inquiry to a company who sells them in packages of 500. (I will need lots of them)

The inside of this thing will look like a bowl of spaghetti. I'm worrying most about how to address all these inputs/outputs.

I'm not sure what would be the best option to communicate with the inputs/outputs.

About a year ago I bought a PIC18F4550 development board:
(picture: PIC USB STARTERKIT PROTOTYPE DEVELOPMENT BOARD FOR PIC18F4550 MICROCONTROLLER)
(documentation: https://www.electro-tech-online.com/custompdfs/2010/06/PIC-USB-STK.pdf)

The nice thing about PIC18F4550 is that it's great for developing USB communication. So I was thinking about using this to send the inputs/outputs to a more intelligent device (a small computer which can act as a USB-host). That way I can develop all game logic in a higher programming language (a good idea since the rules of the game are pretty complicated).

I still worry most about how to address all these inputs/outputs:
I was playing with the idea of making 1 PIC chip master that would address several child chips. Then those chips would need several child chips. And eventually every leaf-chip would address about 8 inputs/outputs. That would ask a terrible amount of chips of I want to address 722 inputs and 361 outputs.

So I assume there must be a better way? Is there something like a switch-component on the market? Something that only forwards inputs/outputs if all inputs exactly match a certain value (an address). If it's affordable (less than 0.5$) I could provide every board-position with one of these chips giving all of them a unique address. I would connect all these switch-inputs to the outputs of the PIC (master) chip. Next I can cycle through the addresses. Each chip would forward its value when it's its turn.
That would be ideal I think.

To crutschow:
About the matrix scanner idea. I'm not sure do you mean something like inside a keyboard or do you mean a "matrix barcode scanner" ? I think what I describe above is about what you mean with the decoding/encoding idea, which I like :) Thanks.
The diode isolation sounds hard to understand for me. Correct me if I'm wrong here, I think what you mean is that I should use a diode when I forward the signals back to the master PIC chip? That would be to avoid that the outputs of one switch-chip would be send to the output-pins of every other switch.

I don't have that much electronics experience ;-) as you may have noticed already.
But I'm finally making progress :p.
Thanks for all ideas by the way :)
 
To make a matrix of inputs you would wire all the row together on say the ground connection. You would wire all the columns together on one of the other connections (ring) and also on the third connection (tip).

So you end up with a larger version of this
**broken link removed**

By making one of the row lines high you can read all the column lines.

For your rows you could use 3 CD4017 chips to make each row go high one at a time and 5 74LS241 chips to read the 38 columns. To prevent cross talk in the matrix you would need to put 2 diodes in the jack to make the connections. This would require 13 pins to connect to a pic chip.

Mike.
 
About the grid:
That's great stuff mike. The drawing really makes things clear for me now. This is indeed a nice way to save a lot of inputs and outputs. Also that CD4017 chip is gold! (and still very affordable as well !)

I took another look at the PIC4550 chip again, and I think I can use the input/output pins either as input or as output.

So I could do it like:
  • 19 inputs.
  • 8 outputs.

I would connect my PIC4550 to four CD4017 chips. To each chip I'll send the clock and clear signal from the PIC4550 chip. I'll leave the ENABLE_CLOCK input on these chips high constantly, I prefer to let the PIC chip give a pulse so that I always know exactly how many cycles the counter has gone through and what column data to expect at the inputs of the PIC chip.

Each CD4017 chip has 10 cycle steps. So with 4 chips I can do the entire board in 2 colors.
  • colums 1-10 for color black
  • colums 11-19 for color black (+ 1 unused)
  • colums 1-10 for color white
  • colums 11-19 for color white (+ 1 unused)

That way I only need 4 of these counter-chips and I can control the pulse directly from the main PIC-microcontroller.

About the stone-detection:

I'm not sure about the audio jack yet. Audio jacks seem easy, but they are not that cheap. about 3$/position will result in 1000$. On top of that it doesn't exactly look sexy.

On the other hand with the photo reflector/sensor idea I think it will be difficult to process these signals because it will be analog signals. Even though I think this means I'll have to deal with analog signals instead of digital. If I remember correctly, the PIC4550 chip has only a limited number of analog inputs.

New idea: magnets
I'm concidering to put magnets inside the stones now. Are there diodes which will only let current pass if they are in a magnetic field?
I could play with this by putting magnets upside down in order to make a distinction by the 2 players of the game. Are there sensors that will only let through 1 polarization of magnetic force (+ or -) ?
 
You might see if you can find info on how electronic chess boards work. I believe they are able to identify all the different chess pieces and their location.
 
You might see if you can find info on how electronic chess boards work. I believe they are able to identify all the different chess pieces and their location.

I found the following chess project which looks similar to what I'm trying to do indeed.
Remote Chess

They are using the following sensor:
HAMLIN ELECTRONICS|59020-1-S-02-A|REED SENSOR, MINI, PLASTIC, 5MM | Farnell Nederland
... which is almost 9.36 EUR/piece so, the total would be 3,379 EUR. In the project they got them as samples.

But I had another idea last night:
I could integrate a clock in the board: Each of the players has to press the clock when his turn is over. Only 1 stone can be added/turn by the rules. So if black presses his clock, the color of the added stone is black. If white presses his button, then the color of the added stone is white.
The advantage of this way of working, is that the color does not longer matter to the sensors.
So, now I can use a light-sensor without fear. They only have to detect the presence of the stone, the color will be derived by the software.

Thanks everybody ! For all your ideas and input. I think it's time I get my hands on some chips and start doing some tests. :) I'll let you know when I made some progress.
 
To make a matrix of inputs you would wire all the row together on say the ground connection. You would wire all the columns together on one of the other connections (ring) and also on the third connection (tip).

So you end up with a larger version of this
**broken link removed**

By making one of the row lines high you can read all the column lines.

For your rows you could use 3 CD4017 chips to make each row go high one at a time and 5 74LS241 chips to read the 38 columns. To prevent cross talk in the matrix you would need to put 2 diodes in the jack to make the connections. This would require 13 pins to connect to a pic chip.

Mike.
As someone else said, you need diodes in series with each switch since there will be more than one switch closed at a time. Hence there would be unwanted short circuits without the diodes.

The diodes could be inside the stones. Black stones could have the diode connected between say the tip & ring, and white ones between say the tip & sleeve.
 
As someone else said, you need diodes in series with each switch since there will be more than one switch closed at a time. Hence there would be unwanted short circuits without the diodes.

Indeed, I've ordered leds for every intersection of the board.

Another question:
I was planning to use a photo diode to detect the stones (in combination with an IR led).
Instead of the RP-220 I've also been concidering the QSD2030F.

But now I started doubting, maybe I'm better of with a photo transistor instead of a photo diode?
Does using a transistor have advantages over a diode?

Either way, I've been wondering about the distance as well. The sensor has to detect only at a very small distance. Will I be able to adjust the reading distance by playing with the input voltage ? And is this different with diodes than transistors?

... a whole lotta questions from somebody who has no experience with photo diodes/transistors :).
Thanks in advance
 
A photo diode is faster but a photo transistor has significantly more gain (sensitivity). Since you don't need speed, you should probably go with the photo-transistor. You can always adjust the gain by varying the value of the transistor load resistor. The transistor voltage has little effect on its sensitivity. It tends to conduct a constant current (largely independent of its voltage) as determined by the light level it detects.
 
Indeed, I've ordered leds for every intersection of the board.

Thanks in advance
Note that LEDs have a reverse voltage limit. One LED data sheet I have states 5 Volt maximum. But the other one states that their LEDs are not designed to cope with a reverse voltage.

I agree with Carl's comments re photo diodes versus photo transistors.
 
Last edited:
Hi again,

I received most of the prototype parts and have been doing a lot of tests.
There's one big issue at the moment.

When the photodiode is idle it has about 50kOhm due to room light.
When I move my hand on top of it, this increases to 200kOhm.
So far so good.
But also the current (I) decreases terribly, and as a result the expected voltage increase is rather low (only 0,15V).
Of course that's not enough, it's is not a good input signal for the microchip.

How does one usually solve these kind of problems?
I tried putting a capacitor in parrallel with the sensor, in order to increase the current.
But this doesn't seem to do the trick, or I'm using the wrong kind of capacitor.

Any thoughts?
 
Put a 1k resistor in series with the diode, power it with 5V and measure the voltage across the diode in light and dark.

Mike.
 
A couple of ideas:

- According to some websites I could fix this with a transimpedance converter. It just looks like a bit like an expensive construction.
- I've been thinking about using Analog inputs in my microchip instead of digital inputs. I think this will allow me to pick my own reference point. I'm just not sure how analog inputs work yet.
- Some websites claim that a photo transistor with 3 leeds doesn't have this problem. I'm currently using a photo diode (only 2 leeds). They say that with 3 leeds the current won't decrease as much, resulting in a higher voltage.

I think transistors would be the best solution after all ?
 
A capacitor will have no effect on DC sensitivity. Capacitors affect AC signals, not DC.

A transimpedance converter is useful for low level analog signals. It's not needed here.

As I stated in my previous post, photo-transistors are more sensitive and would likely work better in your application. Some photo-transistors have three leads, with one lead connected to the transistor base for adjustment of the sensor's gain and speed. You probably can just leave the base open. You can experiment with the resistor value in series with the collector to determine what value gives the desired signal voltage change.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top