# Hall Effect Help

**URL:** <https://forum.arduino.cc/t/hall-effect-help/970876>\
**Category:** Sensors\
**Created:** [March 18, 2022, 9:50pm UTC](https://forum.arduino.cc/t/hall-effect-help/970876 "2022-03-18T21:50:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![aaravx3433](https://avatars.discourse-cdn.com/v4/letter/a/f475e1/32.png) [@aaravx3433](https://forum.arduino.cc/u/aaravx3433)\
**Post date:** [March 18, 2022, 9:50pm UTC](https://forum.arduino.cc/t/hall-effect-help/970876/1 "2022-03-18T21:50:54Z")

</div>

I created this code

#include \<LiquidCrystal.h\>  
LiquidCrystal lcd(7,8,9,10,11,12);

int hallSensorPin = 2;  
int ledPin = 3;  
int state = 0;

void setup() {  
pinMode(ledPin, OUTPUT);  
pinMode(hallSensorPin, INPUT);  
}

void loop(){

state = digitalRead(hallSensorPin);

if (state == LOW) {  
lcd.setCursor(0,1);  
lcd.print("ON");  
digitalWrite(ledPin, HIGH);

```
} 

```

else {  
digitalWrite(ledPin, LOW);  
lcd.setCursor(0,1);  
lcd.print("OFF");  
}  
}

However, for some reason, my hall effect sensor is flickering on and off. Is there any way to adjust my code to reduce sensitivity? Thanks so much.

Once I figure it out ,I'll be able to learn rpm detection.

---

<div class="post-metadata">

**Author:** ![cdr\_xavier](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/cdr_xavier/32/543397_2.png) [@cdr\_xavier](https://forum.arduino.cc/u/cdr_xavier)\
**Post date:** [March 18, 2022, 9:58pm UTC](https://forum.arduino.cc/t/hall-effect-help/970876/2 "2022-03-18T21:58:49Z")

</div>

pullup on input?  
and also, hall effect sensors are not necessarily on-off only and can be linear (depend on polarity and intensity) and so on. Please show where you get the sensor from.

---

<div class="post-metadata">

**Author:** ![groundFungus](https://avatars.discourse-cdn.com/v4/letter/g/73ab20/32.png) [@groundFungus](https://forum.arduino.cc/u/groundFungus)\
**Post date:** [March 18, 2022, 10:57pm UTC](https://forum.arduino.cc/t/hall-effect-help/970876/3 "2022-03-18T22:57:23Z")

</div>

What is the part number of the Hall sensor?

> [@aaravx3433](#):
>
> my hall effect sensor is flickering on and off.

That can be indicative of a floating input.

> [@aaravx3433](#):
>
> pinMode(hallSensorPin, INPUT);

Change the INPUT to INPUT\_PULLUP and try it.

---

<div class="post-metadata">

**Author:** ![aaravx3433](https://avatars.discourse-cdn.com/v4/letter/a/f475e1/32.png) [@aaravx3433](https://forum.arduino.cc/u/aaravx3433)\
**Post date:** [March 18, 2022, 11:17pm UTC](https://forum.arduino.cc/t/hall-effect-help/970876/4 "2022-03-18T23:17:14Z")

</div>

That worked. Thanks so much!

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [September 14, 2022, 11:17pm UTC](https://forum.arduino.cc/t/hall-effect-help/970876/5 "2022-09-14T23:17:48Z")

</div>

Closed on September 14, 2022, 11:17pm UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
