Arduino Code and Video Hall Sensor Module

Arduino Code and Video Hall Sensor Module

In this tutorial, we will explore how to use a Hall Sensor module with Arduino to detect magnetic fields. The Hall Sensor will be used to trigger an action when it detects a magnetic field, and we will display the results on the Serial Monitor. The outcome is a simple yet effective way to integrate magnetic sensing into your projects, giving you a foundation to expand further. For more detailed explanations, be sure to check out the video (in video at 00:00).

3144 hall sensor module
3144 hall sensor module

Hardware Explained

The Hall Sensor module is designed to detect magnetic fields and is commonly used in various applications, including proximity sensing and speed detection. When a magnetic field is present, the sensor outputs a signal that can be read by the Arduino. This allows the Arduino to know when an object with a magnetic field is nearby.

In this project, we will also use a buzzer as the action device. When the Hall Sensor detects a magnetic field, the Arduino will activate the buzzer to provide an audible alert. The basic components involved are the Hall Sensor, the Arduino board, and the buzzer.

Datasheet Details

ManufacturerHoneywell
Part numberSS495A1
Logic/IO voltage4.5 – 10 V
Supply voltage4.5 – 10 V
Output current (per channel)20 mA max
Peak current (per channel)50 mA max
PWM frequency guidanceN/A
Input logic thresholds0.7 V (high), 0.3 V (low)
Voltage drop / RDS(on) / saturation0.4 V max
Thermal limits-40 to +85 °C
PackageTO-92
Notes / variantsAvailable in different sensitivities

  • Ensure proper power supply within the specified voltage range.
  • Be mindful of the output current limits to avoid damaging the module.
  • Use a pull-up resistor if necessary for stable readings.
  • Keep the sensor away from strong electromagnetic fields that may cause interference.
  • Calibrate the sensor according to the specific application needs.

Wiring Instructions

Arduino wiring for 3144 Hal sensor module (black)
Arduino wiring for 3144 Hal sensor module (black)
Arduino wiring for 3144 Hal sensor module
Arduino wiring for 3144 Hal sensor module

To wire the Hall Sensor module to the Arduino, start by connecting the sensor's VCC pin to the Arduino's 5V pin for power. Next, connect the GND pin to the Arduino's GND pin to complete the circuit. The output pin of the Hall Sensor, typically marked as OUT, should be connected to digital pin 2 on the Arduino.

For the buzzer, connect the positive terminal to digital pin 8 on the Arduino, and connect the negative terminal to the GND. This setup allows the Arduino to read the sensor's output and activate the buzzer when a magnetic field is detected.

Code Examples & Walkthrough

The following code initializes the Hall Sensor and the buzzer. It defines pins for the sensor and the action. The main loop reads the sensor status and activates the buzzer accordingly.

3144 hall sensor module black

#define DETECT 2 // pin 2 for sensor
#define ACTION 8 // pin 8 for action to do something

void setup() {
  Serial.begin(9600);
  pinMode(DETECT, INPUT); // define detect input pin
  pinMode(ACTION, OUTPUT); // define ACTION output pin
}

In this code, the DETECT variable is assigned to pin 2, which is used to read the sensor. The ACTION variable is assigned to pin 8, where the buzzer is connected. The setup function initializes the serial communication and sets the pin modes.


void loop() {
  int detected = digitalRead(DETECT); // read Hall sensor
  if (detected == LOW) {
    digitalWrite(ACTION, HIGH); // set the buzzer ON
    Serial.println("Detected!");
  } else {
    digitalWrite(ACTION, LOW); // Set the buzzer OFF
    Serial.println("Nothing");
  }
  delay(200);
}

This part of the code continuously checks the status of the Hall Sensor. If the sensor detects a magnetic field (when detected is LOW), it turns the buzzer ON and prints "Detected!" to the Serial Monitor. If no field is detected, it turns the buzzer OFF and prints "Nothing".

Wirig relay module to AC load
3144 hall sensor module

Demonstration / What to Expect

When you run the code, the Arduino will constantly monitor the Hall Sensor for any magnetic field. If a magnetic field is detected, the buzzer will sound, and you will see "Detected!" printed on the Serial Monitor. If no magnetic field is present, the buzzer will remain off, and "Nothing" will be displayed. Be cautious with wiring to avoid reversed connections, which could lead to failure in detection (in video at 06:15).

Video Timestamps

  • 00:00 - Introduction to Hall Sensor Module
  • 02:30 - Wiring Explanation
  • 05:00 - Code Walkthrough
  • 08:15 - Demonstration

Images

Wirig relay module to AC load
Wirig relay module to AC load
3144 hall sensor module black
3144 hall sensor module black
3144 hall sensor module
3144 hall sensor module
3144 hall sensor module
3144 hall sensor module
3144 hall sensor module
3144 hall sensor module red
Arduino wiring for 3144 Hal sensor module (black)
Arduino wiring for 3144 Hal sensor module (black)
Arduino wiring for 3144 Hal sensor module
Arduino wiring for 3144 Hal sensor module
3144 hall sensor module
3144 hall sensor module
65-Hall sensor module for Arduino
Language: C++
Copied!

Things you might need

Resources & references

Files📁

No files available.