Skip to main content

Grove - Hall Sensor

The Hall sensor is based on Hall Effect, which is the production of a voltage difference across an electrical conductor, transverse to an electric current in the conductor and a magnetic field perpendicular to the current. There is a continuous-time switch on this Grove. The output of these devices switches low (turns on) when a magnetic field (south polarity) perpendicular to the Hall sensor exceeds the operate point threshold BOP, and it switches high (turn off) when the magnetic field disappears. The twig can be used to measure RPM.

Version Tracker

Grove - Hall Sensor v0.9bInitial public release3,Oct,2011


  • Grove Compatible Interface
  • 400ns transition period for rise and fall.
  • Continuous-time hall effect sensor
  • Reverse battery protection

More details about Grove modules please refer to Grove System


Supply Voltage3.85.024V
Supply Current4.1-24mA
Operating Temperature-40-85ºC

Platforms Supported

ArduinoRaspberry Pi

The platforms mentioned above as supported is/are an indication of the module's software or theoritical compatibility. We only provide software library or code examples for Arduino platform in most cases. It is not possible to provide software library / demo code for all possible MCU platforms. Hence, users have to write their own software library.

Application Ideas

  • RPM meter.
  • Simple dc motor.

Getting Started


If this is the first time you work with Arduino, we firmly recommend you to see Getting Started with Arduino before the start.

Play With Arduino


The Hall Sensor is used by utilizing the external interrupts available on the arduino/seeeduino. In this example we are using interrupt 0, found on digital pin 2. For other interrupts, see the attachInterrupt().


  • Step 1. Prepare the below stuffs:
Seeeduino V4.2Base ShieldGrove - Hall Sensor
enter image description hereenter image description hereenter image description here
Get One NowGet One NowGet One Now
  • Step 2. Connect Grove - Hall Sensor to port D2 of Grove-Base Shield.
  • Step 3. Plug Grove - Base Shield into Seeeduino.
  • Step 4. Connect Seeeduino to PC via a USB cable.

If we don't have Grove Base Shield, We also can directly connect Grove - Hall Sensor to Seeeduino as below.

SeeeduinoGrove - Hall Sensor
Not ConenctedWhite


  • Step 1. Download the Hall Sensor Code

  • Step 2. Open one of two code. For example Demo MagnetControlLED

  • Step 3. Copy the code into Arduino IDE and upload. If you do not know how to upload the code, please check how to upload code.

// Function: When a magnet whose south pole is facing up is approaching to
// the onboard sensor, the LED will be turned on.Otherwise, the
// LED will be turned off.
// Hardware: Grove - Hall Sensor, Grove - LED
// Arduino IDE: Arduino-1.0
// Author: FrankieChu
// Date: Jan 20,2013
// Version: v1.0
// by
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// Lesser General Public License for more details.
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
/*macro definitions of magnetic pin and LED pin*/
#define HALL_SENSOR 2
#define LED 4//the Grove - LED is connected to D4 of Arduino

void setup()

void loop()
if(isNearMagnet())//if the hall sensor is near the magnet?
void pinsInit()

/*If the hall sensor is near the magnet whose south pole is facing up, */
/*it will return ture, otherwise it will return false. */
boolean isNearMagnet()
int sensorValue = digitalRead(HALL_SENSOR);
if(sensorValue == LOW)//if the sensor value is LOW?
return true;//yes,return ture
return false;//no,return false
void turnOnLED()
void turnOffLED()
  • Step 4. When a magnet whose south pole is facing up is approaching to the onboard sensor, the LED will be turned on. Otherwise, the LED will be turned off.

Play with Codecraft


Step 1. Connect a Grove - Hall Sensor to port D2, and connect a Grove - Red LED to port D4 of a Base Shield.

Step 2. Plug the Base Shield to your Seeeduino/Arduino.

Step 3. Link Seeeduino/Arduino to your PC via an USB cable.


Step 1. Open Codecraft, add Arduino support, and drag a main procedure to working area.


If this is your first time using Codecraft, see also Guide for Codecraft using Arduino.

Step 2. Drag blocks as picture below or open the cdc file which can be downloaded at the end of this page.


Upload the program to your Arduino/Seeeduino.


When the code finishes uploaded, the LED will goes on when Hall Sensor detects changes in the magnetic field.

Schematic Online Viewer


Tech Support & Product Discussion

Thank you for choosing our products! We are here to provide you with different support to ensure that your experience with our products is as smooth as possible. We offer several communication channels to cater to different preferences and needs.

Loading Comments...