The KY-024 is a linear Hall effect sensor module designed to detect magnetic fields. It outputs an analog voltage proportional to the strength of the magnetic field, allowing for precise measurement and detection. Additionally, the module includes a digital output that can be triggered when the magnetic field strength exceeds a user-defined threshold. This dual-output functionality makes the KY-024 versatile for a wide range of applications.
The KY-024 module is manufactured by ESP32 with the part ID 12. Below are the key technical details and pin configurations:
Parameter | Value |
---|---|
Operating Voltage | 3.3V to 5V |
Analog Output Voltage | 0V to Vcc (proportional to magnetic field strength) |
Digital Output | High/Low (based on threshold) |
Sensitivity Adjustment | Potentiometer onboard |
Dimensions | 32mm x 14mm x 8mm |
Operating Temperature | -40°C to +85°C |
Pin Name | Pin Type | Description |
---|---|---|
VCC | Power | Connect to 3.3V or 5V power supply |
GND | Ground | Connect to the ground of the power supply |
A0 | Analog Out | Outputs an analog voltage proportional to the |
magnetic field strength | ||
D0 | Digital Out | Outputs HIGH or LOW based on the threshold set |
by the onboard potentiometer |
Below is an example of how to connect and use the KY-024 with an Arduino UNO:
// KY-024 Hall Effect Sensor Example with Arduino UNO
// Reads analog and digital outputs from the KY-024 module
const int analogPin = A0; // Analog pin connected to A0 of KY-024
const int digitalPin = 2; // Digital pin connected to D0 of KY-024
void setup() {
Serial.begin(9600); // Initialize serial communication
pinMode(digitalPin, INPUT); // Set digital pin as input
}
void loop() {
// Read analog value from A0
int analogValue = analogRead(analogPin);
Serial.print("Analog Value: ");
Serial.println(analogValue);
// Read digital value from D0
int digitalValue = digitalRead(digitalPin);
Serial.print("Digital Value: ");
Serial.println(digitalValue);
// Add a small delay for stability
delay(500);
}
No Output from the Module
Analog Output is Not Changing
Digital Output is Always HIGH or LOW
Inconsistent Readings
Q: Can the KY-024 detect both north and south poles of a magnet?
A: Yes, the KY-024 can detect both poles of a magnet, but the output voltage will vary depending on the polarity and strength of the magnetic field.
Q: Is the KY-024 compatible with 3.3V microcontrollers like ESP32?
A: Yes, the KY-024 can operate at 3.3V, making it compatible with microcontrollers like the ESP32.
Q: How do I calibrate the KY-024 for my application?
A: Use the onboard potentiometer to adjust the sensitivity threshold for the digital output. For analog output, you may need to map the voltage range to your specific application requirements.
Q: Can the KY-024 measure the exact strength of a magnetic field?
A: The KY-024 provides an analog voltage proportional to the magnetic field strength, but it does not provide a direct measurement in units like Gauss. You may need additional calibration or reference data for precise measurements.