KY-003 Hall Magnetic Sensor Module and Raspberry Pi

In this example we take a look at the KY-003 Hall Magnetic Sensor Module and connect this to a Raspberry Pi.

The KY-003 consists of a 3144EUA-S sensitive Hall-effect switch

These Hall-effect switches are monolithic integrated circuits with tighter magnetic specifications, designed to operate continuously over extended temperatures to +150°C, and are more stable with both temperature and supply voltage changes. The unipolar switching characteristic makes these devices ideal for use with a simple bar or rod magnet. The four basic devices (3141, 3142, 3143, and 3144) are identical except for magnetic switch points.

Each device includes a voltage regulator for operation with supply voltages of 4.5 to 24 volts, reverse battery protection diode, quadratic Hall-voltage generator, temperature compensation circuitry, small- signal amplifier, Schmitt trigger, and an open-collector output to sink up to 25 mA. With suitable output pull up, they can be used with bipolar or CMOS logic circuits. The A3141– and A3142– are improved replacements for the UGN/UGS3140–; the A3144– is the improved replacement for the UGN/UGS3120–.


Superior Temp. Stability for Automotive or Industrial Applications
4.5 V to 24 V Operation … Needs Only An Unregulated Supply
Open-Collector 25 mA Output … Compatible with Digital Logic
Reverse Battery Protection
Activate with Small, Commercially Available Permanent Magnets
Solid-State Reliability
Small Size
Resistant to Physical Stress

Parts List

Raspberry Pi3Raspberry Pi 3 Model B With WiFi & Bluetooth
37 sensor kit37 IN 1 SENSOR KITS FOR ARDUINO HIGH-QUALITY FREE SHIPPING (Works with Official for Arduino Boards)
connecting wireFree shipping Dupont line 120pcs 20cm male to male + male to female and female to female jumper wire



We use Pin 13 (GPIO27) for the sensor, one of the examples also has an LED connected to Pin 11 (GPIO17). We have not shown this in the schematic and layout below


pi and ky-003 layout
pi and ky-003 layout


pi and ky-003 schematic
pi and ky-003 schematic


Code Examples


code on github