The Hall Effect Magnetic and Proximity Sensor Module can be used to detect the presence (or absence!) of nearby objects such as magnets.

Module Pinout

GND: Connect to GND (0V) on your microcontroller.

OUTPUT: Active LOW. Normally HIGH, goes LOW in the presence of a magnetic field. Connect to a digital I/O pin on your microcontroller.

VIN: Connect to 5V on your microcontroller.

Basic Usage

The module includes a "TRIGGERED" LED which illuminates when the output is active. To verify operation of the module all you need to connect is GND and 5V, and observe the LED when a magnet is brought near the module.

To detect the state of the output connect the module to an Arduino as shown below. In this example we used Arduino digital I/O pin D12.

The example sketch below reads the state of the module output, and illuminates the LED connected to pin D13 (included on the PCB of most Arduino models) when a magnetic field is detected. Remember that the module output is active LOW, so we check for a LOW reading to determine if the LED should be illuminated.

const int sensorPin = 12;
const int ledPin = 13;

int sensorState = 0;

void setup() {
  pinMode(ledPin, OUTPUT);      
  pinMode(sensorPin, INPUT);     

void loop(){
  sensorState = digitalRead(sensorPin);

  if (sensorState == LOW) {        
    digitalWrite(ledPin, HIGH); // Turn on LED
  else {
    digitalWrite(ledPin, LOW);  // Turn off LED

Copy and paste the sketch above into the Arduino IDE, upload it to your Arduino with the module connected as shown above, and bring a magnet near the module. Observe that the D13 LED on the Arduino illuminates when a magnetic field is present, and extinguishes when it is absent.