Overview

The KY-024 is a linear magnetic field sensor module from the Keyes sensor kit series. Unlike latching or digital Hall switches (such as the A3144), the KY-024 incorporates a 49E / SS49E linear Hall-effect element that outputs a continuous analog voltage proportional to magnetic field strength and polarity (North vs. South magnetic poles).

Equipped with an onboard LM393 differential voltage comparator and a multi-turn trimmer potentiometer, the module provides dual outputs:

  1. Analog Output (AO): Continuous analog voltage reflecting magnetic flux density (1.4 to 3.0 mV/Gauss1.4\text{ to }3.0\text{ mV/Gauss}).
  2. Digital Output (DO): Switches Low (0V) when magnetic field intensity exceeds the threshold set by the potentiometer.

It is widely used for measuring motor shaft RPM, detecting magnet proximity, sensing current strength, and contactless position measurement.

Quick reference

Operating voltage (VCC)3.3 V to 5.5 V DC (5.0 V nominal)
Sensor element49E Linear Hall-Effect Sensor
Quiescent voltage (V0GV_{0G})VCC/22.5VV_{CC} / 2 \approx 2.5\text{V} (at zero magnetic field)
Sensitivity1.4 to 3.0 mV/Gauss1.4\text{ to }3.0\text{ mV/Gauss}
Magnetic polarity responseSouth pole increases VAOV_{AO} above 2.5V2.5\text{V}; North pole decreases VAOV_{AO} below 2.5V2.5\text{V}
OutputsDual Analog Voltage (AO) & Digital LM393 Comparator (DO)
IndicatorsPower LED (red) + Digital Alarm Output LED (green)

Pinout

Standard 4-pin 0.1" (2.54 mm) breakout module header:

PinNameTypeDescription
1AOAnalog OutputContinuous analog voltage output (0.5V0.5\text{V} to VCC0.5VV_{CC}-0.5\text{V})
2GNDPowerGround reference (0 V)
3VCC / +PowerSupply input (+3.3 V to +5.5 V DC)
4DODigital OutputLM393 comparator digital output (Low when magnetic field threshold exceeded)

Specifications

ParameterSymbolMinTypMaxUnitConditions
Supply VoltageVCCV_{CC}3.35.05.5VDC
Quiescent Output VoltageV0GV_{0G}2.252.502.75VB=0 GaussB = 0\text{ Gauss}, VCC=5.0VV_{CC} = 5.0\text{V}
SensitivitySensSens1.41.83.0mV/GMeasured at 25C25^\circ\text{C}
Magnetic RangeBrangeB_{range}-1000+1000GaussLinear operating range
Output Current Sink/SourceIoutI_{out}1.510mAAnalog output pin
Operating CurrentICCI_{CC}1520mABoard operating current

Analog Output Voltage Math

The analog output voltage VAOV_{AO} responds linearly to magnetic flux density BB (in Gauss):

VAO=V0G+(Sens×B)V_{AO} = V_{0G} + (Sens \times B)

For a typical 5.0V5.0\text{V} supply (V0G=2.50VV_{0G} = 2.50\text{V} and Sens=1.8 mV/GaussSens = 1.8\text{ mV/Gauss}):

  • No Magnet Present (B=0 GB = 0\text{ G}): VAO=2.50V(ADC512)V_{AO} = 2.50\text{V} \quad (ADC \approx 512)
  • South Pole Approaching (B=+500 GB = +500\text{ G}): VAO=2.50V+(0.0018×500)=3.40V(ADC696)V_{AO} = 2.50\text{V} + (0.0018 \times 500) = 3.40\text{V} \quad (ADC \approx 696)
  • North Pole Approaching (B=500 GB = -500\text{ G}): VAO=2.50V(0.0018×500)=1.60V(ADC327)V_{AO} = 2.50\text{V} - (0.0018 \times 500) = 1.60\text{V} \quad (ADC \approx 327)

Wiring

KY-024 PinArduino UnoESP32Notes
VCC (+)5V / 3.3V3.3VPower rail
GNDGNDGNDSystem ground
AOAnalog Pin A0VP / GPIO36Analog magnetic flux voltage
DODigital Pin D2GPIO 4Digital threshold trigger

Example

cpp
const int hallAnalogPin = A0;
const int hallDigitalPin = 2;

void setup() {
  Serial.begin(9600);
  pinMode(hallDigitalPin, INPUT);
}

void loop() {
  int rawADC = analogRead(hallAnalogPin);
  int digitalState = digitalRead(hallDigitalPin);

  float voltage = (rawADC / 1023.0) * 5.0;
  // Estimate Gauss relative to 2.5V zero-point (1.8 mV/Gauss)
  float gauss = (voltage - 2.50) / 0.0018;

  Serial.print("Raw ADC: "); Serial.print(rawADC);
  Serial.print(" | Voltage: "); Serial.print(voltage); Serial.print(" V");
  Serial.print(" | Field: "); Serial.print(gauss); Serial.print(" Gauss");
  Serial.print(" | DO: "); Serial.println(digitalState == LOW ? "TRIGGERED" : "NORMAL");

  delay(200);
}

Common mistakes

  • Expecting digital latching behavior: Unlike the A3144 (which latches digital output state), the KY-024 phototransistor output is linear. The digital DO pin only triggers while the magnet is physically close to the sensor.
  • Ignoring magnetic orientation: Placing a magnet upside down flips the voltage direction (e.g. from >2.5V>2.5\text{V} to <2.5V<2.5\text{V}). Reverse the magnet face if DO fails to trigger.

Notes

  • KY-024 vs A3144: KY-024 provides continuous analog voltage and dual outputs using the 49E linear element; A3144 provides open-collector digital switching only.

Assets & downloads