PCB assembly

Hall Effect Sensor Interface Design

A Hall effect sensor converts a magnetic field into an electrical signal without contact, which makes it the natural choice for position, speed and current measurement in equipment that has to run for years. The device itself is simple, but the interface around it decides how repeatable the measurement is, because the magnet, the air gap, the supply and the load all enter the result.

How the Sensor Responds to a Field

The sensing element is a thin layer of semiconductor carrying a current. A magnetic field perpendicular to that current deflects the carriers to one side, producing a small voltage across the element that is proportional to the field strength. The device package focuses the field through the element with a small integrated concentrator, so the sensitive direction is defined by the package rather than by the die.

The output is a function of magnetic flux density, so the interface has to be designed as a measurement of field rather than of position. Moving the magnet changes the field, and so does a change in air gap, in magnet temperature or in the presence of a nearby steel part. A design that treats the magnet as a fixed reference and the sensor as the variable is easier to make repeatable.

Because the element responds to the component of the field perpendicular to the current, orientation matters more than most designers expect. A sensor rotated ninety degrees about its own axis may see almost nothing, and a sensor placed where the field lines run parallel to the package face will produce a reading that changes with the smallest misalignment in assembly.

Linear versus Switching Outputs

A linear Hall device produces an analogue output that follows the field, with a quiescent level at zero field and a swing of a few millivolts per millitesla in either direction. It is used where the field has to be measured, such as in a current sensor or an angle encoder, and it requires a stable supply because the output is ratiometric with it.

A switching device contains a comparator with hysteresis and produces a digital output that changes state when the field crosses a threshold. The hysteresis is the difference between the field that turns the output on and the field that turns it off, and it exists to stop the output chattering when the field sits near the threshold, which is what happens with a slowly moving target.

Latching devices are a third category and hold their state until the field reverses. They suit rotation counting with a multipole ring, where a north pole sets the output and a south pole resets it. Choosing between the three types is the first decision in the interface, because each one imposes a different requirement on the magnetic circuit.

Hall effect sensor mounted beside a magnet on a PCB

Supply, Output and Load Considerations

Most Hall devices draw a few milliamperes and need a supply that is clean enough to keep the output stable. A linear device with a ratiometric output will move its zero point with the supply, so a regulator with a low temperature coefficient is worth the cost. Decouple the device locally with a ceramic capacitor, and add a small series resistor where the supply is shared with switching circuitry.

The output stage is usually an open collector transistor or a push pull driver. An open collector output needs a pull up resistor sized so the current stays within the sink rating while the rise time suits the application, and the resistor should return to a rail that the receiving logic also uses. A long cable on a switching output will add capacitance that slows the edge and can double pulse if the pull up is too weak.

Where the sensor sits at the end of a cable, protect the output before it reaches the controller. A series resistor and a capacitor form a low pass filter that also limits the current from an electrostatic discharge, and a small clamp diode to the supply rail stops negative transients from reaching the input. These parts cost almost nothing and prevent most field failures.

Magnetic Design Around the Sensor

The magnet and the sensor form a system, so the field at the sensor has to be calculated for the whole travel range, not just at the centre. A neodymium magnet has a strong temperature coefficient, losing a fraction of a percent of its field per degree, and that change appears directly in the reading of a linear device unless it is compensated.

Air gap is the parameter with the greatest influence on repeatability. The field falls roughly with the square of the distance in the near region and faster further away, so a tolerance of a tenth of a millimetre in the mechanical assembly can be a percent of the signal. Mechanical stops that define the gap on the assembly, rather than relying on a bracket, remove most of that variation.

Steel parts near the sensor distort the field and can concentrate or shunt it in ways that are difficult to predict. A ferromagnetic screw, a plated bracket or a shielded cable clamp placed within a few millimetres of the sensing face can change the reading by more than the signal of interest. Keep the area around the sensor free of magnetic material, and specify non magnetic fasteners for the mounting.

Magnetic sensing circuit with a Hall effect sensor

Layout and Noise

Keep the sensor close to the connector that brings the cable in, and keep the trace from the sensor to the controller short and away from switching nodes. A linear Hall output is a small analogue signal, so the rules that apply to any analogue front end apply here as well, including a quiet reference plane under the device.

Where the sensor is mounted remotely, run the supply, ground and signal as a group with the ground conductor providing the return path. Never share that return with a motor or a relay, because the current in the shared copper appears as an offset in the measurement. The same reasoning that governs trace width and current applies here with an accuracy motive rather than a thermal one.

Electromagnetic interference from a nearby motor or contactor can drive the sensor output outside its linear range, and the symptom of output saturation at one extreme is easily mistaken for a wiring fault. A ferrite bead at the connector and a low pass filter at the controller input keep the interference out, and the general approach is set out in our article on EMI suppression design.

A switching output driving a long cable radiates as well as receives. Keep the pull up current modest, add a series resistor at the device end to round the edge, and twist the output with its return. These measures matter most when the sensor shares a cable bundle with encoder or communication wiring.

Temperature and Drift

Every part of the measurement chain moves with temperature: the magnet loses field, the semiconductor element changes sensitivity, and the mechanical gap changes as the bracket expands. The magnet contribution usually dominates, at around 0.1 percent per degree for common neodymium grades, which is a full percent over a ten degree swing.

Compensation is possible because the effects are systematic. Measuring the ambient temperature near the sensor and applying a correction curve in firmware removes most of the magnet drift, and the correction coefficient can be taken from the magnet datasheet. Where the sensor and the magnet are at different temperatures, the compensation has to be based on the magnet temperature rather than the board temperature.

A ratiometric design removes one more error. If the analogue to digital converter uses the same supply as the sensor, a change in the supply affects both the signal and the reference and cancels. That arrangement also requires the converter reference to be taken close to the sensor supply pin so the two see the same voltage, which is a layout decision as much as a circuit one. The wider partition between the analogue and digital areas of the board is covered in mixed signal board design.

Current Sensing with a Concentrator

Current measurement uses the field that a conductor produces, either directly or concentrated by a ferromagnetic core with a gap in which the sensor sits. The direct approach is compact but only practical at high current, because the field around a conductor falls quickly with distance, while the core approach gives a predictable field for currents of a few amperes.

The core introduces its own errors. Saturation at high current limits the measurement range, remanence leaves a residual field after a large excursion, and core losses produce a phase shift that matters if the current is used in a control loop. A closed loop sensor with a compensation winding removes most of these effects at the cost of additional circuitry.

Calibration is straightforward in either case, because the relationship between current and output is linear away from saturation. A two point calibration with a known current at the low and high ends of the range sets offset and gain, and checking the reading after a large current pulse confirms that the core returns to its starting point without a significant offset.

Practical Checks Before Production

Three measurements answer most of the open questions on a new magnetic design. Sweep the travel range with a dial indicator and record the output against position, so the linearity and the usable range are both known. Repeat the sweep at the temperature extremes the product will see. Then measure the output with the production magnet, because magnet grades vary between batches more than the datasheet suggests.

Mechanical tolerances should be verified on the assembled product, not on a fixture, because the gap that matters is the one in the finished unit. Where the tolerance is wide, a design that uses the sensor near the middle of its range and in the steepest part of the field curve will lose less accuracy than one that relies on the extremes.

Do not overlook the effect of the enclosure. A steel cover changes the field path, and a plastic cover with a conductive coating for shielding can shift the reading as well. Testing the final assembly, with the cable fitted and the unit powered from its production supply, is the only way to confirm that all of these effects together stay inside the error budget.

FAQ

How close can the magnet be to the sensor? That depends on the field strength and the range of the device. There is no minimum gap in principle, but a gap of at least a millimetre gives the mechanical assembly some tolerance and keeps the field inside the linear range.

Why does the output change when I touch the sensor? A finger introduces a small magnetic and thermal disturbance, and on a sensitive linear device that is enough to move the reading. If the change is large, check whether the device is operating near saturation.

Can a Hall sensor measure position through a metal wall? Not through ferromagnetic material, which shunts the field. A non magnetic stainless steel or aluminium wall is acceptable if it is thin, and the field loss can be included in the design calculations.

Leave A Comment