Arduino Module: Hall Magnetic Sensor

Arduino Module: Hall Magnetic Sensor

01Basic UnderstandingArduino Module: Hall Magnetic SensorModel:HS-S40PName:Hall MagneticSensorSeries:SensorDescription:This is a magnetic detection module based on the Hall effect principle, which integrates a Hall element and signal conditioning circuit. It can sense changes in the strength and polarity of the surrounding magnetic field and outputs corresponding digital signals (high/low level). It features rapid response, strong anti-interference capability, and long lifespan, making it a core component for detecting the presence of magnetic fields and the motion state of objects, widely used in non-contact control scenarios.Usage Scenarios:Industrial equipment speed monitoring (e.g., attaching a magnet to a motor shaft and counting with the sensor to measure speed); smart home door and window status detection (door magnets linked to automatically turn on lights when the door is closed); security systems (triggering alarms when drawers or cabinets are illegally opened); interactive toys (triggering sound effects when magnetic puzzles are assembled correctly); accessibility aids (controlling appliances with magnetic wristbands to reduce physical activity); aligning with AI education in primary and secondary schools by building “magnetic control cars” and “magnetic field detection devices” to help students understand the principles of the Hall effect and electromagnetic induction, in accordance with the “Guidelines for Artificial Intelligence General Education in Primary and Secondary Schools (2025 Edition)” practical requirements.Disciplinary Integration:Physics, Mathematics, Labor, Information TechnologyEthical Education:The motion data recorded by the sensor (e.g., door/window opening times) may leak user activity patterns, requiring clear boundaries for data collection; strong magnetic field environments may interfere with the sensor, leading to misjudgments, discussing the necessity of “anti-interference design”; the recycling and disposal of Hall elements in electronic waste must consider environmental responsibilities; critical scenarios relying on magnetic control (e.g., safety doors) need to establish emergency plans for technical failures; different standards for magnetic field strength may lead to compatibility issues, reflecting on the significance of a “universal magnetic field detection standard” for technology dissemination.

02Technical Parameters

Working Principle:

The core of the module is the Hall element. When an external magnetic field (such as a magnet) approaches, the charge carriers inside the element are deflected under the Lorentz force, generating a Hall voltage. The circuit amplifies and shapes the Hall voltage, outputting a digital signal: a low level (indicating detection of a magnetic field) when the magnetic field strength exceeds a threshold, and a high level (indicating no detection of a magnetic field) when there is no magnetic field or the magnetic field is weak. It has built-in reverse protection circuitry to prevent damage from reverse power connection.

Parameter Analysis:

G(GND): Power input negative/cathode

V(VCC):Power input positive/anode

S(Signal):Signal output interface

Detection distance: 0-2cm (positively correlated with the strength of the magnet)Response time: ≤10μs (delay from magnetic field change to signal output)Operating temperature: -40℃~85℃ (wide temperature range suitable for industrial environments)Output level: High level 3V-5V, low level ≤0.5VMagnetic field polarity: Sensitive to both north and south poles (no polarity restriction)03Code ExampleArduino Module: Hall Magnetic Sensor

The link pin is D3.

04Safety Measures

1.Power off before wiring, confirm the positive and negative terminals of VCC and GND. Although there is a protection circuit against reverse connection, it may affect detection accuracy;

2. Avoid using in strong magnetic field environments (e.g., near electromagnets or large motors), as this may cause the sensor to continuously output a low level;

3. Do not scratch the surface of the Hall element (the black chip in the center of the module) with sharp objects to prevent damage to the sensing layer;

4. Use in humid environments requires adding a moisture-proof casing, as moisture can cause pin oxidation;

5. During debugging, avoid rapidly and frequently bringing magnets close to prevent signal jitter from affecting judgment;

6. When not in use for a long time, keep a distance from strong magnets (≥10cm) to avoid magnetizing the component;

7. If sharing a power supply with a motor, add a 100μF filter capacitor to reduce electromagnetic interference.

05Extensions

Students can try the following methods:

1. Create a “Tachometer”: Fix a magnet on the motor shaft and count the pulses from the sensor within one minute to calculate the motor speed (unit: revolutions per minute);2. Build a “Door and Window Alarm”: Install the sensor on the door frame and the magnet on the door, triggering the HS-F07P buzzer alarm when the door is opened (magnetic field disappears);3. Design a “Magnetic Password Lock”: Use a combination of multiple Hall sensors and magnets (e.g., magnets arranged in specific positions) to verify correctness and unlock via a relay;4. Develop “Interactive Toys”: Equip a remote-controlled car with a sensor that automatically turns when approaching magnetic obstacles, achieving an obstacle avoidance function.Arduino Module: Hall Magnetic SensorArduino Sensor: HS-S01A Infrared SensorArduino Sensor: HS-S02P Infrared Sensor (Obstacle Avoidance)Arduino Sensor: HS-S03P Ultraviolet SensorArduino Sensor: HS-S05P Sound SensorArduino Sensor: HS-F07P Active BuzzerArduino Sensor: HS-S08P Flame SensorArduino Sensor: HS-S09LB Raindrop SensorArduino Sensor: HS-S09PC Soil Moisture Sensor

Arduino Sensor: HS-S10P Fog Sensor

Arduino Sensor: HS-S11-L Gas Sensor

Arduino Sensor: HS-S20P Ambient Light Sensor

Arduino Sensor: HS-S21P Tilt SensorArduino Sensor: HS-S22P Grayscale SensorArduino Sensor: HS-S23P Infrared Receiver ModuleArduino Sensor: HS-S24P Digital Temperature SensorArduino Sensor: HS-S26A Temperature and Humidity SensorArduino Sensor: HS-S28P Potentiometer

Arduino Sensor: HS-S29P Infrared Transmitter Module

Arduino Sensor: HS-S30P Clock Module

Arduino Sensor: HS-S31P Touch Sensor

Arduino Sensor: HS-S32L Rotary Encoder Module

Arduino Module: HS-S34P Dual-axis Joystick Module

Arduino Module: HS-S37PS Water Level Sensor

Arduino Module: HS-S38P Human Sensor

Arduino Module: Hall Magnetic Sensor

— Previous Recommendations —Arduino Module: Hall Magnetic SensorArduino Module: Hall Magnetic SensorArduino Module: Hall Magnetic SensorArduino Module: Hall Magnetic SensorArduino Module: Hall Magnetic Sensor

Leave a Comment