略過產品資訊
1 / 1

HK STEM CLUB

KY-024 線性磁力霍爾 Linear Magnetic Hall Module

KY-024 線性磁力霍爾 Linear Magnetic Hall Module

定價 HK$15.00
定價 售價 HK$15.00
特價 售罄
查看完整資訊

KY-024 線性磁力霍爾 LINEAR MAGNETIC HALL MODULE

Description

The KY-024 Linear magnetic Hall sensor reacts in the presence of a magnetic field. It has a potentiometer to adjust the sensitivity of the sensor and it provides both analog and digital outputs.

The digital output acts as a switch that will turn on/off when a magnet is near, similar to the KY-003. On the other hand, the analog output can measure the polarity and relative strength of the magnetic field.

  • Arduino KY-024 Linear Magnetic Hall sensor module

  • KY-024 linear hall magnetic fritzing custom part

Specifications

The KY-024 module consists of a 49E Linear Hall-Effect Sensor, a LM393 Dual Differential Comparator, a potentiomenter, two leds and six resistors. It's compatible with popular electronics platforms like Arduino, Raspberry Pi, Esp8266 and Teensy.

Operating Voltage 2.7V to 6.5V
Sensitivity 1.0 mV/G min., 1.4 mV/G typ., 1.75 mV/G max.
Board Dimensions 1.5cm x 3.6cm

Arduino KY-024 Connection Diagram

Connect board's power line (+) and ground (G) to 5V and GND respectively. Connect the digital signal (D0) to pin 3 on the Arduino and the board's analog signal (A0) to pin A0 on the Arduino.

KY-024 Arduino
A0 A0
G GND
+ 5V
D0 3
KY-024 Arduino connection diagramclick to enlarge

KY-024 Example Code

The following Arduino sketch will read values from both digital and analog interfaces on the KY-024. The digital interface will turn on the Arduino's LED when a magnetic field is detected.

The analog interface starts at an initial value determined by the input voltage and the potentiometer, this value will increase or decrease depending on the intensity and polarity of the magnetic field.

int led = 13 ; // LED on arduino
int digitalPin = 3; // linear Hall magnetic sensor digital interface
int analogPin = A0; // linear Hall magnetic sensor analog interface
int digitalVal ; // digital readings
int analogVal; // analog readings

void setup ()
{
  pinMode (led, OUTPUT); 
  pinMode (digitalPin, INPUT); 
  //pinMode(analogPin, INPUT); 
  Serial.begin(9600);
}

void loop ()
{
  // Read the digital interface
  digitalVal = digitalRead(digitalPin) ; 
  if (digitalVal == HIGH) // When magnetic field is present, Arduino LED is on
  {
    digitalWrite (led, HIGH);
  }
  else
  {
    digitalWrite (led, LOW);
  }
  
  // Read the analog interface
  analogVal = analogRead(analogPin);
  Serial.println(analogVal); // print analog value

  delay(100);
}