hIOTron
Created September 1, 2020 © GPL3+

Interfacing Hall Effect Sensor with Arduino

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

Interfacing Hall Effect Sensor with Arduino

Things used in this project

Hardware components

Hall Effect Sensor
Hall Effect Sensor
×1
Arduino UNO
Arduino UNO
×1
Resistor 10k ohm
Resistor 10k ohm
×1
Resistor 1k ohm
Resistor 1k ohm
×1
LED (generic)
LED (generic)
×1
Connecting wires
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Code

Run a program

Arduino
const byte ledPin = 13;
const byte interruptPin = 2;
volatile byte state = LOW;
int val=0;

void setup() {
pinMode(ledPin, OUTPUT);
pinMode(interruptPin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(interruptPin), test, CHANGE);
Serial.begin(9600);
}

void loop() {
digitalWrite(ledPin, state);
Serial.println(val/2);
}

void test() {
state = !state;
val++;
}

Credits

hIOTron

hIOTron

78 projects • 2 followers
hIOTron is an internet of things based company that offers an IoT Platform, products, IoT Solutions, and IoT Training.

Comments