Arduino Tutorial: How to use the Hall Effect Sensor

Home/Arduino Projects/Arduino Tutorial: How to use the Hall Effect Sensor

Arduino Tutorial: How to use the Hall Effect Sensor

Arduino Tutorial: How to use the Hall Effect Sensor

The Hall Effect sensor is a very useful sensor to use in many projects. It is very easy to use as you can see in this easy Arduino Tutorial.

Today’s project is this: When I place a magnet close to the sensor, an LED lights up in order to inform us that it detected a magnetic field. It is a very easy project to build but very useful as well.

The sensor that we are using is called a Hall Effect sensor, a sensor that it can detect the presence of a magnetic field. The sensor is very cheap, this module I got for Arduino costs around 1.5$ and you can find a link for it in the description of the video. The sensor is used in many devices that we use daily.

It is used in your bicycle computer in order to calculate your speed, it can be found on every brushless motor, in many cell phones, in the fuel tank of your car, in security systems, computers, printers and so on. Think of it, as a contactless switch! It is like turning on or off a switch without having to touch it, from a small distance. The applications for this sensor are countless!

——————–
Hall Effect Sensor Project Parts  – WHERE TO BUY
——————–

1. Hall Effect Sensor: http://bit.ly/HallEffect

2. Cheap Arduino Uno: http://bit.ly/Cheap_Uno

3. Breadboard mini: http://bit.ly/MiniBreadboard

4. LED: http://bit.ly/375LEDS

5. Wires: http://bit.ly/WiresArduino

6. Magnets: http://bit.ly/2d8qVqT

 

——————–
CODE OF THE PROJECT
——————–

DOWNLOAD THE CODE

 

 

——————–
SUBSCRIBE ON YOUTUBE
——————–

Never miss a video: Subscribe to educ8s.tv

2017-03-31T12:22:16+00:00

4 Comments

  1. vandenbrande January 25, 2016 at 8:58 pm - Reply

    Cool! I made one with a Arduino Nano.. always handy this stuff. Where are you from? Italy?

    Ciao!

    • konstantinos February 10, 2016 at 11:23 pm - Reply

      I could recognize that pronounciation everywhere….he s from Greece 100%

  2. vandenbrande January 25, 2016 at 11:11 pm - Reply

    Hey i made one with a buzzer
    Here below is the code.
    Its pretty cool, i had a arduino nano DIY that i had to solder. used it for this.
    One of my first own soldered microcontrollers.

    int hallSensorPin = 2;
    int ledPin = 13;
    int state = 0;
    int buzzer2 = 9;
    void setup() {
    pinMode(ledPin, OUTPUT);
    pinMode(hallSensorPin, INPUT);
    pinMode(buzzer2, OUTPUT);
    delay(1000);
    Serial.begin(9600);
    }

    void loop(){
    beep(200);
    }

    void beep(unsigned char delayms){
    state = digitalRead(hallSensorPin);

    if (state == LOW) {
    digitalWrite(ledPin, HIGH);
    analogWrite(buzzer2, 1);
    delay(50);
    digitalWrite(ledPin, LOW);
    analogWrite(buzzer2, 50);
    delay(50);
    digitalWrite(ledPin, HIGH);
    analogWrite(buzzer2, 1);
    delay(50);
    digitalWrite(ledPin, LOW);
    digitalWrite(buzzer2, 200);
    delay(50);
    digitalWrite(ledPin, HIGH);
    digitalWrite(buzzer2, 1);
    delay(50);
    Serial.println(“Detector:”);
    delay(50);
    Serial.println(“MAGNETIC FIELD DETECTED”);
    }
    else {
    digitalWrite(ledPin, LOW);
    delay(100);
    digitalWrite(ledPin, HIGH);
    Serial.println(“Detector:”);
    delay(1000);
    Serial.println(“NOTHING DETECTED”);
    }
    }

  3. vandenbrande January 25, 2016 at 11:24 pm - Reply

    Here is another code! i simply change the If en Else section. Now you can make a alarm from it.
    You can add a magnet to some device for example. when the device is removed from the magnet a alarm will go off.

    int hallSensorPin = 2;
    int ledPin = 13;
    int state = 0;
    int buzzer2 = 9;
    void setup() {
    pinMode(ledPin, OUTPUT);
    pinMode(hallSensorPin, INPUT);
    pinMode(buzzer2, OUTPUT);
    delay(1000);
    Serial.begin(9600);
    }

    void loop(){
    beep(200);
    }

    void beep(unsigned char delayms){
    state = digitalRead(hallSensorPin);

    if (state == LOW) {
    digitalWrite(ledPin, LOW);
    delay(100);
    digitalWrite(ledPin, HIGH);
    Serial.println(“Detector:”);
    delay(1000);
    Serial.println(“NOTHING DETECTED”);
    }
    else {
    digitalWrite(ledPin, HIGH);
    analogWrite(buzzer2, 1);
    delay(50);
    digitalWrite(ledPin, LOW);
    analogWrite(buzzer2, 50);
    delay(50);
    digitalWrite(ledPin, HIGH);
    analogWrite(buzzer2, 1);
    delay(50);
    digitalWrite(ledPin, LOW);
    digitalWrite(buzzer2, 200);
    delay(50);
    digitalWrite(ledPin, HIGH);
    digitalWrite(buzzer2, 1);
    delay(50);
    Serial.println(“Detector:”);
    delay(50);
    Serial.println(“MAGNETIC FIELD DETECTED”);
    }
    }

Leave A Comment

Close