I am trying to make a Battleship game using the Arduino but am having a hard time thinking of a cost effective way to detect inputs. I hope to use a pegboard type setup that is used in the Milton Bradley version (though likely 2x as wide/long). The general idea would be to have two "consoles", each having two 10x10 pegboards. (so 200 inputs and outputs for each console). I want to be able to detect when a passive peg is placed in a hole and be able to light up the hole (with peg in and peg not in). However, any idea I have is either too complex or too expensive. I realize this may just be impossible to do under a given cost, but I wonder if anyone has any ideas.
Some thoughts I had:
Have a pushbutton in each hole, and when you put the peg in, you push until you hit the hole (too expensive)
have a grid of non-intersecting wires (10 wires for rank, 10 for file). When a metal peg is inserted, it completes a circuit in the wires. I would then go through each row, activating the wire and detecting which columns go high. I'm not sure if I could get the mechanics to work on this (ensure proper contact)
Use a camera (a la nintendo labo) to detect when a peg is inserted (the camera could be internal to the console). This seems too difficult to calibrate and implement
Use a few microphones to triangulate where the noise from insertion comes from (not sure I would have the accuracy to do this, and I assume the math could get difficult)
Have photodiodes throughout (but maybe not 100 of them) and detect when the light changes based on peg in/out. This actually may be feasible, but error prone, I think I would have to recalibrate a lot.
Have photodiodes throughout (but maybe not 100 of them) and detect when the light changes based on peg in/out. This actually may be feasible, but error prone, I think I would have to recalibrate a lot.
Not that bad a solution.
I was thinking about LDRs. Photodiodes may not be the best solution, look at phototransistors instead (e.g. the TEMT6000). Like an LDR they only need a series resistor. LDRs are very cheap; phototransistors are much more expensive.
Paired with a suitable resistor they can be read as digital signals, just like buttons. As the peg will placed on top of the LDR you won't need that much ambient light to have this working.
I was thinking Hall sensors. $15 for 100,
and you would need 100 tiny magnets, another $10
My experiance with tact switchs is that they have some spring so may not change state, but just register a momentary press.
but that brings us back to the method of sensing for the game.
if you use charlie-plexing, you would not want a switch to change state, but only a momentary.
so the technology of sensing and the interface to the inputs need to be compatable.
Switches always have some spring - they need a minimum force to be pressed. You can not sense whether a peg is in place, only that it's being placed if the player presses it down hard enough. You can also not sense a peg being removed, not that this is an issue with battleship, it is with other games.
Magnets sounds like a good solution as well. For multiplexing a reed switch may be more suitable than a hall effect sensor. I don't see an easy way of multiplexing the outputs of those sensors.
How about a matrix of photo interrupters (cheap on ebay), then the depth / omentary penetration, or magnet isn’t a problem.
if the pin is in the hole, the phototransistor outpur is high.
Scanned as a matrix = solution.