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–.
FEATURES and BENEFITS
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
Name | link |
Raspberry Pi 4 | Aliexpress product link |
37 sensor kit | AliExpress Product link |
connecting wire | Aliexpress product link |
Layout
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
Code Examples
https://gist.github.com/getelectronics/34f9c5f293523f8cc0cc40c73cc34673