Hall Effect Sensor - hqwitty/UCSD-HPS-Electronics GitHub Wiki

Hall Effect Sensor

Component Specifications

  • Linear Hall effect sensor
  • Both sides are magnetically sensitive
  • Round side exhibits higher sensitivity than flat side

Link to product: A1302 Linear Hall Effect Sensors Chip


Pinout (Flat Face Toward You)

Pin Position Wire Color Function
Left Green Signal
Middle Black Ground
Right Red VCC

Storage:


Example Arduino Code

/*
                      ----- Power
Flatt side of sensor  ----- Ground
                      ----- Output
*/

/*
Round side is more sensitive to magnets (Both sides are sensitive). 
*/


const int hallPin = A0;
const int LEDPin = 2;

const int center = 125;

void setup() {
  Serial.begin(9600);
  pinMode(LEDPin, OUTPUT);
}

void loop() {
  int raw = analogRead(hallPin) >> 2;
  int val = raw - center;

  val = constrain(val * 100 / 125, -100, 100);

  Serial.println(val);

  if (val>35){
    digitalWrite(LEDPin,HIGH);
    Serial.print("ON");
  }else{digitalWrite(LEDPin,LOW);}

  delay(50);
}

Waterproofing

Using two-part epoxy resin, fill a 'coffin' with the resin and leave overnight.

Video link of testing https://youtube.com/shorts/SlB_8biHOKQ