What's the best way to detect the magnet? Use another magnet. But it's not sensitive enough and you need to feel it by yourself.

This Hall Sensor senses nearby magnetic objects and sends a signal via digital output.

Note: It's a omnipolar magnet dectector so that it can not tell two polarities apart.

Specification

  • Supply Voltage: 3.3V to 5V
  • Indicator LED on board
  • Interface: Digital
  • Size:22 x 30 mm

Parts List

  • Hall Sensor x1
  • Cable x1

 

 
int ledPin = 13;                // choose the pin for the LED
int inputPin = 2;               // choose the input pin  
int val = 0;                    // variable for reading the pin status

void setup() {
	pinMode(ledPin, OUTPUT);      // declare LED as output
	pinMode(inputPin, INPUT);     // declare pushbutton as input
}

void loop(){
	val = digitalRead(inputPin);  // read input value

	if (val == HIGH) {            // check if the input is HIGH
    	digitalWrite(ledPin, LOW);  // turn LED OFF
  	} else {
    	digitalWrite(ledPin, HIGH); // turn LED ON
  	}
}

Hall Sensor

  • Brand: DFRobot
  • Product Code: DFR-SEN0185
  • Reward Points: 7
  • Availability: 3
  • £8.78

  • Ex Tax: £7.32
  • Price in reward points: 100

Magnetic Compass - CMPS03

Magnetic Compass - CMPS03

£26.35

This magnetic compass module has been specifically designed for use in robots as an aid to ...

Qty: 4

Hall Sensor

Hall Sensor

£5.21

Motion sensor and object detection

Out Of Stock

Gravity: 360 Degree Hall Angle Sensor

Gravity: 360 Degree Hall Angle Sensor

£71.94

Miniature 360 degree sensor which works based on the principle of the Hall effect

Qty: 1