# Use magnetic field to estimate distance - best sensor type

I want to measure the position of something that movies along a single axis over a range of 150mm at a frequency of roughly 1kHz. You can imagine that it is the piston on a shock absorber. I could attach a small magnet to the moving element. I think it should be possible to position a magnetic sensor at one end of the range of motion and then capture the magnetic field as the item moves back and forth. The problem is that most magnetic sensor that I can find are hall-effect sensors that are designed to switch from 0 to 1 over a very short distance. What I need is a gradual change in voltage output over the range of motion so that I can estimated the piston position based on the sensor voltage over the 150mm of travel.

TMR sensors seem to be inherently better suited as they have a more linear response to magnetic field, but I can't seem to find a simple sensor. They are all configured as angle sensors (would these work for my application?) or proximity sensors.

If I can just get the raw response voltage and capture that with an adc on a microcontroller I think this would be fine.

Any ideas?

• You are looking for a RATIOMETRIC Hall effect sensor. Jan 21, 2020 at 14:13
• Are you certain about that travel distance & frequency? Unless I've confused something in the calculation that requires acceleration & deceleration of no less than 600000m/s^2. Seems a bit like firing a bullet, then catching it and firing it back in the opposite direction... Jan 21, 2020 at 15:46
• Sorry, I was not clear. Obwaltende to measure 1000 times per second, which should be more than enough to capture the motion. It’s a shock absorber so it will be a very sudden acceleration and then deceleration at a slower rate. I don’t know how fast the acceleration will be though. Jan 22, 2020 at 21:46
• @ScottSeidman I found this - it looks interesting: digikey.ch/en/product-highlight/a/allegro-microsystems/… Jan 23, 2020 at 6:17
• Yup, those are the guys. I think Allegro makes similar things, w/ analog outs, in a transistor package. Jan 23, 2020 at 13:21

Any ideas?

Maybe (just maybe) you could engineer the equivalent to a linear voltage displacement transducer (LVDT). It uses three coils and a linear moving target to estimate position: -

Conceptually it is the same as a food-industry three coil metal detector: -

The thing about the metal detector is that the aperture design (the hole in which the product travels) is big enough to allow whatever mechanism you have planned to fit in it but, bear in mind that only the "target" must be metal.

You would excite the centre coil at tens to hundreds of kHz and look for the phase of the signal on the receive coils. At dead centre the receive signal is zero and the left side would produce the opposite phase signal to right-side.

I could attach a small magnet to the moving element

A piece of ferrite would work nicely.

One solution is to use an industrial position sensor. Sick, for example, make a range of magnetic cylinder sensors up to 500 mm long and these sense the position of a small cylindrical magnet on the object being monitored. As is normal with industrial applications these will probably require a 24 V supply (I didn't check) and the analog output will be either 0 - 10 V or 4 - 20 mA.

Figure 1. A Sick linear position sensor.

Other industrial options include laser ranging and yo-yo encoders - a bit like a yo-yo or tape measure where the end of the tape is connected to the moving target.

• I wasn't aware of these, thanks, but this is a bit bulky. It should be attached to a mountain bike. Jan 23, 2020 at 6:12
• That constraint (and any other) needs to be added to your question then to avoid wasted effort. Jan 23, 2020 at 7:13