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);
	}
}
guest
8 Comments
Inline Feedbacks
View all comments
trackback
Sensori magnetici: reed vs. effetto Hall | scalaeNNe - Note Sparse (Treni, Ferrovie e loro modellazione in Scala N)
10 months ago

[…] versione è pensata (e ben documentata) per Arduino, ma nulla vieta di usarlo invece ai nostri fini anche senza un microcontrollore, come […]

mattia
mattia
1 year ago

guaglio ma come cazzo si feic la simulazione

Ilaria chiodi
Ilaria chiodi
Reply to  mattia
1 year ago

Mattia ricorda di portare quel foglio

Gisele Gotardi
Gisele Gotardi
1 year ago

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?

marc
marc
Reply to  Gisele Gotardi
1 month ago

I have a ky-003 here Gisele and per its datasheet (there’s a Schmitt trigger there) it does appear to hard switch. There are linear sensors but the one on the ky-003 is a solid-state switch by my own tests. The block diagram suggests the trigger is driving the base of an open collector NPN transistor so it can source current directly.

I just checked with one I have here and there’s a very clear hysteresis effect from the Schmitt trigger as so there’s a small “dead spot” (designed) so the device doesn’t stutter as the magnetic passes through the sensitive range.

What you’re thinking of is the KY-024 which is slightly more complex on board but has both digital and analog outputs.

Last edited 1 month ago by marc
simon
simon
2 years ago

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

Jeffrey
Jeffrey
4 years ago

Amazing dood