Gravity: Linear/Analog Hall Sensor Wiki - DFRobot

Introduction

The Gravity: Linear/Analog Hall Sensor is a high-precision device designed for measuring and monitoring magnetic field strength. With advanced Hall effect circuitry at its core, this sensor converts magnetic induction strength directly into a voltage output.The sensor responds uniquely to magnetic fields: when the south pole of a magnet faces the sensing surface, the magnetic field strengthens, and the output voltage rises above the midpoint, gradually increasing. When the north pole faces the sensing surface, the output voltage falls below the midpoint, gradually decreasing. This high sensitivity makes it ideal for applications that need precise magnetic field detection, such as industrial control, scientific research, security systems, and various electronic devices.

In summary, the Gravity: Linear/Analog Hall Sensor is an efficient and accurate tool for detecting magnetic fields. Whether you're an engineer or an electronics enthusiast, you'll find it extremely useful. It offers reliable performance and precise measurements, making it an invaluable addition to your projects.

Features

Application Scenarios

Technical Specifications

Pin Description

No. Silkscreen Function Description
1 A Output Signal
2 VCC Power Supply (Positive)
3 GND Power Supply (Negative)

Package Contents

micro:bit Usage Tutorial

Preparation

Hardware

Software

Project Description - MakeCode

Place a magnet in the sensor detection area, and print the detected data via the serial port.

Hardware Connection - MakeCode

Example Program - MakeCode

Result

When a magnet's South pole is facing the sensor detection area, the indicator light on the sensor illuminates, and the analog output value is greater than 512. When a magnet's North pole is facing the sensor detection area, the indicator light on the sensor illuminates, and the analog output value is less than 512. (When no magnetic pole is detected, the analog value is between 500-520.)

Detected South Pole Magnet Detected North Pole Magnet
Effect Display
Serial Output:

Project Description - MindPlus

Place a magnet in the sensor detection area, and print the detected data through the MindPlus terminal.

Hardware Connection - MindPlus

Example Program - MindPlus

Result

When a magnet's South pole is facing the sensor detection area, the indicator light on the sensor illuminates, and the analog output value is greater than 512. When a magnet's North pole is facing the sensor detection area, the indicator light on the sensor illuminates, and the analog output value is less than 512. (When no magnetic pole is detected, the analog value is between 500-520.)

Detected South Pole Magnet Detected North Pole Magnet
Effect Display
Serial Output:

Arduino Usage Tutorial

Preparation

Hardware

Software

Project Description

When the Hall circuit faces the S pole of the magnet, the analog value gradually increases. Conversely, when facing the N pole of the magnet, the analog value gradually decreases.

Hardware Connection

Example Program - MindPlus

Example Program - Arduino IDE

int value;

void setup() {
  Serial.begin(9600);
}

void loop() {
  value = analogRead(A0);
  Serial.println(value);
}

Result

When a magnet's South pole is facing the sensor detection area, the indicator light on the sensor illuminates, and the analog output value is greater than 512. When a magnet's North pole is facing the sensor detection area, the indicator light on the sensor illuminates, and the analog output value is less than 512. (When no magnetic pole is detected, the analog value is between 500-520.)

Detected South Pole Magnet Detected North Pole Magnet
Effect Display
Serial Output

UNIHIKER Usage Tutorial

Preparation

Hardware

Software

Tutorials

Project Description - Graphical Programming

Connect the sensor to hardware P21 on the UNIHIKER, then display the data detected by the sensor on the UNIHIKER.

Hardware Connection - Graphical Programming

Example Program - Graphical Programming

Result

When the S pole of the magnet faces the sensor detection area, the indicator light on the sensor illuminates, and the analog output value is greater than 2048. When the N pole of the magnet faces the sensor detection area, the indicator light on the sensor illuminates, and the analog output value is less than 2048. (When no magnetic pole is detected, the analog value is between 2030-2060.)

Detected South Pole Magnet Detected North Pole Magnet
Effect Display

Project Description - Python Code

Connect the sensor to hardware port P21 on the UNIHIKER, and then display the data detected by the sensor on the UNIHIKER.

Hardware Connection - Python Code

Example Program - Python Code

#  -*- coding: UTF-8 -*-

# MindPlus
# Python
from unihiker import GUI


u_gui=GUI()
text=u_gui.draw_text(text="real-time data:",x=20,y=40,font_size=12, color="#000000")
value = 0
data_display =u_gui.draw_text(text=value,x=130,y=40,font_size=12, color="#000000")

while True:
    value = 1623
    data_display .config(text=value)

Note: You can refer to the MindPlus Code Programming Tutorial for a better understanding of how to use Python code mode in MindPlus.

Running Result

When the S pole of the magnet faces the sensor detection area, the indicator light on the sensor illuminates, and the analog output value is greater than 2048. When the N pole of the magnet faces the sensor detection area, the indicator light on the sensor illuminates, and the analog output value is less than 2048. (When no magnetic pole is detected, the analog value is between 2030-2060.)

Detected South Pole Magnet Detected North Pole Magnet
Effect Display

FAQ

More questions and cool idea, please visit DFRobot Forum

More Documents

DFshopping_car1.png Get Gravity: Linear/Analog Hall Sensor from DFRobot Store or DFRobot Distributor.

Turn to the Top