How to use Linear Magnetic Hall sensor module (KY024)
KY-024 Linear Magnetic Hall Effect Sensor
Precision Magnetic Field Detection for Arduino and Embedded Systems
Introduction
The KY-024 Linear Hall Sensor is a magnetic field detection module based on the 49E analog Hall-effect sensor. It provides both analog and digital outputs proportional to magnetic field strength, making it ideal for position sensing, speed detection, and current measurement applications.
Key Features
Linear Output
Analog voltage proportional to field strength
Dual Output
Analog + Digital (threshold-triggered)
Adjustable
Sensitivity potentiometer for digital output
Easy Interface
3.3V/5V compatible with standard pins
Technical Specifications
Operating Voltage | 3.3V – 5V DC |
---|---|
Output Type | Analog (0-VCC) + Digital (0/1) |
Sensitivity | 1.3mV/G (typical) |
Measurement Range | ±1000 Gauss (analog) |
Response Time | 5μs (typical) |
Current Consumption | 4-8mA |
Pin Configuration

Pin | Label | Description | Arduino Connection |
---|---|---|---|
1 | GND | Ground | GND |
2 | + | Power (3.3V-5V) | 5V |
3 | D0 | Digital Output | D2 (Digital Input) |
4 | A0 | Analog Output | A0 (Analog Input) |
Note: Blue potentiometer adjusts digital output threshold
Wiring Diagram (Arduino)
// Basic Connections: // GND → GND // + → 5V // D0 → D2 (Digital Input) // A0 → A0 (Analog Input) // For magnetic sensing: // - South pole increases output voltage // - North pole decreases output voltage // - No field ≈ VCC/2
Basic Magnetic Detection
const int analogPin = A0; const int digitalPin = 2; void setup() { Serial.begin(9600); pinMode(digitalPin, INPUT); } void loop() { int analogValue = analogRead(analogPin); int digitalValue = digitalRead(digitalPin); Serial.print("Analog: "); Serial.print(analogValue); Serial.print(" | Digital: "); Serial.println(digitalValue); delay(200); }
Advanced Applications
Field Strength Calculation
// Convert analog reading to Gauss
float voltage = analogValue * (5.0 / 1023.0);
float zeroFieldVoltage = 2.5; // VCC/2
float sensitivity = 1.3; // mV/G
float gauss = (voltage - zeroFieldVoltage) * 1000 / sensitivity;
Serial.print(gauss); Serial.println(" Gauss");
Speed Measurement
// Measure RPM using magnet on rotating shaft
unsigned long lastPulse = 0;
float rpm = 0;
void loop() {
if(digitalRead(digitalPin) == HIGH) {
rpm = 60000 / (millis() - lastPulse);
lastPulse = millis();
Serial.print(rpm); Serial.println(" RPM");
}
}
Current Sensing
// Measure current via magnetic field
// Using split-core transformer principle
float current = gauss / 10.0; // 10G per amp
Serial.print(current); Serial.println(" A");
Position Detection
// Linear position via moving magnet
int position = map(analogValue, 0, 1023, 0, 100);
Serial.print("Position: ");
Serial.print(position);
Serial.println("%");
Troubleshooting
No Analog Response
- Verify magnet polarity (try flipping)
- Check analog pin connection
- Test with stronger magnet (neodymium recommended)
Digital Output Always High/Low
- Adjust sensitivity potentiometer
- Check threshold voltage with multimeter
- Ensure magnet is within 1-2cm range
Unstable Readings
- Add 0.1μF capacitor between VCC and GND
- Keep away from EMI sources
- Implement software averaging
Related Posts
IC 74173 – 4-Bit D-Type Register with 3-State Outputs
IC 74173 - 4-Bit D-Type Register with 3-State Outputs
TTL Quad D Flip-Flop with Asynchronous Clear and Output Enable
...
DIY Metal Detector Kit
DIY Metal Detector Kit
DC 3V-5V Non-Contact Sensor Module with 60mm Detection Range
Introduction
The DIY Metal Detec...
CNC V3 Shield with 4 A4988 Drivers
CNC V3 Shield with 4 A4988 Drivers
Complete Arduino-compatible CNC controller for 3D printers and milling machines
...
CN3791 12V MPPT Solar Charger Module
CN3791 12V MPPT Solar Charger Module
Maximum Power Point Tracking Solar Charge Controller for Lead-Acid/Lithium Batteries
...
CJMCU-TRRS 3.5mm Jack AV Stereo Module
CJMCU-TRRS 3.5mm Jack AV Stereo Module
Compact breakout board for audio/video signal interfacing with TRRS connectors
...
TTP223 Capacitive Touch Sensor Module (Red)
TTP223 Capacitive Touch Sensor Module (Red)
Single-Key Touch Detection with Digital Output for Arduino and DIY Projects
...
Capacitive Soil Moisture Sensor
Capacitive Soil Moisture Sensor
Corrosion-Resistant Humidity Detection for Plants and Agricultural Applications
Intro...
VHM-314 Bluetooth Audio Receiver Board Module
VHM-314 Bluetooth Audio Receiver Board Module
High-fidelity stereo audio receiver with Bluetooth 5.0 and 3.5mm audio output
...
BD243 DIY Mini Tesla Coil Prototyping Kit
BD243 DIY Mini Tesla Coil Prototyping Kit
High-Voltage Wireless Power Demonstration - Build Your Own Spark Gap Tesla Coil
...
BF120-3AA Precision Strain Gauges (120Ω)
BF120-3AA Precision Strain Gauges (120Ω)
High-precision foil strain gauges for load cell applications with 120Ω resistance
...
Recent Comments