KY-035 Analog Hall Magnetic Sensor Module

View on Amazon
Overview
About KY-035 Analog Hall Magnetic Sensor Module
The KY-035 Analog Hall Magnetic Sensor Module utilizes the AH49E linear Hall-effect sensor to detect magnetic fields. It outputs an analog voltage proportional to the magnetic field strength, allowing for the detection of both the presence and polarity of a magnetic field. This module is suitable for applications such as motor control, position sensing, and magnetic field detection.
Get Your KY-035
💡 Prices are subject to change. We earn from qualifying purchases as an Amazon Associate.
KY-035 Specifications
Complete technical specification details for KY-035 Analog Hall Magnetic Sensor Module
📊 Technical Parameters
KY-035 Pinout
The **KY-035** is a 3-pin analog Hall effect sensor module:
Visual Pinout Diagram

Pin Types
Quick Tips
**Interface**: Analog linear Hall effect sensor,🧲 **Sensor**: AH49E linear Hall effect sensor IC,📊 **Output**: Analog voltage proportional to magnetic field strength and polarity
**Power**: 3.3V to 5V operation,🧭 **Polarity Detection**: Output voltage changes based on North/South pole orientation
**Range**: Sensitive to magnetic fields from -100 to +100 Gauss,🎯 **Applications**: Motor position sensing, speed detection, proximity sensing, contactless switches
Pin Descriptions
| Pin Name | Type | Description | Notes |
|---|---|---|---|
1 - | Power | Ground connection | |
2 middle | Power | Power supply | 3.3V to 5V |
3 S | Communication | Analog signal output | Voltage proportional to magnetic field |
Wiring KY-035 to ESP32
To interface the **KY-035** with an **ESP32** for analog magnetic field sensing:
Visual Wiring Diagram

Connection Status
Protocol
Pin Connections
| KY-035 Pin | Connection | ESP32 Pin | Description |
|---|---|---|---|
1 - Required | GND | Ground | |
2 middle Required | 3.3V | Power supply | |
3 S Required | GPIO34 | Analog input (ADC pin) |
**Linear Response**: Output voltage varies linearly with magnetic field strength
**ADC Pins**: Use GPIO32-39 for analog input on ESP32
**Voltage**: 3.3V recommended for ESP32 ADC compatibility
**North Pole**: Increases output voltage above baseline (~1.65V at 3.3V supply)
**South Pole**: Decreases output voltage below baseline
**Baseline**: ~50% of supply voltage when no magnetic field present
**Sensitivity**: ~1.4 mV/Gauss typical
**Calibration**: Read baseline value at startup (no magnet) for reference
KY-035 Troubleshooting
Common issues and solutions to help you get your sensor working
Common Issues
Issue: The sensor does not provide any output signal.
Solutions:
- Verify that the module is properly powered with the correct voltage (3.3V to 5V).
- Ensure all connections are secure and correctly wired.
- Check for any damage to the sensor or module components.
Issue: The sensor outputs incorrect or unstable readings.
Solutions:
- Ensure that there are no external magnetic fields or electrical noise affecting the sensor.
- Use proper shielding and grounding techniques to minimize interference.
- Calibrate the sensor to account for any environmental factors.
Debugging Tips
Use the Serial Monitor to check for error messages and verify the sensor's output. Add debug prints in your code to track the sensor's state.
Use a multimeter to verify voltage levels and check for continuity in your connections. Ensure the power supply is stable and within the sensor's requirements.
Additional Resources
KY-035 Programming Examples
Ready-to-use code examples for different platforms and frameworks
int sensorPin = A0; // The input pin for the sensor
void setup() {
Serial.begin(9600);
Serial.println("KY-035 Magnetic Field Detection");
}
void loop() {
int rawValue = analogRead(sensorPin);
float voltage = rawValue * (5.0 / 1023.0) * 1000; // Convert to millivolts
Serial.print("Voltage: ");
Serial.print(voltage);
Serial.println(" mV");
delay(1000);
}This Arduino code initializes the serial communication and reads the analog value from the KY-035 sensor connected to pin A0. It converts the raw analog value to voltage in millivolts and prints it to the serial monitor every second.
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/adc.h"
#define SENSOR_CHANNEL ADC1_CHANNEL_6 // GPIO34
void app_main(void) {
adc1_config_width(ADC_WIDTH_BIT_12);
adc1_config_channel_atten(SENSOR_CHANNEL, ADC_ATTEN_DB_11);
printf("KY-035 Magnetic Field Detection\n");
while (1) {
int raw = adc1_get_raw(SENSOR_CHANNEL);
float voltage = raw * (3.3 / 4095.0) * 1000; // Convert to millivolts
printf("Voltage: %.2f mV\n", voltage);
vTaskDelay(pdMS_TO_TICKS(1000));
}
}This ESP-IDF code configures ADC1 channel 6 (GPIO34) to read analog values from the KY-035 sensor. It converts the raw ADC value to voltage in millivolts and prints it to the console every second.
sensor:
- platform: adc
pin: GPIO34
name: "KY-035 Magnetic Field Sensor"
update_interval: 1s
filters:
- multiply: 3.3
- lambda: |-
return x * 1000; // Convert to millivoltsThis ESPHome configuration sets up the KY-035 sensor connected to GPIO34 as an ADC sensor. It reads the analog voltage every second, converts it to millivolts, and logs the value. The lambda function ensures the output is in millivolts for easier interpretation.
platformio.ini
[env:esp32]
platform = espressif32
board = esp32dev
framework = arduinomain.cpp
#include <Arduino.h>
#define SENSOR_PIN 34
void setup() {
Serial.begin(115200);
Serial.println("KY-035 Magnetic Field Sensor Test");
}
void loop() {
int raw_value = analogRead(SENSOR_PIN);
float voltage = raw_value * (3.3 / 4095.0) * 1000; // Convert to millivolts
Serial.print("Magnetic Field Voltage: ");
Serial.print(voltage);
Serial.println(" mV");
delay(1000);
}This PlatformIO code sets up GPIO34 as an analog input for the KY-035 sensor. It reads the raw ADC value, converts it to millivolts, and logs it to the serial monitor every second.
import machine
import time
SENSOR_PIN = machine.ADC(machine.Pin(34))
SENSOR_PIN.atten(machine.ADC.ATTN_11DB)
while True:
raw_value = SENSOR_PIN.read()
voltage = (raw_value / 4095) * 3300 # Convert to millivolts
print("Magnetic Field Voltage:", voltage, "mV")
time.sleep(1)This MicroPython script configures GPIO34 as an ADC input for the KY-035 sensor. It reads the raw ADC value, converts it to millivolts, and prints it to the console every second.
Wrapping Up KY-035
The ESP32 KY-035 Analog Hall Magnetic Sensor Module is a powerful KY-0xx module sensor that offers excellent performance and reliability. With support for multiple development platforms including Arduino, ESP-IDF, ESPHome, PlatformIO, and MicroPython, it's a versatile choice for your IoT projects.
Best Practices
For optimal performance, ensure proper wiring and follow the recommended configuration for your chosen development platform.
Safety First
Always verify power supply requirements and pin connections before powering up your project to avoid potential damage.
Ready to Start Building?
Now that you have all the information you need, it's time to integrate the KY-035 into your ESP32 project and bring your ideas to life!
Explore Alternative Sensors
Looking for alternatives to the KY-035? Check out these similar sensors that might fit your project needs.

KY-001 Temperature Sensor Module
The KY-001 is a temperature sensor module that operates within a wide temperature range. It supports 1-Wire communication and is based on...

KY-023 Dual Axis Joystick Module
The KY-023 is a dual-axis joystick module that provides analog outputs for X and Y positions, along with a digital output for a built-in...

KY-037 High Sensitivity Sound Detection Module
The KY-037 is a high sensitivity sound detection module featuring an electret condenser microphone and an LM393 comparator. It offers both...





