Magnet Design for Proximity Sensing - Part 2
Proximity sensing provides an on/off response when a magnet approaches close enough to a digital magnetic sensor. This is useful for detecting things such as door closures, object presence, or home positioning. This article looks at the situation where the magnet moves parallel to the sensor. A numerical example will be worked through to illustrate the process of magnet design.
Two methods will be used on this example. The first method (using nominal design values only) is that which is commonly used by inexperienced people. The second method (including production variation estimates) is a more complete and effective method.
The required accuracy in this example should illustrate the importance of using good design methods. It would be quite difficult to use experimentation to design a magnet for this example.
Mechanical Air Gap Versus Magnetic Air Gap
A critical parameter for magnet and sensor design is the distance (or air gap) between the magnet and sensing point of the sensor. You must carefully define what is meant by air gap. Mechanical designers often specify air gap as a mechanical distance between packages containing the magnet and sensor. Magnet design must be done based on the actual distance between the magnet and the sensor, not their packages.
We must first carefully define what is meant by air gap. The magnet and sensor performance will be defined by the magnetic air gap. This is the distance from the magnet face to the sensing point inside of the sensor. Note that the sensing point is not at the face of the sensor, but inside the sensor some distance.
Defining the Example
There are particular things that must be defined in clear numerical detail. There is no escaping this level of detail to do design work correctly.
Here are the main specifications for this example:
- The sensor must activate and deactivate within a 3mm window. In other words, the hysteresis region (where the sensor might be on or off) must be no larger than 3mm.
- The sensor must allow for 10mm of over-travel past the activate position.
- The packaging wall thicknesses are 1.5mm for both the magnet and sensor.
- The temperature range is -40C to 100C.
- There is no nearby magnetic material and minimal external magnetic interference.
- The "height" of the magnet (along the air gap direction) can be no longer than 5mm. (This would be due to some type of packaging constraint. This will be different from application to application.)
- The overall assembly tolerances for the magnet and sensor will be +/-0.25mm. This means that magnetic gap can vary by +/-0.5mm. This has the effect of adding an extra 0.5mm onto the air gap. In addition, this reduces the target window from 3mm down to 2.5mm. (In practice, the engineering drawings should contain details on this and clearly define the tolerances of magnet and sensor positioning.)
- The device chosen to use will have a typical activate field of 60 gauss and a typical deactivate field of 40 gauss. Its production tolerances on activate and deactivate fields are 80 gauss and 20 gauss. The sensing axis of the device is perpendicular to the face of the device. These levels are similar to many actual devices offered by various manufacturers.
Choosing the Magnet Configuration
I'll just tell you what I would try first. Experience suggests to me that the best design will be a rectangular magnet magnetized parallel to the sensor. A 3mm window is a very tight tolerance for magnets and magnetic sensors, especially with a 13mm air gap.
If you use a magnet with the pole facing the sensor, you will get a large activate region. However, the hysteresis region will also be very large. It will be difficult, if not impossible, to attain the 3mm window.
With the limitation of 5mm on magnet height or diameter, a cylinder magnet (if it would even work) will not be a very efficient use of magnet material. The rectangular shape will work better.
Using Nominal Values: An Overused Approach
I have observed that a common approach to magnet design is using only nominal values. There are two ways that this is commonly done.
- Doing lab experiments with magnets and sensors. This seems to be a common approach. A number of magnets will be ordered from a supplier. Someone will test these magnets with a few sensors to see what works.
- Doing some magnetic field simulations using nominal material values and nominal sensor performance. This approach will usually give similar results as obtained by experimentation.
There is an often overlooked problem with these two methods. These methods do not include the effect of magnet, sensor, and mechanical tolerances. As a practical matter, the production variation of magnets, sensors, and assembly tolerances can easily produce a large variation of field strength from nominal fields. Depending on the application, this could result in several millimeters of change in performance.
We'll now use this approach to obtain a magnet design for this example. We can then use this design to see what happens when production variations are taken into account.
Estimated Results from Sample Magnets
This plot shows estimates of what would be measured in the lab. Two dozen standard Neo rectangular magnets from a vendor were analyzed. The plot shows the results for all 24 magnets. Only 3 of them would give performance that meets the 3mm window and the 10mm over-travel specs. These are shown in red.
The graph shows the field seen by the sensor as the center of the magnet moves past the sensing point. Zero mm corresponds to when the magnet center is aligned with the sensing point. The green region shows where the sensor would be activated. The gray region is where the sensor is off. The white region is the hysteresis region where the sensor could be on or off.
Unfortunately, none of the three magnets that work meet the 5mm height requirement. These 3 are 1/4" (or 6.35 mm) in height. If it is possible to change packaging, such magnets could be used. If it is not possible to change packaging, you would have to try a series of new magnets from a different vendor. Another alternative would be to order a series of custom magnets of various sizes.
The stronger magnet is a 1/4" x 1/4" x 1" Neo magnet. It is magnetized along the 1" axis. In practice, this would be the best choice of the three. Note how the over-travel of the other two magnets barely makes the 10mm spec. Once variations are included, it is unlikely that these would work. The stronger magnet has an activation window of about 2mm and an over-travel of about 20mm.
Note that would not be uncommon for inexperienced people to select one of the weaker two designs. These would be cheaper and would successfully pass a few lab experiments. The issue for production designs is what happens when manufacturing variations occur.
Estimated Effect of Manufacturing Variation On 1/4" x 1/4" x 1" Magnet
This plot shows the estimated effect of manufacturing variations if the 1/4" x 1/4" x 1" magnet could be used. The red curves show the estimated field variation. The blue curve is the estimated nominal field. The extra green and gray lines at 80 gauss and 20 gauss are the tolerances of the sensor.
The blue dots show the typical off, on, and over-travel points. These meet the 3mm on/off window and the 10mm over-travel specs. These would not be far off from what would be measured in the lab with prototype parts.
The red dots show the estimated performance variation when manufacturing variation is included. The over-travel is still okay. However, the on/off window is potentially on the order of 7mm to 8mm.
This design would have the potential for having problems meeting specs if put into production. Depending on the actual production variation, you might see anything from occasional rejects to a significant percentage of rejects.
Using Simulation Methods
Using direct solutions in Mathematica, an optimum solution was found. This is the smallest rectangular magnet that will fit the 3mm on/off window, 10mm over-travel, and a 5mm height limitation. It is a fairly large magnet at 5mm x 27mm x 13mm. It is about 4 times larger than the sample magnet above.
This is a situation frequently encountered. One particular requirement can drive the magnet size. In this case, the 3mm window requires a very strong magnet. If it is not possible to relax this requirement, a larger magnet will be needed.
Effect of easing 3mm window to 5mm
Let's assume that it is possible to relax the 3mm window requirement to 5mm. What effect would this have? As it turns out, the magnet size could be cut in half. A 5mm x 16mm x 10mm will meet the 5mm window. The plot to the left shows the estimate performance of this smaller magnet.
As a practical matter, it took me less than 15 minutes to re-use the Mathematica code I used for the 3mm simulation work to generate this new design for the 5mm spec.
Effect of reducing the air gap by 4 mm
Let's assume it is possible to reduce the magnetic air gap from 13.5 mm down to 9.5mm. This allows the use of a smaller magnet while still meeting the 3mm window and 10mm over-travel. The plot on the left is for a 5mm x 12mm x 8mm magnet.
This is typical. The more the magnetic air gap can be reduced, the smaller the magnet can be.
As a reference, the images to the left show the relative sizes of the magnets shown in this article. The far left is the original 1/4" x 1/4" x 1" sample magnet that does not meet the specs. The large magnet meets the specs. The medium magnet meets the reduced 5mm window. The small magnet meets the reduced air gap.
This example is fairly typical of what is experienced in magnet and sensor design. There is usually a trade-off between the specifications and magnet size. As a rough rule of thumb, the lower the required accuracy and the smaller the air gap, the smaller the magnet. The more accuracy and the larger the air gap, the larger the magnet.
This example is also fairly typical of the limitations of using experimentation to design magnets and sensors. It is very difficult to create good magnet and sensor designs in the lab without doing a lot (and I mean A LOT) of systematic work. Trying a few magnets and sensors to see what works is a quick feasibility test to see what might work. However, that is NOT design work.
Simulation is not a panacea, but it can get you to a reasonable starting point faster. The use of simulation allows you to have a much better starting estimate for what magnet design may work for the application. Simulation can often give you an idea of how particular specifications affect the needed magnet design. A few simple mechanical changes could result in much better sensor performance or much cheaper magnets.
In my experience, it is not uncommon to run into situations where someone used experimentation to create a magnet and sensor design without accounting for manufacturing variation. Tooling and equipment for the product are ordered. Testing then reveals sensor failures during pre-production or production. This is a very poor method for determining whether a design will work or not. I cannot remember the number of times I have seen "sensor failures" that were really "someone messed up the design without knowing it" failures.
It's a lot cheaper to pay someone like me at the start of the design process and avoid easy-to-avoid problems than to discover them months down the road.