Module photo from the Joy-IT SensorKit documentation. The boards in the kit may not carry the Joy-IT print but are the same modules.
KY-024, Linear Hall sensor
Magnet strength as a number, plus a threshold output.
How it works
Linear Hall sensor
What is going on
A Hall-effect sensor whose output voltage varies with field strength, not just on and off. The analog pin reads how strong and which way the field is; the digital pin flips when it crosses the level set by the blue potentiometer. Move a magnet closer and the number climbs; flip the magnet and it goes the other way from the midpoint.
Connections
Wiring to the Arduino Nano on its expansion shield
The pins below match the sketch further down this page; change one and change the other.
Power off first
Unplug the USB cable before you plug in, move or remove any module.
A lead plugged in live can touch the wrong pin for a moment, and 5 V on a signal pin is how a module dies. Unplug, wire, check the letters, then plug the cable back in.
Module pinGoes to
Module A0S row of the column marked A0, analog bank
Module D0S row of the column marked 3, digital bank
Module +VV row, 5 V
Module GNDG row, ground
The Nano I/O expansion shield supplied in the kit, photographed from above for the Voltaat product listing. Column positions measured from the photo; labels added by Fix It Today.
Where it plugs in on the shield
The ringed column is the one this module uses. G on top for ground, V in the middle for 5 V, S at the bottom for the signal. A module with more than one signal wire uses one column per wire.
Read the letters on the shield
Both banks on this shield read G, V, S from the top. The letters are printed at the ends of the rows.
The module's minus or GND pin goes to G, its plus or VCC pin to V, and each signal to the S row of the numbered column.
A module in backwards puts 5 V on the signal pin. Some survive it, plenty do not.
Starter sketch
Code you can copy and upload
Every sketch on these pages is compiled for the Arduino Nano before it is published. The pin numbers at the top match the connection table above.
ky024.inoArduino C++
1const uint8_t FIELD = A0, THRESH = 3;
2
3void setup() {
4 pinMode(THRESH, INPUT);
5 Serial.begin(9600);
6}
7
8void loop() {
9 Serial.print("field:");
10 Serial.print(analogRead(FIELD));
11 Serial.print(",over:");
12 Serial.println(digitalRead(THRESH));
13 delay(100);
14}
Try first
Plot it, then bring a magnet in slowly and flip it over half way.
The quickest way to see it respond.
1
Unplug the USB cable. Plug the module into the column shown above, minus to G, plus to V, signal to S.
2
Plug the USB cable back in. Copy the sketch, upload it, and open Tools > Serial Monitor at 9600 baud.
3
Do the thing the module senses and watch the reading, the L LED, or the sound respond.
Reference
More on this module
The Joy-IT page has the datasheet figures and examples for other boards; the repository has the original vendor files.
Have an idea for what MakerAccess should stock, improve, or explain next? Share it in the survey. If you bought or used a product and want to comment on the item itself, use the product feedback form.