# How can I test a Hall effect sensor at a given distance?

I have a project that includes an Ablic S-5716ACDL1 omnipolar Hall effect switch. It has a sensing range of about 3 mT (±1.6 mT).

Prior to going down a rabbit hole of magnetism in physics, I confirmed that the sensor works as expected when bringing an axially magnetized neodymium disc magnet (22 mm dia. X 6 mm thick) within approximately 30 mm.

There is about 2 cm of plastic/air between the sensor and magnet, so this establishes the minimum distance I'm able to place a magnet for testing.

Please excuse the crudity of the diagram, I didn't have time to build it to scale or to paint it...

My goal is to automate this particular test by employing an electromagnet instead. I naively purchased a small electromagnet thinking it would be similar in characteristics.

Unfortunately, while it has a reasonable holding force of 5 kg, it is not detected by the hall effect sensor until surprisingly near, about 10 mm (with the plastic cover removed).

I purchased a larger electromagnet (10 kg holding) expecting to increase the detection distance, but without luck.

I suspect that the construction of these electromagnets (with a metal chassis surrounding all but the "business end") lends itself to their holding strength, but also might be limiting the distance at which the magnetic field can be detected. Bringing an energized electromagnet near steel doesn't seem to have any noticeable attraction/effect until roughly the same 10 mm distance that I experienced with the Hall effect sensor.

There's a similar question here, but the answer goes beyond my understanding at this point. For example, I know that 1 mT = 10 gauss, but I don't know how to derive that for a given electromagnet, or more precisely, a given distance from said electromagnet.

I've only found a few electromagnets that are constructed differently, but this is based on my potentially wrong assumption that the construction method is key. I'd like to find a solution with somewhat less trial and error, and without vastly overdoing it with respect to the electromagnet strength.

My design limitations allow for up to 25 watts (up to 24 VDC), and physical space for the electromagnet is up to 80 mm vertically and about half that in depth and width.

I've also considered just mounting a neodymium magnet to a servo arm, but that introduces a mechanical/moving aspect which could be more likely to require service.

Q: What electromagnet specs should I be looking for, knowing that I need to detect 3 mT at 30 mm?

• Try turning the electromagnet 90 degrees in x and y axis (one at a time). The magnetic fields may be different than the magnet Feb 12, 2019 at 21:57
• @uglyoldbob I've definitely tried various orientations of the electromagnets. One thing to note is that they exhibit practically no magnetic force except for the open end. Feb 12, 2019 at 22:09

You are correct. The electromagnet you purchased probably has a metal outer shell so that the field is concentrated in the core and the can. The "north" pole is the core, and the "south" pole is the can, so the field direction is from the center of the magnet to its outer edge.

What you need is a straight rod of soft magnetic material (low-carbon steel like 1018 or a stack of lamination material) with wire wound around it so that its poles are on either end, which forces the field outwards away from the ends. You could use a ferrite rod, but it won't approach your magnet for field strength. You could then vary the distance to match the response.

Good Luck!

• I'm ok with the field strength being less than that of the holding-type electromagnets, so long as it is detected by the hall effect sensor. Full disclosure, I purchased some ferrite rod material (6mm diameter) and put 1400 wraps of 30 AWG enameled wire on it, resulting in 0.5A at 5V (11.3Ω), but the detection distance is still a lowly 10mm or so. Feb 12, 2019 at 23:03
• Note that 'a neodymium magnet' may be polarized in various ways, you MUST know where the poles are pointed in order to use it with a Hall switch. Ferrite is good for radio frequencies, but a 1/4-20 bolt in the 1.5-3 inch length range would be a better magnet core. Feb 13, 2019 at 0:28
• As I mentioned, it is best to choose a magnetically "soft" material like 1018 or transformer laminations. If you try a bolt, be sure and test - some stainless steels are not very magnetic, and high-strength steels can have magnetic remanence; that is, they can become permanently magnetized. Feb 13, 2019 at 14:42

If you are interested in calculating the magnetic filed strength in a given distance this website has a good tool for calulations.

What it shows you is that not only the distance and the properties of your magnet but also the angle in relation to your sensor does have a great impact on the measured field strength.