1

Is there a simple way to rig two balls in a way that lets you know if they are touching?

For example, here's a bad idea. Put a free-to-move magnet inside of each ball. When the balls get close, the magnets snap together. Use a magnetic sensor within each ball to tell the direction of the magnet. Use an accelerometer to tell the direction of gravity. When the gravity direction differs from the magnet direction, the balls are touching.

I don't need to know the direction of the contact (that would be ideal, but I don't need it). It should work over the whole surface. I would like to have more than two balls and be able to tell which two are touching. I can make the balls however I want.

(Even very basic advice would be quite helpful. I'm not familiar at all with hardware projects or what kinds of sensors are available or how to combine the available pieces into some desired thing. That includes advice like "this is probably too hard".)

  • If you want to do it with easy to get hardware I guess you can do it without an arduino as follows. If the balls are large enough and they are different colour you can use a machine vision C++ library (such as for example openCV can be used for example to track tennis balls direction and the uniquely colored tennis ball and it tracks more than one ball). All you need is a webcam and PC. Though, I dont know if openCV work an a small PC like a raspberry PI. – qwerty10 Sep 2 '16 at 21:53
  • @qwerty10 That's an interesting idea. I don't think it will work in my particular case, because I intend to be holding the balls and moving around. My body would likely get in the way of the camera's view. It would also be difficult to distinguish between "touching" and "appear to be touching due to perspective". – Craig Gidney Sep 2 '16 at 22:32
  • I still guess your problem can be solved with machine vision becuase machine vision is used to detect if a point or score has been made in professional televised tennis or soccer matches (or football as its called outside USA). In those sports its required to detect if the moving ball (where ever it is in the air) passed over a line and touched the surface or floor and I guess you would need to be accurate with that (say 1mm error bound) to decide that. Also there may be players in the way of the camera view of the ball. I dont know if that sports technology uses openCV. – qwerty10 Sep 2 '16 at 23:16
  • To me your problem sounds like the problem solved by the sports technology (which uses machine vision).But I dont think an arduino can not do something like track a ball to accuracy such as 1 millimetre in 3D space in someones hand with the person moving around a few metres-this is what you seem to be asking for-but I maybe wrong as Im new to arduino. – qwerty10 Sep 2 '16 at 23:17
  • How big are the balls? How big is the surface? Can you do anything to the surface? What are the balls made of? – Gerben Sep 3 '16 at 10:30
2

Option 1

Seems you say you can make the balls out of whatever you want, I would suggest the spheres be made of a metal and then you can either suspend them by wire spot welded or soldered onto the balls. Then what you do is you connect all the balls to inputs of an Arduino ( this is if you are doing this with one). Then connect all inputs to pull-up resistors.

Then to read if a ball is touching a neighbour you start with ball n and set it as an output and use digitalWrite(n,LOW); and then poll all the other balls as inputs to see which one reads LOW/0V and then record that in an array, you the move onto ball n+1 and scan the rest of the balls. There is also no need to read the previous ball to n+1 as if it did not register a touch, then it won't register with the next ball.

Then at the end you reset everything and start at the beginning again. Using the data how you wish at the end.

Below code is just to show, not tested.

for(int n =0; n < total_N; n++){
      pinMode(n, OUTPUT);

  for(int i = 0; i < total_inputs; i++){
          if(!(digitalRead(n)))// ball is touching
   {

         myArray[i] = 1;// store a point in the list, replace with a way you want
    }
    else myArray[i] = 0;
}
     pinMode(n, INPUT);
}

Option 2

(probably to much to go wrong)

You could use material that will allow IR rays to pass through and make you balls with that. Then in each ball is have a IR transmitter and a IR receiver, making a transceiver basically and then have each ball echo a specific ID and let the other balls pick it up.

To solve the issue that IR travels a good distance you will need to limit the power/voltage/current to the IR transmitter(LED) so that they only work within a certain range.

Option 3

You could place reed switches or hall effect sensors in each ball, with a magnet. Place a niece of metal behind the sensor so that the magnet is drawn to it. The only issue with this is that either the magnet in each ball will not only affect its neighbour but also itself. So they will need to be spaced and also the right strength of magnet.

Option 4

A combination of option 2 and 3 would be to surround a IR receiver setup with a piece of metal disk(like a washer) and also a reed switch or hall effect sensor, and then have a ball with a magnet and a IR transmitter by a magnet, so that when the two are pulled together the transmitter and receiver match up in the same view and are able to tell them that they are connected, you would thus have each ball with a set, one to receive placed on one side and another on the opposite side to transmit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.