edit

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

Revision Descriptions Release
Grove - Hall Sensor v0.9b Initial public release 3,Oct,2011

Features

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

Tip

More details about Grove modules please refer to Grove System

Specifications

Item Min Typical Max Unit
Supply Voltage 3.8 5.0 24 V
Supply Current 4.1 - 24 mA
Operating Temperature -40 - 85 ºC

Platforms Supported

Arduino Raspberry Pi BeagleBone Wio LinkIt ONE

Caution

The platforms mentioned above as supported is/are an indication of the module's hardware 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

Note

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

Demonstration

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().

Hardware

  • Step 1. Prepare the below stuffs:
Seeeduino V4.2 Base Shield Grove - Hall Sensor
enter image description here enter image description here enter image description here
Get One Now Get One Now Get 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.

Note

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

Seeeduino Grove - Hall Sensor
5V Red
GND Black
Not Conencted White
D2 Yellow

Software

  • 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.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/****************************************************************************/  
//  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 www.seeedstudio.com
//
//  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
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//  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()
{
    pinsInit();
}

void loop() 
{
    if(isNearMagnet())//if the hall sensor is near the magnet?
    {
        turnOnLED();
    }
    else
    {
        turnOffLED();
    }
}
void pinsInit()
{
    pinMode(HALL_SENSOR, INPUT);
    pinMode(LED,OUTPUT);
}

/*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
    }
    else
    {
        return false;//no,return false
    }
}
void turnOnLED()
{
    digitalWrite(LED,HIGH);
}
void turnOffLED()
{
    digitalWrite(LED,LOW);
}
  • 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.

Resources

Tech Support

Please submit any technical issue into our forum.