https://en.wikipedia.org/wiki/Hall-effect_sensor
A Hall-effect sensor (or simply Hall sensor) is a device to measure the magnitude of a magnetic field. Its output voltage is directly proportional to the magnetic field strength through it. The sensor type is named after the American physicist Edwin Hall.[1]
Hall-effect sensors are used for proximity sensing, positioning, speed detection, and current sensing applications.[2]
Frequently, a Hall sensor is combined with threshold detection, so that it acts as and is called a switch. Commonly seen in industrial applications such as the pictured pneumatic cylinder, they are also used in consumer equipment; for example, some computer printers use them to detect missing paper and open covers. They can also be used in computer keyboards, an application that requires ultra-high reliability. Another use of a Hall sensor is in the creation of MIDI organ pedal-boards, where the movement of a "key" on the pedal-board is translated as an on/off switch by Hall sensors.
Hall sensors are commonly used to time the speed of wheels and shafts, such as for internal combustion engine ignition timing, tachometers and anti-lock braking systems. They are used in brushless DC electric motors to detect the position of the permanent magnet. In the pictured wheel with two equally spaced magnets, the voltage from the sensor peaks twice for each revolution. This arrangement is commonly used to regulate the speed of disk drives.