How to sense the position of a ball?

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

Comments

  • Use a camera looking down from overhead. If the ball is a contrasting color extracting its position will be fairly fast and simple. Anything else is going to be much less accurate and more expensive.
  • I agree with localroger.
    The video below may offer some ideas on tilting the board with servos.
    Larry

    If the grass is greener on the other side...it's time to water your lawn.
  • You might just connect the servo horns to the handles and use the camera idea.
    Windows 10 Home:
    Propeller Tool 1.3.2, BASIC Stamp Editor 2.5.4, Javelin Stamp IDE x.x.x, Arduino IDE, PST
    Hardware:
    BASIC Stamp Board of Education, Propeller Board of Education, Propeller Project Board, Propeller Mini

    Me, a programmer in English class, asking for grammar help: “What is the syntax for this statement?”
  • Thanks!
    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

    ?
  • “Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. -Antoine de Saint-Exupery

  • 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
    I am just another Code Monkey.
    A determined coder can write COBOL programs in any language. -- Author unknown.
    Press any key to continue, any other key to quit

    The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this post are to be interpreted as described in RFC 2119.
  • tritoniumtritonium Posts: 283
    edited 2019-08-16 - 13:55:49
    Hi

    How about a repurposed touch screen. Available on e-bay



    Dave
  • I thought of the touchscreen idea but rejected it because it will stop working if you drill the fall-through holes in it.

    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.
  • Perhaps a stepper motor driven two axis gimbal with the top attached to the inner for x(or y) and inner mounted inn outer ring for y(or x) tilt capability. For position, if the ball is has a taller profile than the walls, maybe an Led or photo luminescent strip opposite a linear array of photo diodes or mirror/lens/single line ccd chip camera as used in copiers to figure out an X/Y position for the ball.
    Ordnung ist das halbe Leben
    I gave up on that half long ago.........
  • lardomlardom Posts: 1,556
    edited 2019-08-17 - 18:19:41
    This is one of those projects that makes me wonder how I would try to solve it. Rolling the ball to a specific point on an axis requires two steps: The board is tilted until the ball reaches position then the board must return to level to hold that position.
    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.
    Larry

    If the grass is greener on the other side...it's time to water your lawn.
  • PublisonPublison Posts: 10,960
    edited 2019-08-17 - 18:40:55
    I might suggest the OpenMV7 camera.
    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.
    Infernal Machine
  • not sure what the goal here is, Servos actuate the wooden game and a propeller should solve it?

    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
    I am just another Code Monkey.
    A determined coder can write COBOL programs in any language. -- Author unknown.
    Press any key to continue, any other key to quit

    The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this post are to be interpreted as described in RFC 2119.
  • jmgjmg Posts: 13,911
    msrobots wrote: »
    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.

    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.
  • lardom wrote: »
    This is one of those projects that makes me wonder how I would try to solve it. Rolling the ball to a specific point on an axis requires two steps: The board is tilted until the ball reaches position then the board must return to level to hold that position.

    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.
  • I believe the CMUcam (one version of which was Prop based and developed by our own Kye) can be configured to track a color-differentiated ball for you and simply report its position in the X-Y frame.
  • msrobots wrote: »
    not sure what the goal here is, Servos actuate the wooden game and a propeller should solve it?

    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

    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.
    In science there is no authority. There is only experiment.
    Life is unpredictable. Eat dessert first.
  • OEC used an array of IR diodes and opposing photo transistors, one set each for x and y coordinateso on 9800 and earier models to allow touch function and entry of patient information pre-touchscreen days.

    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.........
    Ordnung ist das halbe Leben
    I gave up on that half long ago.........
  • kwinnkwinn Posts: 8,326
    edited 2019-08-18 - 14:58:20
    .........

    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.
    In science there is no authority. There is only experiment.
    Life is unpredictable. Eat dessert first.
  • Take a look at the openMV camera. I've used it with the propeller before, and it works really well just sending serial data like a coordinate.

    openmv.io

    I think they are around $65 or $70. Probably the cheapest way to do what you are trying to accomplish.
    Matthew Matz
    STEM/Robotics Educator
    Parallax Inc.
  • Christof Eb.Christof Eb. Posts: 317
    edited 2019-08-23 - 05:46:18
    Thanks for the inputs!
    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
Sign In or Register to comment.