How to sense the position of a ball?
Christof Eb.
Posts: 1,197
Hi,
since some long time I am wondering, if something like this:
https://www.amazon.com/Micord-Original-Wooden-Labyrinth-Solitaire/dp/B01M25QHJG
could be controlled by a microcontroller, perhaps P1?
The motion shall be done by two servos motors.
But what is the most easy way to detect the position of the ball?
The ball shall have a diameter of 6...12mm and could be made of wood, glas, steel....
The board shall be made of plywood, bores have to be applied.
The position must be known with perhaps 5Hz and perhaps 1mm/150mm accuracy in two directions on the plane. Calibration regarding linearity would be possible.
So I would be grateful for ideas, how to measure this!
Thanks in advance!
Christof
since some long time I am wondering, if something like this:
https://www.amazon.com/Micord-Original-Wooden-Labyrinth-Solitaire/dp/B01M25QHJG
could be controlled by a microcontroller, perhaps P1?
The motion shall be done by two servos motors.
But what is the most easy way to detect the position of the ball?
The ball shall have a diameter of 6...12mm and could be made of wood, glas, steel....
The board shall be made of plywood, bores have to be applied.
The position must be known with perhaps 5Hz and perhaps 1mm/150mm accuracy in two directions on the plane. Calibration regarding linearity would be possible.
So I would be grateful for ideas, how to measure this!
Thanks in advance!
Christof
Comments
The video below may offer some ideas on tilting the board with servos.
Yes a camera seems to be a possibility!
Metal detector coils
Sensing the weight of the ball
Shift of resonance frequency
Shadow on the walls
A moving sensor. Rotating
Antenna
?
-Phil
Yes - if possible use a Parallax Product, and in this case you will have excellent support from some forum member which name I currently not remember, has something to do with Pi.
Enjoy!
Mike
How about a repurposed touch screen. Available on e-bay
Dave
You could also theoretically put the table on three load cells and interpolate the weight change, but I think the operation of the tilt table would create too much noise. I have some feel for this since I work on weighing equipment in my IRL job.
I would follow frank freedman's suggestion to use steppers for X and Y axes because steppers provide precision and repeat-ability. IMO, (and it's only an opinion), achieving absolute level would also require two adjustment screws.
https://openmv.io/collections/cams/products/openmv-cam-h7
OpenMV is headed by Kye who used to be an intern at PARALLAX and helped develop the CMU4 camera:
http://www.cmucam.org/projects/cmucam4
They just got finished with a kickstarter and are selling now. They use Python programing which Parallax is now embracing.
Or should a user use joysticks to move the wooden game?
Might be a nice smart-phone app, using the tilt sensors of the Phone, rolling a virtual ball thru a virtual labyrinth.
Decades ago, before capacitive Touch Screens, German Nuclear Powerplants used a frame mounted around the screens providing a grid of IR? LED's and your finger would be sensed by interrupting two or more beams. No need to actual touch the screen.
In your example wooden box you could get away with a 10 by 10 grid mounted on the innermost frame. The ball is taller then the walls and you could get its x/y position on the frame.
10 x 10 or maybe 20 x 20 for more precision. shift register to read the parallel beams and make a serial binary out of it, 4 pins needed for x and y.
Enjoy!
Mike
Some form of linear interpolation would be needed, for finer position control as you want to know the ball's speed as well.
Gets complicated very quickly, and you only 'see' a small fraction of the ball..
Car Backing cameras are under $10 and output NTSC, so one of those would be worth experimenting with.
As there are known strip-paths for the ball, you can make the ADC somewhat slow (~ 10 samples per line, but they can be sysclk-strip aligned) and one issue could be getting contrast between Ball and holes.
Or, that could be a software problem where the holes are fixed/known, and masked out, and hole/no-hole info could even be used for threshold setting & lighting control.
It's much worse than that. Before the ball reaches its final position you must not only tilt the board back to level, you need to reverse it a bit to get the ball to stop rolling before it exceeds its target position. It's quite tricky, as I know from experience having had one of these games when I was young.
Used to service and calibrate multi-well gamma counters that used a similar approach to select settings ( isotopes, count times, min/max counts, etc. ) and enter text and numbers for programming assays. IIRC it was a 12 inch CRT with 32 x 24 ir leds and photo-transistors. Very reliable system, but a keyboard would have made programming the assays much faster.
Just a thought on this for OP's plan, an algorithm to find the most blocked out receive diodes in a group for that axis may be needed since the farther away the ball is the more sensors would be covered due to magnification. Possibly an EL strip for the source. Then have to alternate on time of EL so X doesn't interfere with the Y axis. And down the rabbit hole we go.........
For this type of led/phototransistor arrays magnification and x-y interference is not an issue. If the spacing is slightly less than the size of the ball it would block 1 emitter/detector pair unless centered between them. If centered between two pairs it would block both, so having the emitter/detectors spacing slightly less than the ball diameter you get almost twice the resolution. By turning on the leds sequentially you can scan the x and then the y to determine the ball position without any interference. I know this works because I built a prototype 3x4 keypad for an access/security system.
openmv.io
I think they are around $65 or $70. Probably the cheapest way to do what you are trying to accomplish.
OK, I will focus on cameras. I have read, that Ov7670 can output a subwindow. Perhaps this would make it possible to use a less powerful processor (no big RAM) and to have enough resultion and speed at the same time.
Christof