Having recently entered the world of Arduino I am seeking to make, as my first project, a ball that will sense my dogs approach and roll away.

I can handle the rolling part but I have been unable to find a sensor that will work when fully embedded in the ball (so the dog cannot bite or swallow it). This means no ultrasound or infra red or normal proximity sensor will do.

My best bet - an inductive proximity sensor (with a metal object attached to dog's collar) is only effective at a maximum distance of 8 cm and that is far too little. I need something that activates at say 1 foot.

Any ideas anyone?

  • How important is it that the ball roll from a foot away? Could using an accelerometer to detect when something touches it and then rolling away for a few seconds suffice? might be a lot cheaper. Aug 2, 2014 at 1:08
  • yes, probably this is a better idea..
    – Galahad II
    Aug 18, 2014 at 9:55

4 Answers 4


Perhaps an RFID tag on your dogs collar and a reader inside the ball will work. You will just have to find a reader and tag combination that can work from the range you need, I think some RFID can work from over 1ft. EDIT: You will need active tags (battery powered) to get over a foot range.

PIR sensors detect heat given off by humans and animals, so they make work through the ball. (not totally sure though).

Edit: i think PIR that is capable of detecting small animals may be your best bet you would just have to calibrate the range of detection some how


Interesting. You may want to consider using strong,small, modern rare earth, low cost (silver color) magnetic that can work up to 1 foot, depending on size and shape of magnetic. Test different size/shape mag with simple mechanical compass to check the distance.

You may want to use one of those popular sensor board with

a) MPUxxxx (3D accel to sensor gravity in 3D to know which way is up and down) b) 3D magnetic sensor

Both sensors are 3D and you know which direction the dog is coming (direction and mag strength, changed from background earth magnetic field when dog is coming, gives distance) and which 3D orientation of the ball is and hence to calculate which way to move a weight inside the ball to make the roll.

Biological disclaimer, no idea if dog health may be affected, positively or negatively (people sells human magnetic collar with health claim), by constant, 24 hours, magnetic collar.

Hope it helps

  • Roll away from dog, 10 USD hardware but significant 3D vector maths/modeling. Mag field like line from 2 poles of magnet. The line has different shape depending on distance. The variables are 1D distance, and 3D orientation (xyz) of dog, ball, earth gravity and earth mag. the last two are constant. Mag field should be quite constant in wooden house. Steel structure high rise apartment may be complex. Due to size, not much sensor can sense direction of the dog in 3D vector. Radio not ok/cheap,need tens GHz small antenna with good directivity. Optical ok for cellphone cam in spherical formation
    – EEd
    Jul 30, 2014 at 11:53
  • The original question is "sense my dogs approach and roll away". The roll AWAY part is very difficult to do as above, although the hardware cost is only a few US dollars. "Roll" to any direction (toward dog, side way or away from dog) is much easier as many suggestions, as just needs signal strength to detect dog approaching WITHOUT actually know the direction of the dog referencing to the ball.
    – EEd
    Jul 30, 2014 at 14:31
  • Agree re moving away. Had not thought of that. Some further thought provoked by this reply though. Maybe I should put all the intelligence in the collar device and simply send instructions to the ball via bluetooth or radio; so I would have the proximity device in the collar and this would react when the ball is sensed. Just have to think of a suitable sensor but this is probably better in terms of not having to fit everything inside the ball!
    – Galahad II
    Aug 18, 2014 at 10:05
  • Moving AWAY is difficult to execute on part of the ball unit. The sensors inside the ball need to know which way is up and presumably move a weight to action the roll as what human, with full advanced sensors than most robots, is doing in this video. youtube.com/watch?v=G9OfQL1D_hE Roll in random direction is easier than roll AWAY
    – EEd
    Aug 18, 2014 at 18:52
  • Yes I need to be more precise in my choice of words. For a first cut effort any movement in any direction will probably be enough! By the way my idea for obtaining the movement was based on having a small motor with an off centre weight, ideally a stepper so that I could make it move just a few degrees in a direction at a time. Not sure if I would find the really small and light steppers I need though.
    – Galahad II
    Aug 19, 2014 at 22:14

Idea 1:

Put a transceiver in the dogs collar, and one in the ball. Monitor the RSSI (received signal strength). If it goes above a threshold, roll away. Adjust the threshold to set the correct distance.

Idea 2:

Put an accelerometer inside the ball. Whenever it detects a knock (dog's paw etc) roll away for a few seconds.

  • Thanks for the idea. I now need to research transceivers. But it makes sense to put much of the intelligence on the collar rather than having to stuff it all inside the ball.
    – Galahad II
    Aug 18, 2014 at 10:07
  • Re idea 1 would it work with bluetooth? I have a master and slave combo but I am not sure if there is any way to measure the signal strength.
    – Galahad II
    Aug 19, 2014 at 22:16

Other than the answers above/below, you also could try infra-red lights and photosensitive transistors. However, that has some troubles, such as not working properly in the sunlight, or the material that the ball is made of blocking the light, and therefore not working.

AVOID MAGNETS! You could get your dog stuck in some metal, like a fridge. To get one working in such distance, you would need an awfully powered magnet, which could be strong enough to permanently impact circuitry in close range, such as a home theater which sits close to the ground.

By the way, how are you going to fit it all in a ball that is bite-sized? i'm actually interested in that. Aren't you worried of the dog munching it and breaking/swallowing circuits?

  • My dog has a short snout so can't really put much force on a ball. I was thinking about two central containers (maybe those Kinder egg inserts, or what you would find in a chocolate Easter egg). The idea is to then surround this with padding and place everything into a ball around 6 inches in diameter. Components will be: an Arduino nano, 1 or 2 small toy motors (with offset shafts), the sensor (if an accelerometer would be very small), and the battery pack (maybe use one of those button type or small pencils?). Maybe I might even fit in some sound device (small buzzer?)
    – Galahad II
    Aug 18, 2014 at 10:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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