Phipps Electronics

Order within the next 

FREE SHIPPING OVER $199

50,000+ ORDERS

WORLDWIDE SHIPPING

SSL SECURED

Using the Magnetic Hall Sensor KY-003 with Arduino

Contents

Introduction

In this tutorial, we will learn about the KY-003 module, what is a Hall-effect switch and we will build a simple project to sense magnetic fields using the KY-003 with an Arduino.

Magnetic Hall Sensor KY-003

The KY-003 Module will be our main component for this tutorial. This module has a 3144EUA-S Hall-effect switch IC and mounted on a breakout board with an LED and resistor. Figure 1 shows the module as seen in fritzing.

Figure 1: KY-003 Magnetic Hall Sensor

Pinout

The KY-003 module has three pins.

Component PinArduino Uno board Pin
(-)GND
middle+5V
SSignal

What is a Hall-Effect Switch?

A hall effect switch changes its state when it senses a magnetic field. In the case of our module, it connects its Signal pin to Ground (GND) whenever it senses a magnetic field nearby. Figure 2 shows the Block Diagram of the IC taken from its datasheet.

Figure 2: Block Diagram

Project - Arduino Magnetic Field Detector

After learning about the KY-003 module and the 3144EUA-S IC, it is now time to build a project using the module. Our project will activate the built-in LED of an Arduino Uno when there is a magnetic field near the KY-003 module.

Components

For this project, we need the following components:

  • Arduino Uno board (1 pc.)
  • KY-003 Magnetic Hall Sensor (1 pc.)
  • Jumper wires

Wiring Diagram

Figure 3: Connection Diagram

Figure 3 shows the connection between the Arduino Uno and the KY-003 Magnetic Hall Sensor.

The KY-003 module pins are connected to the Arduino Uno board as follows:

Component PinArduino Uno board Pin
(-)GND
middle+5V
S10

The Code

Below is the Arduino sketch for our project. I have added comments to explain important parts of the code. Save the code as KY-003.ino and upload it to your Arduino board.

				
					// Arduino and KY-003 module tutorial
void setup() {
  pinMode(10, INPUT_PULLUP);  // KY-003 module is connected to pin 10
  pinMode(13, OUTPUT);        // pin 13 is internally connected to built-in LED
}
void loop() {
  // check if KY-003 senses a magnetic field
  if(digitalRead(10) == LOW) digitalWrite(13, HIGH);  // switch On LED if KY-003 senses a magnetic field nearby
  else digitalWrite(13, LOW);   // switch Off LED 
}
				
			

Project Test

Apply power to your Arduino Uno board. If a magnet is placed near the KY-003 module, the Arduino’s built-in LED will light-up.

SUBSCRIBE FOR NEW POST ALERTS

Subscribe to be the first to know when we publish a new article!
List Subscriptions(Required)

POPULAR POSTS

Scroll to Top