KEYES KY-003 Arduino Hall Magnetic Sensor Module is a switch that will turn on/off in the presence of a magnetic field. The KY-003 Hall Magnetic Sensor consists of a 3144EUA-S sensitive Hall-effect switch for high-temperature operation, a 680Ω resistor and a LED. Compatible with popular electronics platforms like Arduino and Raspberry Pi.

What is Hall Effect ?

The Hall effect is the production of a voltage difference (the Hall voltage) across an electrical conductor, transverse to an electric current in the conductor and to an applied magnetic field perpendicular to the current. It was discovered by Edwin Hall in 1879.

Arduino Connections with Hall magnetic sensor KY-003

Arduino Circuit Diagram for Hall sensor
KY-003 Vibration Sensor

Pin (-) = GND, connect to GND of the Arduino
Pin (middle pin) +5 v, connect to Arduino +5
Pin (S) signal, connect to Arduino pin 3
Power consumption, 3 mA in rest, 8 mA when switched on

Arduino code for KY-003 Magnetic Hall sensor

KY-003 Hall magnetic switch

int Led = 13 ; // define LED Interface
int SENSOR = 3 ; // define the Hall magnetic sensor interface
int val ; // define numeric variables val

void setup ()
pinMode (Led, OUTPUT) ; // define LED as output interface
pinMode (SENSOR, INPUT) ; // define the Hall magnetic sensor line as input

void loop ()
val = digitalRead (SENSOR) ; // read sensor line
if (val == LOW) // when the Hall sensor detects a magnetic field, Arduino LED lights up
digitalWrite (Led, HIGH); //Turn on LED
digitalWrite (Led, LOW); //Turn off LED


Observe the on board LED while placing magnet near to sensor and remove magnet to see on off.

More on Hall sensor and its applications

      Frequently, a Hall sensor is combined with threshold detection so that it acts as and is called a switch. Commonly seen in industrial applications such as the pictured pneumatic cylinder, they are also used in consumer equipment; for example some computer printers use them to detect missing paper and open covers. They can also be used in computer keyboards applications that require ultra-high reliability.
      Hall sensors are commonly used to time the speed of wheels and shafts, such as for internal combustion engine ignition timing, tachometers and anti-lock braking systems. They are used in brushless DC electric motors to detect the position of the permanent magnet. In the pictured wheel with two equally spaced magnets, the voltage from the sensor will peak twice for each revolution. This arrangement is commonly used to regulate the speed of disk drives.