Back to Tutorial

ESP32 Hall Effect Sensor A3144–Magnetic Field Detection Project

ESP32 Hall Effect Sensor A3144 is a simple and powerful combination used to detect magnetic fields in electronics and IoT projects. By interfacing the A3144 Hall Effect sensor with an ESP32 microcontroller, we can easily detect the presence of a magnet and trigger actions such as counting rotations, monitoring speed, or activating alarms.

In this tutorial, we will learn how to connect the A3144 Hall Effect sensor with ESP32, understand how it works, and write a simple program to detect magnetic fields using the Serial Monitor.


Introduction

The Hall effect sensor is a semiconductor device that detects magnetic fields. When a magnet comes near the sensor, the sensor output changes its state. This change can be read by a microcontroller and used to trigger various actions such as counting rotations, detecting door openings, or monitoring speed.

In this tutorial, we will connect the A3144 Hall sensor to an ESP32 and print the detection status on the Serial Monitor.


What is the Hall Effect?

The Hall effect occurs when a magnetic field is applied perpendicular to the flow of electric current in a conductor. This causes a voltage difference across the conductor. Sensors based on this principle can detect magnetic fields.

The A3144 Hall Effect Sensor is a digital Hall sensor that outputs a LOW signal when a magnet is detected and HIGH when no magnetic field is present.


Components Required

To build this project, you need the following components:

  • ESP32 Development Board
  • A3144 Hall Effect Sensor
  • 10kΩ Pull-up Resistor (optional in some modules)
  • Jumper Wires
  • USB Cable

These components are inexpensive and commonly used in electronics projects.


Pinout of A3144 Hall Effect Sensor

To connect the ESP32 Hall Effect Sensor A3144, you only need three wires.

PinFunction
VCCPower Supply (3.3V–5V)
GNDGround
OUTDigital Output Signal

Circuit Connection

Connect the Hall sensor to the ESP32 as follows:

Hall Sensor PinESP32 Pin
VCC3.3V
GNDGND
OUTGPIO 27

When a magnet comes near the sensor, the output pin changes state and the ESP32 detects it.


How the System Works

  1. The ESP32 continuously reads the signal from the Hall sensor.
  2. When no magnet is present, the sensor output remains HIGH.
  3. When a magnet approaches the sensor, the output becomes LOW.
  4. The ESP32 detects this change and prints the result on the Serial Monitor.

This simple logic allows the ESP32 to detect magnetic fields.

Connection Diagram

ESP32 Hall Effect Sensor A3144–Magnetic Field Detection Project

ESP32 Code for A3144 Hall Effect Sensor

#define HALL_SENSOR 27
#define LED 2

void setup()
{
  Serial.begin(115200);

  pinMode(HALL_SENSOR, INPUT);
  pinMode(LED, OUTPUT);

  Serial.println("Hall Effect Sensor Test");
}

void loop()
{
  int sensorState = digitalRead(HALL_SENSOR);

  if(sensorState == LOW)
  {
    Serial.println("Magnet Detected");
    digitalWrite(LED, HIGH);
  }
  else
  {
    Serial.println("No Magnet");
    digitalWrite(LED, LOW);
  }

  delay(500);
}

Serial Monitor Output

When running the program, the Serial Monitor will display messages such as:

Hall Effect Sensor Test
No Magnet
No Magnet
Magnet Detected
Magnet Detected
No Magnet

The built-in LED on the ESP32 will also turn ON when a magnet is detected.


Applications of Hall Effect Sensors

Hall sensors are widely used in electronics and industrial systems. Some common applications include:

  • Wheel speed measurement in vehicles
  • Contactless switches
  • Door security sensors
  • Brushless DC motor control
  • Position detection systems

Because they detect magnetic fields without physical contact, Hall sensors are very reliable and durable.


Advantages of Using Hall Effect Sensors

Some benefits of Hall sensors include:

  • Contactless detection
  • Long operational life
  • High reliability
  • Fast response time
  • Suitable for industrial environments

These features make Hall sensors useful in many automation systems.


Conclusion

In this project, we learned how to interface the ESP32 Hall Effect Sensor A3144 with an ESP32 microcontroller. The sensor detects magnetic fields and sends a signal to the ESP32, which then displays the result on the Serial Monitor.

This simple project demonstrates the basics of magnetic sensing and can be extended to build more advanced systems such as speed sensors, security systems, and automation devices.

Share this post

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back to Tutorial