How To Connect A Hall Sensor To Arduino

Table of contents:

How To Connect A Hall Sensor To Arduino
How To Connect A Hall Sensor To Arduino

Video: How To Connect A Hall Sensor To Arduino

Video: How To Connect A Hall Sensor To Arduino
Video: Arduino Tutorial: Hall Effect Sensor from Banggood.com and Arduino Uno. 2024, November
Anonim

A Hall effect sensor is an electrical device that detects changes in a magnetic field. Such sensors are used today in many areas of life. This article discusses connecting a module with a 49E Hall sensor to the Arduino Nano board and reading readings from the sensor.

How to connect a Hall sensor to Arduino
How to connect a Hall sensor to Arduino

Necessary

  • - Module with Hall sensor.
  • - Arduino (any of the family).
  • - Connecting wires.
  • - Computer with Arduino IDE development environment.

Instructions

Step 1

A Hall sensor is a device that records changes in the strength of a magnetic field. Hall effect sensors are widely used in everyday life and industry. So, for example, they are used as:

- rotation speed sensors - used in the automotive industry and wherever it is required to determine the rotation speed of a wheel or other rotating object;

- proximity sensors; a typical example is a folding case on your smartphone, which turns on the backlight of the screen when you open it;

- measurement of the angle of rotation;

- vibration measurement;

- measuring the magnitude of the magnetic field - digital compasses;

- measurement of current strength;

- measurement of air gaps, liquid level, etc.

Hall sensor module
Hall sensor module

Step 2

The Hall sensor module contains the following components: a trimmer, a two-channel comparator, several terminating resistors, a pair of LEDs, and the 49E Hall sensor itself.

The trimmer is used to adjust the sensitivity of the Hall sensor. The first LED indicates the presence of the supply voltage on the module, the second indicates that the magnetic field has exceeded the set operating threshold.

The sensor module has 4 pins. Their connection to the Arduino board is shown in the figure.

Hall sensor wiring diagram to Arduino
Hall sensor wiring diagram to Arduino

Step 3

Let's write a sketch for reading readings from the digital and analog outputs of the sensor. We will poll the sensor every 100 ms and output the values to the serial port.

Hall sensor sketch
Hall sensor sketch

Step 4

Upload the sketch to Arduino and open the serial monitor or any terminal program.

We see two columns with numbers. In the first - the readings of the digital channel. If the value is "0" - the magnetic field does not exceed the specified threshold, if "1" - it exceeds. I brought the magnet to the sensor, and in several lines I ran through the values "1". The threshold is set with a trimming resistor.

And in the second column - the values from the analog channel of the sensor. To understand what they mean, it is necessary to draw up a correspondence table, noting the direction of the magnetic lines (magnet polarity) and the distance of the magnet from the sensor. Based on this table, it will be possible to interpret the readings of the Hall sensor.

Recommended: