# How to measure displacement, cheaply and without using an accelerometer?

Motion is known to be confined in a sphere with radius of about 0.5m, and resolution doesn't have to be very high (5cm is enough). The device will actually be incorporated in a toy designed for kids.

I tried implementing that with an accelerometer but the estimated displacement drifted away 100s of meters per minute.

Is there some other solution, maybe involving electrical or magnetic fields? It's important that the sensor costs no more than a few bucks.

Edit: The device should not be attached to anything mechanical and its movement is in 3d (a kid moves the toy freely).

• If you consider only gravity and compass heading, could you improve your accelerometer estimates by considering the possible orientations of the child's arm (inverse kinematics)?
– Ian
Mar 4, 2014 at 16:19
• The accelerometer chip used in the iPhone is roughly 65 cents...you should be able to get better accuracy than 100s of meters of error per minute. Also, are you concerned with orientation or just the (x,y,z) coordinates within a sphere of 0.5m? Mar 4, 2014 at 19:51
• It seems to me that you might be able to solve your problem using some simple ir sensors. Mar 6, 2014 at 6:00

Ultrasonic transducers are the best bet, in my opinion. However, they might cost you a little over "a few bucks".

You have two options:

1. Set two/three ultrasonic Rx/Tx pair along one plane. Trigger them sequentially, in quick succession and triangulate your object in 3D.

A drawback of this approach is that the sensor noise would be phenomenal.

The other option would be:

• Set three ultrasonic transmitters, one along each plane (X,Y and Z), near the boundary of the active region in which the object will be moving.
• Place the ultrasonic receivers inside the object, one facing each direction.
• Precompute a lookup table that tracks the ultrasonic flight time along each direction separately.
• During operations, trigger the three sensors in quick succession, getting X, Y and Z values consecutively.

This method should be less noisy.

You'll need and omnidirectional ultrasonic transmitter, like this: http://www.metrolog.net/transdutores/piezofilm/ultra40k.php?lang=en

[I'm not sure how much three of them would cost, but there must be some cheaper variant available somewhere].

• If you bulk order these sensors, you might get them at around $6 per piece. Mar 4, 2014 at 16:24 I guess it depends partially on volume. Ultrasonics is very precise (down to sub-mm depending on your signal processing and frequency), but they cost$8-10 per transducer unless you are buying in large volume.

• Can you refer me to a specific device? Cheap is more important than accurate. Mar 2, 2014 at 10:11
• This tends to be a very common 40kHz piezo. check the beamwidth and what not to see if it works for your application. You'll probably need TX and RX to bounce and receive signals. senscomp.com/pdfs/l-series-40lt10-40lr10.pdf Mar 5, 2014 at 3:13

have you tried using the optical mouse? the sensors they have are accurate enough(down to 1/400 inches )and the cost can be very small compared with encoders

• That won't work, because the device can't be assumed to be placed on a table. Edited the question for clarity. Mar 2, 2014 at 10:07

Accellerometers won't help much (as you noticed) because they are not global sensors. They drift. To beat this, you need some way of knowing the location of the object relative to another, fixed location. So, here's my question:

What are the constraints of the system? Is the object to be estimated tethered so it cannot move outside that sphere? or is the sphere an actual object?

If the sphere (or even boundaries of the sphere) are known, fixed, or some other way constrained, then you may have hope of fixing the accellerometer's bias, so long as you can detect that the object has actually not moved (e.g., by sensing the boundary).

You may consider putting sensors in the sphere itself. One way of doing this is magnetic (hall-effect) sensors, then making the object mildly magnetic. Then, whichever group of hall-effect sensors is reading the largest magnetic field is likely near the small object. I have successfully done this to track rotations in a wheel by placing a magnet inside the wheel and hall-effect sensors in the wheel well. Simple, and very, very cheap.

If there is no physical sphere, you may have to put all your sensors in the device. Then the problem is actually very hard! If a cheap solution existed for this, then the Army, Firefighters, Police, and all other sorts of disaster rescue people would love to know how you did it. All solutions I'm aware of require extremely expensive accellerometers, coupled with a GPS or camera system. Tough for cheap applications.

One of the most common solutions to this problem is structured light (Kinect). I'm not sure about the Playstation Move, but it uses something similar.

Ultrasound is going to be tricky, as you either need to bounce signals around or have a transmitting unit and a receiving unit, but I'm sure you could make it work.

Since an accelerometer is not an option, an ir transmitter can placed on the toy. A strip of ir receivers can be placed nearby. The receivers must be spaced out with blinders in between. Essentially what you are actually doing, is defining a finite plane where the kid can move the toy. For instance, if the strip is in front of the child, at about 15 feet away, he can wave the toy freely along the x-axis. The length of the strip determines how the width of plane. You can adjust the height of the blinders as needed. When receiver Ri is activated, time Ti is recorded (i = 0..n receivers). Since the distance between the receivers are fixed, it then becomes easy to calculate other variables using the recorded time. This method requires strong microcontroller programming ability. In the absence of an accelerometer, i am eager to hear other options. Ultrasonic sensors will not work for they only measure distsnce from a to b only. Good Luck!