KY-003 Hall Magnetic Sensor Module

Description

KEYES KY-003 Arduino Hall Magnetic Sensor Module is a switch that will turn on/off in the presence of a magnetic field.

Specification

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.

Operating Voltage4.5V to 24V
Operating Temperature Range-40°C to 85°C [-x°F to x°F]
Dimensions 18.5mm x 15mm [0.728in x 0.591in]

Connection Diagram

Connect the Power line (middle) and ground (-) to +5 and GND respectively. Connect signal (s) to pin 3 on the Arduino.

KY-003Arduino
SPin 3
middle+5V
-GND
Arduino KY-003 connection diagramclick to enlarge

Example Code

The KY-003 Arduino sketch will light up the LED on pin 13 when a magnetic field is detected.

int led = 13;//LED pin
int sensor = 3; //sensor pin
int val; //numeric variable

void setup()
{
	pinMode(led, OUTPUT); //set LED pin as output
	pinMode(sensor, INPUT); //set sensor pin as input
}

void loop()
{
	val = digitalRead(sensor); //Read the sensor
	if(val == LOW) //when magnetic field is detected, turn led on
	{
		digitalWrite(Led, HIGH);
	}
	else
	{
		digitalWrite(Led, LOW);
	}
}

4
Leave a Reply

avatar
3 Comment threads
1 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
4 Comment authors
Gisele GotardiArduinoModulessimonJeffrey Recent comment authors
Gisele Gotardi
Gisele Gotardi

Is the output of this sensor digital or analog? I saw a video of a guy who tested the ky-003 and the serial plotter showed a linear output according to the strength of the magnetic field. However, I always find in the descriptions of the ky-003 that it is a digital sensor. Could you help me with this clarification?

simon
simon

this line should be… 14 if(val == LOW)

Jeffrey
Jeffrey

Amazing dood