KY-003 Hall magnetic field sensor
Hall-effect switches are monolithic integrated circuits with tighter magnetic specifications, meaning that the sensor is made of one piece.
- Arduino
- Raspberry Pi
- Raspberry Pi Pico
- Micro:Bit
The Hall effect transistor/switch is an integrated circuit with specific magnetic properties that has all the necessary components already integrated in the sensor and offers increased sensitivity to magnetic fields. The module operates stably at temperatures up to +80 °C and is insensitive to temperature and supply voltage changes. Equipped with an A3144 chipset, each device includes a reverse polarity protection diode, a square Hall voltage generator, a temperature compensation circuit, a small signal amplifier, a Schmitt trigger and an open collector output.
When the module is held in a magnetic field, the transistor switches through, which can be read out as a digital value at the signal output. This feature makes the Hall effect transistor/switch ideal for applications where the detection and measurement of magnetic fields is required, offering high reliability and precision.
Technical Data | |
---|---|
Chipset | A3144 |
Sensor type | Hall-effect transistors/switches |
Operating voltage | 5V (Due to the LED) |
Pin Assignment
Arduino | Sensor |
---|---|
Pin 10 | signal |
5 V | +V |
GND | GND |
Arduino | Sensor |
---|---|
Pin 13 | LED+ |
GND | LED- |
Code-Example
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);
}
else
{
digitalWrite (Led, HIGH);
}
}
Example program download
The Hall effect transistor/switch is an integrated circuit with specific magnetic properties that has all the necessary components already integrated in the sensor and offers increased sensitivity to magnetic fields. The module operates stably at temperatures up to +80 °C and is insensitive to temperature and supply voltage changes. Equipped with an A3144 chipset, each device includes a reverse polarity protection diode, a square Hall voltage generator, a temperature compensation circuit, a small signal amplifier, a Schmitt trigger and an open collector output.
When the module is held in a magnetic field, the transistor switches through, which can be read out as a digital value at the signal output. This feature makes the Hall effect transistor/switch ideal for applications where the detection and measurement of magnetic fields is required, offering high reliability and precision.
Technical Data | |
---|---|
Chipset | A3144 |
Sensor type | Hall-effect transistors/switches |
Operating voltage | 5V (Due to the LED) |
Pin Assignment
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 4] | +V |
GND [Pin 6] | GND |
KY-051 | Sensor | Raspberry Pi |
---|---|---|
A1 | - | GPIO 24 [Pin 18] |
B1 | Signal | - |
Vcca | - | 3,3V [Pin 1] |
Vccb | - | 5V [Pin 4] |
GND | - | GND [Pin 6] |
Code-Example
This is a sample program that prints a console output when as signal is detected at the sensor.
from gpiozero import Button
import time
# The sensor is initialized as a button object with the internal pull-up resistor activated.
sensor = Button(24, pull_up=True)
print("Sensor test [press CTRL+C to end the test]")
# This function is executed when a signal is detected (falling edge).
def ausgabeFunktion():
print("Signal recognized")
# The 'outputFunction' function is bound to the 'when_pressed' event of the sensor.
sensor.when_pressed = ausgabeFunktion
# Main program loop
try:
while True:
time.sleep(1)
# Clean-up work after the program has been completed
except KeyboardInterrupt:
print("Program ended")
Example program download
Start with the command:
sudo python3 KY003-RPi.py
The Hall effect transistor/switch is an integrated circuit with specific magnetic properties that has all the necessary components already integrated in the sensor and offers increased sensitivity to magnetic fields. The module operates stably at temperatures up to +80 °C and is insensitive to temperature and supply voltage changes. Equipped with an A3144 chipset, each device includes a reverse polarity protection diode, a square Hall voltage generator, a temperature compensation circuit, a small signal amplifier, a Schmitt trigger and an open collector output.
When the module is held in a magnetic field, the transistor switches through, which can be read out as a digital value at the signal output. This feature makes the Hall effect transistor/switch ideal for applications where the detection and measurement of magnetic fields is required, offering high reliability and precision.
Technical Data | |
---|---|
Chipset | A3144 |
Sensor type | Hall-effect transistors/switches |
Operating voltage | 5V (Due to the LED) |
Pin Assignment
Micro:Bit | Sensor |
---|---|
- | Signal |
5V [External] | +V |
GND | GND |
KY-051 | Sensor | Micro:Bit |
---|---|---|
B1 | Signal | - |
A1 | - | Pin 1 |
Vcca | - | 3,3V |
Vccb | - | 5V [External] |
GND | - | GND + [External GND] |
Code-Example
basic.forever(function () {
serial.writeLine("" + (pins.analogReadPin(AnalogPin.P1)))
if (pins.analogReadPin(AnalogPin.P1) < 40) {
serial.writeLine("Magnetfeld")
} else {
serial.writeLine("Kein Magnetfeld")
}
serial.writeLine("_____________________________________")
basic.pause(1000)
})
Example program download
The Hall effect transistor/switch is an integrated circuit with specific magnetic properties that has all the necessary components already integrated in the sensor and offers increased sensitivity to magnetic fields. The module operates stably at temperatures up to +80 °C and is insensitive to temperature and supply voltage changes. Equipped with an A3144 chipset, each device includes a reverse polarity protection diode, a square Hall voltage generator, a temperature compensation circuit, a small signal amplifier, a Schmitt trigger and an open collector output.
When the module is held in a magnetic field, the transistor switches through, which can be read out as a digital value at the signal output. This feature makes the Hall effect transistor/switch ideal for applications where the detection and measurement of magnetic fields is required, offering high reliability and precision.
Technical Data | |
---|---|
Chipset | A3144 |
Sensor type | Hall-effect transistors/switches |
Operating voltage | 5V (Due to the LED) |
Pin Assignment
Raspberry Pi Pico | Sensor |
---|---|
- | Signal |
5V [External] | +V |
GND + [External GND] | GND |
KY-051 | Sensor |
---|---|
B1 | Signal |
A1 | - |
Vcca | - |
Vccb | - |
GND | - |
KY-051 | Raspberry Pi Pico |
---|---|
B1 | - |
A1 | GPIO26 |
Vcca | 3,3V |
Vccb | 5V [External] |
GND | GND + [External GND] |
Code-Example
This is a sample program that outputs serial text when a signal is detected at the sensor.
# Load libraries
from machine import Pin, Timer
from time import sleep
# Initialization of GPIO as input
sensor = Pin(26, Pin.IN, Pin.PULL_DOWN)
# Continuous loop for continuous serial output
while True:
if sensor.value() == 0:
print("No magnetic field")
else:
print("Magnetic field")
print("------------------------------------------------------")
sleep(0.5)