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

  • Bipolar Induction: Capable of detecting both positive and negative magnetic fields, expanding its range of applications.
  • Low Noise Output: Provides a stable, low-noise output signal, enhancing measurement accuracy.
  • Single Current Source Output: Ensures a stable output signal, less susceptible to voltage fluctuations, guaranteeing accurate measurement results.
  • Onboard Indicator LED: The onboard LED indicator lights up when a magnetic field is detected, allowing users to easily and intuitively monitor the working status.
  • High Compatibility: Easily integrates with various main controllers such as Arduino, micro:bit, UNIHIKER, and more.

Application Scenarios

  • Current Detection
  • Motor Control
  • Magnetic Field Detection
  • Metal Detector

Technical Specifications

  • Operating Voltage: 3.3~5V
  • Power Supply Current: 4.2-8 mA
  • Magnetic Field Range: ±1200 GS
  • Onboard Indicator LED
  • Detection Distance: <1cm (specific detection distance depends on the intensity and direction of the magnetic field)
  • Data Type: Analog
  • Interface Type: PH2.0-3P
  • Dimensions: 27x32mm
  • Product Weight: 3.5g (total weight including packaging and sensor cable is 12g)
  • Magnetic Pole Range:
  • micro:bit and Arduino (S Pole): 520-1023
  • micro:bit and Arduino (N Pole): 0-500
  • UNIHIKER (S Pole): 2068-4095
  • UNIHIKER (N Pole): 0-2028

Pin Description

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

Package Contents

  • Gravity: Linear/Analog Hall Sensor x 1
  • Gravity: Analog Sensor Connection Cable (30cm) x 1

micro:bit Usage Tutorial

Preparation

Hardware

  • 1 x micro:bit
  • 1 x IO Extender for micro:bit
  • 1 x Linear/Analog Hall Sensor
  • 1 x LED Light
  • 1 x Digital Connection Cable

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

  • 1 x Arduino UNO
  • 1 x I/O Expansion Shield V7.1
  • 1 x Linear/Analog Hall Sensor
  • 1 x LED Light
  • 1 x Digital Connection Cable

Software

  • MindPlus
  • Arduino IDE

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

  • 1 x UNIHIKER
  • 1 x Linear/Analog Hall Sensor
  • 1 x Two-end PH2.0-3P White Silicone Twisted Wire

Software

  • MindPlus

Tutorials

  • UNIHIKER Usage Tutorial
  • MindPlus Usage Tutorial

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