A linear magnetic hall sensor or hall-effect sensor is a module named after the physicist Edwin Herbert Hall who discovered the Hall-effect phenomenon. So this sensor detects the magnetic field strength by producing a voltage across a conductor whenever a current is supplied throughout it while arranged in a magnetic field. So it converts the magnetic field strength essentially into an electrical signal. Thus, the examples of linear magnetic hall sensors are KY-024, 49E, A3144, KY-035, etc. This article elaborates on the KY-024 hall sensor, its working & its applications.
What is a KY-024 Hall Sensor?
A linear Hall Effect sensor module is a kind of sensor that detects the magnetic field strength by using the Hall Effect principle along a linear path. So it provides an analog output voltage supply relative to the magnetic field strength by allowing exact magnet position detection because it moves with a linear trajectory. Thus, this sensor is frequently used in applications like object movement detection, robot & vehicle navigation, and motor position measurement within a defined range.
This sensor includes two significant functional components the front sensor unit and the comparator. The front unit physically measures the surroundings & outputs it analog signal to the comparator. So this comparator compares the sensor’s measured value with the set value on the rotating potentiometer. So this outputs a logical high signal on the digital pin & LED if the rotary potentiometer value is exceeded.
How KY-024 Linear Magnetic Hall Sensor Work?
KY-024 linear magnetic hall sensor works by the hall-effect principle that detects the occurrence & strength of a magnetic field. So, it provides both an analog output and a digital output. So, whenever a current-carrying conductor is arranged in a magnetic field then a voltage perpendicular to both the magnetic field & current is generated called the Hall Effect.
The KY-024 module mainly includes a 49E-type hall-effect sensor chip that generates an analog voltage. So it is proportional to the strength of the magnetic field & LM393 a comparator IC that changes the voltage from analog to digital depending on a set threshold.
Whenever the magnetic field strength exceeds or reaches the set threshold, the digital o/p pin will switch to a high logic level that indicates the presence of a magnetic field. At the same time, the analog o/p pin can also provide a voltage level that is proportional to the magnetic field’s strength which allows more detailed measurement.
Pin Configuration:
The KY-024 linear magnetic hall sensor pin configuration is shown below. So this sensor module includes four pins which are explained below.

KY-024 Pin Configuration
- Pin-1 (A0): This is an analog output pin of a sensor module.
- Pin-2(GND): This is a ground pin of a sensor module.
- Pin-3(+V): This is a voltage supply pin of the module.
- Pin-4(D0): This is a digital output pin of a sensor module.
Features & Specifications:
The features and specifications of the KY-024 linear magnetic hall sensor include the following.
- KY-024 is a linear magnetic Hall-effect sensor.
- The KY-024 module uses a Hall-effect sensor to sense magnetic fields linearly so that correct magnetic field strength measurement is possible in a specific direction.
- This sensor provides an analog output that is proportional to the intensity of the magnetic field. So this output can be interfaced easily with different microcontrollers for interpretation & control of data.
- Its operating voltage ranges from 4.5V to 5.5V.
- The module provides high sensitivity to magnetic fields by ensuring precise and consistent detection. So this precision is necessary for applications that need reliable magnetic sensing.
- These are available in small size & lightweight.
- The module functions very efficiently with the least power usage.
- Its power consumption is low.
- Output types are analog & digital.
- These are highly sensitive to magnetic fields.
- Its response time is fast.
- The output signal is proportional to the strength of the magnetic field.
- This module has LED indicators for sensor operation.
- Operating temperature ranges from -40°C to +85°C.
Equivalents & Alternatives :
Equivalent KY-024 linear magnetic hall sensors are; 49E hall-effect sensor, LM393 linear Hall Effect sensor module. So alternative KY-024 linear magnetic hall sensors are; the KY-035 analog hall magnetic sensor module, A3144 hall-effect sensor (or) a giant magnetoresistance (GMR) sensor.
KY-024 Hall Sensor Components
The KY-024 linear magnetic hall sensor includes different components like a 49E linear hall-effect sensor, a potentiometer, an LM393 comparator IC, LEDs, resistors & male header pins. Thus, each component and its functionality is discussed below.

Components
- The 49E linear hall-effect sensor in this module measures the surroundings & provides an analog signal to the LM393 comparator.
- So this dual differential comparator simply compares the measured value of the sensor to the set value of the potentiometer.
- The potentiometer in this module controls the sensitivity of the sensor.
- This module includes two LEDs where one LED specifies that the sensor is getting power whereas the other LED specifies that a magnetic field has been noticed.
- The six resistors in this module restrict the current flow.
- Four male header pins are used to connect the sensor module to any microcontroller board.
KY-024 Hall Sensor Interfacing with Arduino Uno
The KY-024 linear magnetic hall sensor interfacing with Arduino Uno is shown below. So, the required components to make this interfacing mainly include Arduino Uno, KY-024 linear magnetic hall sensor interfacing with Arduino Uno, breadboard, and jumper wires.

KY-024 Linear Magnetic Hall Sensor Interfacing with Arduino Uno
The connections of this interfacing follow as;
- Connect the ‘A0’ pin of the KY-024 linear hall magnetic sensor module to the A0 analog pin on the Arduino Uno.
- Connect the ‘GND’ pin of the sensor module to the GND pin of the Arduino.
- The ‘+Ve’ pin of the sensor module is connected to the 5V pin of the Arduino.
- The ‘D0’ pin of the module is connected to digital pin-2 of the Arduino board.
Code
The required code for the KY-024 linear magnetic hall sensor interfacing with Arduino Uno is shown below.
// Define the pins to which the Linear Hall Sensor Module is connected
const int analogSensorPin = A0;
// Connect the analog output pin to this analog pin
const int digitalSensorPin = 2;
// Connect the digital output pin to this digital pin
void setup() {
// Initialize the Serial communication for debugging
Serial.begin(9600);
// Set the digital sensor pin as input
pinMode(digitalSensorPin, INPUT);
}
void loop() {
// Read the analog value from the Linear Hall Sensor Module
int analogSensorValue = analogRead(analogSensorPin);
// Read the digital value from the Linear Hall Sensor Module
int digitalSensorValue = digitalRead(digitalSensorPin);
// Print the sensor values to the Serial Monitor
Serial.print(“Analog Sensor Value: “);
Serial.println(analogSensorValue);
Serial.print(“Digital Sensor Value: “);
Serial.println(digitalSensorValue);
// Add Conditional Statement to do something if magnet detected
if (digitalSensorValue == 1){
Serial.println(“Magnet Detected”);
}
// Add a short delay for stability
delay(500);
}
Working
First, in the above code, constant variables can be defined to represent the analog and digital pins of the module to which it is connected.
After that, the setup function can be executed whenever the Arduino begins.
The serial communication is initialized for debugging.
The digital sensor pin is set to read digital values as input from the module.
The loop function can be repeatedly executed.
The analog value can be read from the sensor with an analogRead & stored within analogSensorValue.
The digital value can be read from the module with digitalRead & stored within digitalSensorValue.
The analog & digital values can be printed on the serial monitor.
It verifies if a magnet is sensed depending on the digital sensor value.
If the value of the digital sensor is HIGH, it prints as the magnet is detected on the serial monitor.
For stability, it adds a short delay with delay.
The sensitivity adjustment can be done through a trim pot that allows you to modify the sensor’s sensitivity. So by simply adjusting the trim pot, the sensor’s sensitivity can be controlled
Thus, this is very helpful for the sensor’s response fine-tuning to attain the preferred detection range (or) accuracy.
Advantages & Disadvantages
The advantages of the KY-024 linear magnetic hall sensor include the following.
- The KY-024 linear magnetic hall sensors have a compact design.
- Its sensitivity can be adjustable with a potentiometer.
- It has both analog & digital output abilities.
- This module allows exact magnetic field strength & position detection measurement.
- It is simple to use and compatible with different microcontrollers.
- It has a small form factor that allows for integration into fixed spaces in electronic projects.
- A potentiometer allows users to set the preferred threshold mainly for magnetic field detection.
- It provides both analog and digital outputs.
- It provides precise magnetic field strength measurement because of the Hall effect principle.
- This module does not need physical contact with the main object so it leads to a longer lifespan.
- This module can work across a wide magnetic field strength range.
- It is easy to incorporate into projects with readily accessible libraries & code examples.
The disadvantages of the KY-024 linear magnetic hall sensor include the following.
- This module is sensitive to temperature fluctuations.
- It is potential for interference from outside magnetic fields.
- This module has fairly low accuracy as compared to high-precision sensors.
- It required careful magnet placement because of its linear nature, so, the o/p signal might be upturned.
- These sensors can be affected through temperature changes so it can lead to imprecise readings in large temperature variation applications.
- External magnetic fields interrupt the module’s reading, so it needs shielding (or) cautious placement to keep away from interference.
- This module might not supply the precision required for high-accuracy position detection because of its design & resolution.
- This sensor module has a linear nature which means the magnet has to be arranged precisely with the sensor’s axis to get accurate readings.
KY-024 Hall Sensor Applications
The applications of the KY-024 linear magnetic hall sensor include the following.
- A KY-024 hall sensor is used mainly for applications wherever exact detection & measurement of magnetic fields are required like position sensing, current sensing, speed measurement, proximity detection, robotic navigation, and machine components position detection in industrial settings.
- It is used to track the magnetic marker position on a robot arm (or) detect obstacles with magnetic sensors.
- It monitors the machine components’ position like actuators or conveyor belts.
- This module detects the shaft’s rotational speed by measuring the generated magnetic field through a rotating magnet.
- It is used to build proximity sensors to detect the occurrence of metal objects thus, it makes magnetic switches (or) custom magnetic field detection systems design.
- It is used to measure wheel speed (or) throttle position within a car.
- This module detects a door (or) window position with magnetic strips.
- This module is used to design custom sensors to detect magnetic fields within a variety of applications.
Please refer to this link for the KY-024 Hall Sensor Datasheet.
Thus, this is an overview of the KY-024 hall sensor, pin-out, features, specifications, interfacing, pros, cons, and its uses. So this is a linear and versatile magnetic hall sensor that detects the magnetic field strength which provides both analog & digital outputs. This sensor module is used in different applications like position sensing, proximity detection, or the relative strength measuring of a magnetic field, with the capacity to regulate its sensitivity with a potentiometer. Thus, this module acts like a magnetic switch that can be incorporated very easily with different microcontroller platforms because of its readily accessible analog & digital signals. So here is a question for you, what is the A3144 sensor?