Measuring a magnetic field can be very easy with some pretty low tech, or it can be very high tech. It just depends on what kind of measurement you need and how much effort you want to expend. The very simplest magnetic sensors are reed switches. These are basically relays with no coil. Instead of a coil, an external magnet gets close enough to make or break the contacts in the reed. You see these a lot in, for example, door alarm sensors.
Then again, there’s no real finesse to a reed. It changes state when it sees enough of a magnetic field and that’s about all. You could use a compass with some sort of detection on the needle to get some more information about the field, but not much more. That was, however, how early magnetometers worked. Today, you have lots of options, including the nearly ubiquitous Hall effect sensor.
You might use a Hall effect to measure the magnetic button on a keyboard key coming down when you press it or the open and closed state of a valve. A lot of Hall effects see service as current monitors. Since a coil generates a magnetic field proportional to the current through it, a magnetic sensor can estimate the current in a coil of wire without any physical contact. Hall effects can also watch a magnet go by in a linear motion system or a rotating system to get an idea of position or speed. For example, check out this brushless motor controller that uses three sensors to understand the motor’s position.
Edwin Hall identified the effect in 1879. The basic idea is simple: an electrical conductor carrying current will exhibit changes due to an external magnetic field nearby. These changes show up as voltage you measure across the conductor. Normally, the voltage across a conductor will be nearly zero, but with a magnetic field, you’ll get a non-zero reading in proportion to the magnetic field strength in a particular plane, as we’ll see shortly.
Hall effect sensors are just one type of modern magnetometer. There are many different kinds including those that use inductive pickup coils that may or may not rotate or a fluxgate, which is a special type of coil. Some use a scale or a spring to measure force against another magnet — sometimes microscopically. You can even detect a magnetic field using optical properties like the Kerr effect or Faraday rotation.
Then you get into the really exotic sensors. You can also measure proton resonance in hydrogen-rich materials like kerosene or detect energy states in gasses like cesium. Superconducting coils are also on the menu.
Still, Hall effects, especially those using semiconductors, are cheap and plentiful. They are also small. It is hard to imagine your PC keyboard using a superconducting coil to pick up small magnets glued to the bottom of the keys.
How Does it Work?
We like the video from [rcmodelreviews] that talks about the theory behind the Hall Effect (see below). however, the explanation is pretty simple even with no video. Consider a conductive sheet shaped like a dollar bill. Connected across the left and right sides is a constant voltage source, causing a current to flow through the conductor. If you measure the voltage — the Hall voltage — across the top and bottom of the bill, you’d expect the voltage to be nearly zero if the conductor is any good. With no magnetic field present, you would be right. The voltage across the top and bottom will be practically zero volts.
However, when a magnetic field is present with flux lines at right angles to the bias current, a Lorentz force acts on the electrons — or other charge carriers, such as holes — and they will bend away from the force as you can see in this animation. This will cause electrons to group together on one side of the conductor and tend to be absent from the other side.
Hall effect animation is by [FraunhoferIIS], CC-BY-SA-4.0.
This causes the two sides to have different charges, and where we have a charge differential, we must have a voltage. In the animation, you can see the battery providing the current flow and the meter measuring the Hall effect voltage as the horseshoe magnet applies different magnetic fields to the device.
A practical device will have additional circuitry. Usually, there’s an amplifier for the Hall voltage. Sometimes there’s a regulator for the bias voltage. A digital output sensor may have a comparator and an output transistor, too.
Reading the Datasheet
Every device is different, so it pays to read the datasheet for the one you want to use. Hall effects generally have limitations on frequency range and can be rather expensive. Melexis, for example, has a 250 kHz device, and that’s much faster than many other similar products. That particular device requires 5 V and less than 15 mA to operate.
From the datasheet, you can see there are two versions. One can operate up to about 7.5 millitesla and the other works around 20 millitesla. There’s even a version that can work to 60 millitesla. Of course, there are many other choices from other vendors with different parameters.
Some sensors output a voltage proportional to the sensed magnetic field or you can get a digital on/off type sensor. Obviously, if you expect to deploy a sensor, you’ll need different support for whichever sensors you choose to use. In some cases, you don’t even need an external device. The ESP32, for example, has its own Hall effect built in, as you can see in this video.
Building with Hall Effect Sensors
If you want to build your own Hall effect projects, there are plenty to choose from. A portable magnetometer is quite simple and lives in a Tic Tac box. If you are measuring current, you might want to use a device that contains not just the Hall effect sensor, but everything else you need, too.
Or, why not build something new? If you do, though, be sure to send us a note on the tip line, so we can spread the word about your latest creation.