I'm new to Arduino, but I have this idea for a game I would like to build.

I need the Arduino to be able to determine my relative position on a straight line - 20 feet (6 meters) long.

What would be the best way to achieve that?


  1. Durable (Outdoors proof)
  2. Easy for a newbie
  3. Cheap

EDIT. Some more context - I want to play Pong over a physical area (A grid of LEDs to act as pixels), and I want the use player's position on a line to set the position of the paddle.

2 Answers 2


Whether it's outdoor proof or not depends on the housing where you put your electronics.

For position tracking, there are basically 2 ways:
1. GPS
2. Acceleration sensors

For the given distance, a (cheap) GPS solution is not accurate enough (See https://www.sparkfun.com/tutorial/GPSTracking/clamped_edit2-L.jpg, for instance). And it may be too slow for your purpose.

Acceleration sensors also have a simple serial interface, but handling the data to get accurate results is not really easy (However I'm sure that someone has already written a public available software library)

Luckily, for position tracking on a straight line, there's another solution:
3. use a ultrasonic sensor

Maybe there are even better solutions; to evaluate, it would help if you could specify your project more detailed (how exact shall the relative position detection be? Static or dynamic calculation? If dynamic, how fast will the movement be? ...).

It could be worth considering the following alternative:
4. Use a rotary encoder, mount it to a retractable dog leash and hook this to the player's waist. The other end of course must be mounted to a steady pillar. Perhaps this is mechanically tricky, and it limits the mobility of the players, but electrically it's very easy.

  • Ultrasonic would be worth trying. It was disappointing to see your mention of Acceleration sensors in a positioning application. I see that further in you recommend against that, but it's not a case of it "not being easy" but rather one of it just plain not working as sensors you can buy are inaccurate enough to be meaningless after double integration - and that's assuming you somehow have perfect orientation information to map acceleration axis to environment coordinates. Commented Jun 15, 2015 at 11:34

If it's a grid of LEDs you may be able to place pressure sensors at points up and down the grid. Then you need to step on them in order to place the paddle at that point. Doesn't sound like you need 'exact' position, just a point on a grid. And you may be able to set up such pads to step on relatively cheap: force sensitive resistors or even whip up your own w/ cardboard and thin metal (foil?) separated with foam. We did similar for a halloween prop that was activated by stepping on the doormat.

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.