I'm not sure if this is the right place to post this but here goes.
So, as the title states, I'm planning on building a desk that doubles as an air hockey table which has a robot on the other side.
The robot would be mounted on a rail which should be able to go left and right using a linear actuator. It should be able to "attack" the puck using two servos.
The real problem is how should I detect the puck's location?
My idea:
Since the table would have tiny holes in the corners of a every square(0.5inx0.5in), I could fit in a laser on the bottom part of the table, a laser for ever 1in so a 1inx1in square, the same location would be reflected on the "ceiling" of the table but instead of laser diodes, they would be replaced by an ldr.
So I'm planning on doing a matrix and reading the signals of the ldr's columns and rows then performing some logic to locate the center of the puck.
PROBLEMS:
While I don't see any performance flaws in my plan, I see tons of flaws when done imperfectly even to the tiniest bit.
- I have to be exactly accurate regarding the laser diode's position, it has to be on the center of the holes, right below the z-axis. This should be easy if I'm just going to place 4 or 5. But I'm not.
- According to my estimations, I'm going to have to use 300-700 laser diodes, depending on if I'm planning on putting the lasers only on the opponent's side or on the entire board. It would definitely be costly. Imagine 300...
- This isn't really a huge problem, more like a hassle. Wiring 300 of these. Forget the pcbs, the project area is just to large.
I have thought of numerous way to lessen these, like using a color sensor to get the x-axis location and a laser situated on a negative x-axis pointing to the positive x-axis to locate the puck's y location, but I'm still comparing ideas.
Advantages:
I could get a 3d-like graphical representation with 3d-like controls (3d-like in reality but technically 2d since the lasers are only plotted in the x and y axis though facing the z-axis).
Since this project is going to be my room desk, situated in an automated room, I was thinking of making "desk modes" which should toggle between a game that takes advantage of the lasers and their controls, A control desk for my room, ordinary desk mode, and an air hockey mode.
My question: (More like a request)
Does anyone have another idea regarding how I should be able to locate the puck's x and y location accurately in real time?
EDIT: The table is roll-able and stored underneath a loft bed which has an under-area height of 5'4". Which means I can't go grande on the a vertical solution.
EDIT #2: Thanks to the helpful people here, I have come to the conclusion of using a camera.
The camera will be that of a smartphone's, I'll create an app that tracks an object by color and a has fixed size comparison to identify the distance of the robot from the puck. The phone will then process this and send signals via bluetooth.
The phone is anchored at the end of the robot's moving part so the camera is reminiscent of those games with a first-person view.
Incoming problems: I'm looking forward to some delay, given the delay in processing.