Skip to content

Hall Sensor

Updated: 6/28/2025 Words: 0 words Reading time: 0 minutes

The Hall sensor can detect the presence and magnitude of a magnetic field. Its output voltage is proportional to the strength of the magnetic field, and it can convert changes in the magnetic field into changes in output voltage.

Preparation

Hardware

HardwareDescriptionImage
Creative Box PlatformMy Image
Power Signal ModuleIncluded with Creative Box purchaseMy Image

Choose one of the following Hall sensors:

HardwareDescriptionImage
Hall Switch SensorTaobao Purchase Link, select "Two-wire Normally Open + Magnet" versionMy Image
Hall Switch SensorTaobao Purchase Link

Software

SoftwareLinkDescription
Test ApplicationLinkOfficial frontend application, can be loaded and used directly through the console.

Connection

My Image
Connection
Plug the power signal module into any pin header on the Creative Box. The diagram shows platform pins 4-7
Connect the blue wire of the Hall sensor to ground, connecting to the ground of the power signal module.
Connect the red signal wire of the Hall sensor to the signal output port of the power signal module. In the diagram above, the Hall sensor's signal wire is connected to signal output 1 of the power signal module.
Please set the jumper cap to 5V output position

Usage

Open the Creative Box console and load the API Test application. Enter the application and send the two JSON requests below in sequence. When a magnet approaches the Hall sensor, the platform's green LED lights up; conversely, when the magnet moves away from the Hall sensor, the green LED turns off.

Creative Box ConsoleLoad ApplicationSend First Request, When Hall Sensor Detects Magnet Approaching, Light Up Green LEDSend Second Request, When Hall Sensor Detects Magnet Moving Away, Turn Off Green LED
  • When the Hall sensor detects a magnet approaching, the signal line will change from high level to low level. The JSON request below tells the platform to turn on the green LED when a falling edge is detected on the signal line.
json
{
  "event":"pinstate",
  "pin": 4,
  "trigger": "falling",
  "debounce": 10,
  "actions": [["gpio", "led", "output",0]]
}
  • When the Hall sensor detects a magnet moving away, the signal line will change from low level to high level. The JSON request below tells the platform to turn off the green LED when a rising edge is detected on the signal line.
json
{
  "event":"pinstate",
  "pin": 4,
  "trigger": "rising",
  "debounce": 10,
  "actions": [["gpio", "led", "output",1]]
}

Principles

Hall Effect

My Image

The Hall effect is a fundamental physical phenomenon where, when a solid conductor is placed in a magnetic field and current flows through it, a voltage difference, called the Hall voltage, is generated perpendicular to both the current direction and the magnetic field lines. This effect is used in Hall sensors to measure magnetic fields, detect the presence of magnets, and determine their polarity.

My Image

Since the potential difference generated by a Hall element is very small, a Hall element is usually integrated with an amplifier circuit, temperature compensation circuit, and voltage regulator power supply circuit onto a single chip, which is called a Hall sensor or Hall integrated circuit (Hall Effect IC).

My Image

Types

Hall sensors are divided into three types: linear, switch, and latch.

  • Linear Hall sensors output analog signals. Their output voltage is proportional to the strength of the applied magnetic field, used to detect absolute position or angular motion.
My Image
  • Switch-type Hall sensors output digital signals. They have a predefined magnetic induction intensity threshold. When below this value, the sensor outputs a low level; when above this value, the sensor outputs a high level. Used for simple switching or open/close applications.
My Image
  • Latch-type Hall sensors. They can be used to determine the speed and direction of rotation encoding, as well as the position for motor commutation.
My Image

Applications

Hall sensors have advantages such as sensitivity to magnetic fields, simple structure, small size, wide frequency response, large output voltage changes, and long service life. Therefore, they are widely used in measurement, automation, computer, and information technology fields, including:

  • Proximity Detection: Hall sensors can be used to detect the proximity of magnetic objects. For example, in automotive applications, they are often used to sense crankshaft or camshaft position for engine timing.

  • Current Detection: In some cases, Hall sensors can measure current in a circuit by sensing the magnetic field produced by current flow.

  • Switches: Hall sensors can be used as switches in applications such as door (or window) open/close sensors, security systems, and magnetic encoders.

  • Speed and Position Detection: They can determine the speed and position of rotating parts, such as wheel speed in anti-lock braking systems (ABS), electric bicycle speed detection, or brushless DC motor (BLDC) control.

My Image

Hall sensors are valued for their reliability, durability, and ability to operate in harsh environments, making them important components in various electronic and automotive systems.