Interfacing Hall Effect Sensor With Arduino

Photo of hIOTron

Made by hIOTron / IoT

About the project

In this project, we have used a hall sensor that is able to detect a magnet and also the pole of the magnet.

Project info

Difficulty: Moderate

Platforms: Arduino

Estimated time: 2 days

License: GNU General Public License, version 3 or later (GPL3+)

Items used in this project

Hardware components

Arcade Button and Switch Quick-Connect Wires - 0.25 (10-pack) Arcade Button and Switch Quick-Connect Wires - 0.25 (10-pack) x 1
Tiny Breadboard Tiny Breadboard x 1
Resistor 1K Ohm 1/4 Watt PTH - 20 pk Resistor 1K Ohm 1/4 Watt PTH - 20 pk x 1
Resistor 10K Ohm 1/4 Watt PTH - 20 pk Resistor 10K Ohm 1/4 Watt PTH - 20 pk x 1
Arduino MKRFOX 1200 Arduino MKRFOX 1200 x 1
Digital-Latch Hall Effect Sensor Digital-Latch Hall Effect Sensor x 1

Software apps and online services

Arduino IDE Arduino IDE

Story

About Project

HallEffect Sensor:

Few tips about Hall Sensor are as follows: The digital Hall sensor can only recognize if a magnet is present or not (0 or 1) but an analog hall sensor’s output varies depends on the magnetic field around the magnet that is it can recognize how powerful or how distant the magnet is. This project will direct only at the digital Hall sensors for they are the most usually utilized ones.

As per law “when a conductor or semiconductor with current flowing in one direction was organized perpendicular to a magnetic field a voltage could be estimated at right angles to the current path”.

With the help of this technique, the hall sensor will be capable to recognize the appearance of the magnet around it.

Hall Sensor Effect

Hall Sensor Effect

Hall Sensor Effect

Arduino Hall Effect Sensor Working

Once we upload the code to the Arduino. We have utilized a 9V battery to power the whole set-up you can utilize any preferable power source. Now take the magnet close to the sensor and your LED will shine and if you get it away it will turn off.

What really happens inside is, when we take the magnet close to the sensor modifies its state. This change is sensed by the interrupt pin which will ask the toggle function inside which we change the variable “state” from 0 to 1. Hence the LED will turn on.

Now, when we drive the magnet away from the sensor, again the output of the sensor will develop. This change is again mentioned by our interrupt statement and hence the variable “state” will be modified from 1 to 0. Thus the LED if Turned off. The same repeats every time you take a magnet close to the sensor.

Code

Run a program

Credits

Leave your feedback...