In the previous article, we discussed detecting the magnetic field using the reed switch sensor module. The functionality of detecting the magnetic field by the linear magnetic hall sensor has some differences to the reed switch sensor. The reed sensor is an electrical switch in which it consists of a pair of contacts on ferrous metal reeds which is open and will only close when a magnet placed near the reed sensor. The linear magnetic hall sensor is a transducer that the output voltage may change in response to changes in magnetic field. Hall effect sensor performs similar function as a reed switch, but with no moving parts. Another difference is the placing of the orientation of the magnet near these two sensors. For a reed switch sensor, the pair of reed contacts will close if the magnet placed parallel, in which both the poles (N & S) of the magnet are near to the reed switch sensor. For linear magnetic hall module, the sensor will activate only if the magnet will be placed perpendicular to the reed switch, where the South (S) pole of the magnet facing to the reed switch sensor.
The linear magnetic hall sensor reacts in the presence of a magnetic field. It means that the output signal produced by a linear magnetic hall sensor is a function of magnetic field density around it. When the magnetic flux density around it exceeds a specific threshold value, the sensor detects it and generates an output voltage to indicate the presence of the magnetic field. If the module has a built-in potentiometer, the threshold value can be changed.
In the figure above is the digital linear magnetic hall module consists of a 3144EUA-S sensitive hall-effect switch, 1 680 ohms and led. It has three pins, where the "S" pin should connect to the digital pin or Arduino. The operating voltage is from 4.5V to 24V.
In the figure above is an analog magnetic hall module consists of a 49E sensitive hall-effect sensor. It has three pins, where the "S" pin should connect to the analog pin of Arduino. The operating voltage is from 4.5V to 24V.
In the figure above is the magnetic hall module with a built-in potentiometer and with extra signal pin (A0). It consists of a 49E linear Hall-effect sensor, an LM393 dual differential comparator, a potentiometer, two LEDs and six resistors. The operating voltage is from 2.7V to 6.5V.
See below for the sample code to test the module The Arduino will be programmed such that when a magnet is near to the linear magnetic hall sensor, the LED lights on and when the magnet is removed, the LED lights off.
Sample Code for Analog and Digital Output of Linear Magnetic Hall Module
Upload and test the code. The built-in LED will turn on when a magnetic hall module detects the magnetic field. To demonstrate, place a sample magnet near the magnetic module. The analog output of a magnetic hall starts at an initial value which is determined by the input voltage and the potentiometer: the value increases or decreases depending on the polarity and intensity of the magnetic field.
Note: You may use the serial plotter of Arduino editor to see the visual effect of the magnetic field (Tools -> Serial Plotter)
Now you know the capability of Linear Magnetic Hall Sensor Module. Magnetic Hall sensor is used in many different applications like in automotive systems to detect position, measure distance and speed. It is also used in smartphones and in separate switches where the presence of a magnetic field is used to either activate or deactivate the device. You may start thinking about any project that you may use this magnetic hall sensor.