Description
The Hall-Effect Sensor Digital AH3373 can detect the presence or absence of a magnetic field and provides a digital open-drain output.
PACKAGE INCLUDES:
- Hall-Effect Sensor Digital AH3373-P-B
KEY FEATURES OF HALL-EFFECT SENSOR DIGITAL AH3373:
- Senses presence or absence of a magnetic field and provides a digital output
- Open drain output can sink 50mA
- 3V to 28V operation
Hall-effect sensors are commonly used for measuring the speed of rotating assemblies where a magnet on the assembly alternately makes and breaks magnetic contact with the sensor as the assembly rotates. They can also be used for applications such as determining when a door has been opened, position sensing and detecting the magnetic field created by current flow in a wire.
Hall-effect sensors have several advantages over mechanic switches, chief among them are that by being solid-state, there is no concern about contacts wearing out and the switching speed can be quite high.
The sensors are fairly straight forward to integrate with a MCU, especially digital versions like this one where the output is either high or low and can be read the same as a standard mechanical switch would be.
Theory Of Operation
The AH3373 has a digital output which is driven LOW when a magnetic field is detected.
The output has a Schmitt trigger to provide some hysteresis for noise rejection.
When the magnetic field is removed, the output is open-drain and an external resistor is used to pull the output HIGH. Most MCU like Arduino have pull-up resistors that can be enabled on their input pins as we do in the example below so that a physical resistor is not needed for the pull-up.
The sensor does not detect the relative strength of the magnetic field, just its presence which makes it easier to use than an analog Hall-effect sensor. If it is desired to measure the strength of the field, then an analog Hall-effect sensor can be used for that purpose.
In addition, this device is unipolar. This means that one side of the device (the side with the markings) will detect the south pole of a magnet and the other side of the device will detect the north pole. If the sensor does not seem to be detecting the magnetic field, try turning either the magnet or the sensor around.
Power Supply
These devices are able to handle a wide input voltage range of 3.0 to 28V, but will normally be operated off of 3.3V or 5V for compatibility with an attached microcontroller.
OUR EVALUATION RESULTS:
Hall-effect sensors are quite useful in a number of applications and are one of the more under utilized electronic components available to hobbyists.
The main challenge with using Hall-effect sensors usually resides around the mounting of the sensor and any associated magnets.
The program below monitors the output of the sensor and reports when it detects a state change. Simply hook the sensor up to 3.3V or 5V and ground to match the microcontroller and connect the sensor output pin to a digital pin on the microcontroller. We use pin 4 in this example, but it can be any digital pin.
Hall-effect Sensor Digital AH337 Example Program
/* Digital Hall Effect Module Test Basic code for monitoring the output of a digital Hall-effect sensor */ #define SENSOR_PIN 4 // Use any available digital pin int state = 0; // Current state of the sensor int lastState = 0; //Place to save our previous state //=============================================================================== // Initialization //=============================================================================== void setup() { pinMode (SENSOR_PIN, INPUT_PULLUP); // Enable pullup on this pin since sensor output is open collector Serial.begin (9600); // Set output window comm rate } //=============================================================================== // Main //=============================================================================== void loop() { state = digitalRead (SENSOR_PIN); // Read the current state of the sensor if (state != lastState) // State has changed, so print out new state { Serial.print ("Current State: "); Serial.println (state); lastState = state; // Remember last state we were in } }
Notes:
- None
Technical Specifications
Operating Ratings | Vcc Range | 3.0 – 28V |
Output | No magnetic field detected | Open drain (normally pulled up to Vcc) |
Magnetic field detected | 200mV (typical) | |
Output Current | 50mA max | |
Package | SIP-3L | |
Package Type | Plastic, thru-hole | |
Mfr | Diodes Incorporated | |
Datasheet | AH3373 |