Typically KY-024 Linear Magnetic Hall Sensor is used to calculate (and therefore adjust or stabilize) the speed of a mechanism in rotation or as a proximity switch. There are also sensors switch type, which are limited to only intervene on reaching a threshold of intensity (see KY003) and therefore provide only one output ON / OFF state. In the case of KY024 point intensity 0 should correspond approximately to + 2.5V with an excursion to the 0V and + 5V in step 1024 if fed precisely to 5V. Despite this sensor has a linear response, however, it is not suitable to be used as a measurement of intensity of a magnetic field due to low precision.
The value of zeroLevel corresponds to 0 and goes calibration proceeds launching the sketch with the sensor away from magnets and making sure that the output value indicates precisely 0. In my case I used a value of 537 but may vary slightly from sensor to sensor.
Connectivity
- Pin (-) –> GND, connect to GND of the Arduino
- Pin (middle pin) +5 v –> connect to Arduino +5
- Pin AO signal –> connect to Arduino pin A0
- DO –> Do not connect in our example