Magnet Design for Proximity Sensing - Part 1

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 directly approaches 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.


Mechanical Air Gap Versus Magnetic Air Gap

The usual criteria for proximity sensing is the required sensing distance.  This is often defined as a particular air gap distance between the magnet and sensor.  However, the air gap is usually specified 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 Our 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 application requires the sensor to activate within a 10mm mechanical gap.   Whenever the magnet package is within 10mm of the sensor package, the sensor should activate.  There is no requirement for a deactivate distance for this example.  (Many applications do have deactivate requirements.)
  • 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 length of the magnet 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 required sensing gap.  (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.

This means that the worst case magnetic air gap is 13mm + 0.5mm + X  (where X is the distance from the sensor face to its sensing point.)  For most devices, X is on the order of 1/2 mm or so.  The data sheet should contain this information.  We will use 0.5mm for X in this example.  For this example, the 10mm mechanical air gap translates into a 14mm magnetic air gap.

We will use a cylinder magnet.   The length of the magnet must be 5mm or less.  The diameter has no limitation.  There is no limitation on material selection.  For simplicity in this article, the material choice will be restricted to Neo-35.  In actual design work, there will usually be some constraints that will guide the choice of material.

In most applications, there will be limitations on the sensor chip package and electrical characteristics.  Sometimes there are size limitations.  This will play a large role in deciding what particular device to use.   In addition, cost is often a major consideration.  In this example, we will not worry about those things.  We will only worry about the magnet design.   We have glossed over device selection criteria in this example.

The key considerations of the magnet design will be to minimize the cost of the magnet and to insure that the 10mm mechanical activate distance is met when all of the tolerances are taken into account.  We will assume that a custom magnet shape can be used.


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.  

  1.  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.
  2. 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 between 10% and 30% variation of field strength from nominal fields.  Depending on the application, this could result in several millimeters of change from the nominal activate distance. 

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.

Experimentation Using Several Different Magnet Shapes

We went onto a random magnet supplier's web page and selected a series of available magnets to simulate.  These simulations are close to what would be measured in lab work.  The graph to the left shows what would likely be seen if someone were to order several of these magnets and see what happens in the lab.

The four graphs to the left are different views of the same plot.   The green region shows the simulated activate distance across a range of diameters and lengths for a particular material.  The gray plane shows the nominal target activate distance.  The blue and red dots show where the set of magnets would be.  The red dots show the magnets that would meet the main criteria of activating outside of 10mm mechanical gap and being less than 5mm long.

As a practical matter, many experimenters might select the smallest size magnet of the red dots since it is the cheapest of these.  In this case, this is a 9.5mm Diameter by 1.5mm Length Neo 35 magnet.  Others might decide that that magnet is too close to the performance spec and select one of the two slightly larger magnets (either the 9.5mm D x 2.5mm L or the 12.7mm D x 1.5mm L). 

Simulation using Nominal Parameters

It is not uncommon to use some basic magnetic field calculators or the well-known formula for the axial field of a cylinder magnet for this application.  This could be easily implemented in an Excel spreadsheet.  In this case, the designer could simply do a systematic series of magnet designs.  The table to the left shows the result of doing this for a Neo35 type of material.

The table is color coded with red designs activating before the nominal 13.5mm magnetic activate distance (corresponding to the 10mm mechanical gap).  

Warnings about using only nominal values for design work!

When nominal values are used for experimentation or simulation, the resulting design will probably work for prototypes.  As a quick test for an application, this is a quick way to see if a particular idea is feasible.  However, it is not a good way to create a production design.

This method can lead people into a false sense of security.  As will be seen below, the observed activation distance will noticeably vary when production variation of parts is included.


Accounting for Production Variation with Simulation Estimates

The first step of this method is to clearly identify all sources of magnetic variation for this example.  Actual applications may have other sources of variation.

  1.  Magnet material strength (due to both temperature change and manufacturing variation)
  2.  Switch field activate levels (in this case assumed to be 60 gauss typical and 80 gauss worst case)
  3.  Assembly tolerances (in this case assumed to be a +/-0.5mm variation in air gap)
  4. Simulation gage errors (which experience has shown to be <5% for this method)

I used Mathematica to implement the field solutions.  Using the above variations and putting constraints on the diameter to length ratio of the magnet, the magnet shape was optimized to produce the smallest possible magnet.  The magnet material was assumed to be a variation of Neo-35.  (In practice, I would try other types of materials as well.)

The typical performance of this magnet design is shown here.  The blue line shows the field at difference magnetic air gaps.   The green line shows the typical field activate level of the switch.  The blue dot (at about 17mm) shows the typical activate distance for this magnet design.

Recall that the magnetic gap is about 3.5mm longer than the mechanical air gap.  The purple line shows the magnetic air gap at the target mechanical gap.

Note that the typical performance of this design is about 3mm to 4mm better than the target distance.

 

The estimated worst-case performance of this magnet design is shown here.  The blue, green, and purple lines are the same as in the typical performance graph.

The red lines around the blue field curve show the possible range of field values.  This is due to a combination of temperature, material variation, and assembly tolerances.

The orange line shows the worst-case tolerance of the switch.  The red dot shows the estimated worst-case behavior of this magnet design.

An extra 1/2mm of tolerance guard banding was thrown into the optimization process "just in case".  This results in the magnet diameter being increased by a few tenths of a millimeter than if the red dot was on the purple line.

In practice, this graph contains two helpful estimates of design performance, the typical performance of prototypes and the estimated bounds of performance on production units.  The blue/green typical lines are usually reasonable predictions of how first prototypes will perform.   The red/orange lines give a reasonable estimate of the range of performance that can be expected from production units.


The Consequences of Ignoring Tolerances

This plot shows the magnet design chosen via experiments in the first section of this article.  The danger of only using experiments to design magnets and sensors is that it is difficult to predict what the possible range of production behavior might be.

The blue/green typical values are right on top of the target distance.  However, the red/orange estimated worst-case values are almost 3mm inside that target.

In this case, using experiments to choose a magnet results in an estimated worst-case behavior of about a 7mm to 8mm mechanical gap.  Depending on the application, this could result in field failures of this design.


Design for the Field; Not for the Lab

The example given here was intended to show the importance of adequate magnet and design work.   Unfortunately, it is difficult to account for all production variation by doing lab experiments.  There is no simple rule of thumb to target X% more distance or add Y millimeters to the target distance to account for variation.

My experience is that many applications with a magnet and switch (and no surrounding magnetic material) can be analyzed effectively using simulation.  The point of this type of analysis is to help at the beginning of the design process.  The above analysis is no guarantee a design will work.  However, it provides a much better starting point than a few simple experiments.

Please feel free to learn from this article.  Indeed, this is part of the reason I wrote it.  Poor sensor designs make the world a poorer place.  Every piece of scrap due to poor designs is a waste of material and time and increases the size of landfills and reduces company profits.  Sensors are increasingly being designed as integral parts of larger assemblies.  Sensor failure can result in hours of maintenance time and expensive recalls.  Please take note that reading this single article is not going to make you an expert at this.  It's simply a starting point.  There are many necessary details to consider that were not discussed with this simple example.

It should also be noted that the above example did NOT include constraints on the deactivation range.  Magnet design becomes much more challenging if both the activate and deactivate distances are specified.  Analyses such as shown here can fairly rapidly determine if it is even feasible to create a design for an application.

This last section is an unabashed push for consulting projects.  This is an example of a type of analysis I've done literally hundreds of times.

 

ApplicationsDoc Stuve