Hall-effect switches are integrated circuits with magnetic specifications. This means that all required components are already integrated in the sensor and it has an increased sensitivity with respect to magnetic fields. The sensor is suitable for continuous operation at temperatures up to +150 °C and is characterized by its stability to temperature and supply voltage changes. Each unit is equipped with a reverse polarity protection diode, a square Hall voltage generator, temperature compensation circuit, small signal amplifier, Schmitt trigger and an open collector output to sink up to 25 mA. The transistor switches through if the module is held in a magnetic field. This can then be read out at the signal output as an analog voltage value.

Technical data

Chipset A3144
Measuring range -40°C to +150°C
Sensor Type Hall Effect Transistor/Switch
Function range 5V (Due to the LED)

Pin Assignment

Code example Arduino

Pin assignment Arduino

Arduino Sensor
Pin 10 signal
5 V +V
ground GND
Arduino Sensor
Pin 13 LED+
Ground LED-

This is an example program, which lights up a LED, if a signal is detected at the sensor. The modules KY-011, KY-016 or KY-029 can, for example, be used as LEDs, for example.

int Led = 13 ;// declaration of the LED output pin
int Sensor = 10 ;// Declaration of the sensor input pin
int val; // Temporary variable
void setup ()
  pinMode (Led, OUTPUT) ; // Initialize output pin
  pinMode (Sensor, INPUT) ; // Initialize sensor pin
  digitalWrite(Sensor, HIGH) ; // Activate internal pull-up resistor
void loop ()
  val = digitalRead (Sensor) ; // The current signal at the sensor is read out
  if (val == HIGH) // If a signal could be detected, the LED is switched on.
    digitalWrite (Led, LOW);
    digitalWrite (Led, HIGH);

Sample program download


Code example Raspberry Pi

Pin assignment Raspberry Pi

Sensor with 5V logic level: In contrast to the Arduino, the Raspberry Pi does not have a 5V logic level. This limits the Raspberry Pi, if you want to use sensors that have a supply voltage of 5V.

To avoid this problem, our sensor kit X40 contains the KY-051, a module for logic level conversion, which you can use on the Raspberry. This is simply connected to the Raspberry Pi with 5V, 3.3V and ground. On the pins A1 to A4 are then connected the lines that lead to the Raspberry Pi and on the pins B1 to B4 are then connected the lines that come from the sensors.

Therefore we recommend to use the KY-051 module for sensors with 5V logic level of this set. More information can be found on the information page for the KY-051 Voltage Translator.

Raspberry Pi Sensor
- Signal
5V [Pin 1] +V
Mass [Pin 6] GND
KY-051 Sensor Raspberry Pi
A1 Signal -
B1 - GPIO 24 [Pin 18]
Vcca - 5V [Pin 1]
Vccb - 5V [Pin 4]
GND - Mass [Pin 6]

This is a sample program that prints a console output when as signal is detected at the sensor.

# Required modules are imported and set up
import RPi.GPIO as GPIO
import time
# Here the input pin is declared to which the sensor is connected. Additionally also the PullUP resistor at the input is activated
GPIO.setup(GPIO_PIN, GPIO.IN, pull_up_down = GPIO.PUD_UP)
print ("Sensor-Test [press CRTL+C, to end the test]")
# This output function is executed when a signal is detected.
def ausgabeFunktion(null):
        print("Signal detected")
# When a signal is detected (falling signal edge), the output function is triggered
GPIO.add_event_detect(GPIO_PIN, GPIO.FALLING, callback=ausgabeFunktion, bouncetime=100) 
# Main program loop
    while True:
# Clean up after the program is finished
except KeyboardInterrupt:

Sample program download


To start with the command:

sudo python3 KY003-RPi.py

Code example Micro:Bit

Pinout Micro:Bit:

Micro:Bit Sensor
- Signal
5V [External] +V
Masse GND
KY-051 Sensor Micro:Bit
B1 Signal -
A1 - Pin 1
Vcca - 3,3V
Vccb - 5V [External]
GND - Masse + [External Mass]

Sample program download