Using a Hall effect switch (A3144).
Here’s a quick video of the circuit in action:
Hall-effect sensors generally support one of three modes:
- switch - turn on in the presence of a magnetic field of a specified polarity
- latch - turn on in the presence of a magnetic field, and stay on until exposed to the reverse polarity
- linear sensor - output is proportional to the magnetic field strength
A common use for Hall-effect sensors is to detect and measure rotation. A good demonstration of this is to sequence a PoV display as demonstrated in Great Scott’s latest video - HACKED!: Old Fan becomes a POV Display.
The components I have are marked “44E/938” and are nominally compatible with the A3144 or OH3144. These are switches that turn on when facing a south magnetic polarity.
With the beveled-edges and package markings to the front, the pin-outs from left to right are:
|3||Open collector output|
The chip is rated for continuous output current of 25mA, so that is sufficient to drive an LED (as demonstrated here). For other switching applications, the output can be used to switch a transistor or pull a microcontroller output low.
It works across a wide supply voltage range of 4.5 to 24 volts - which is very handy!
Since the chip is configured as open collector, the LED and and current-limiting resistor sink into the output pin (rather than be driven by the output pin).
Testing with some neodymium magnets, I get a strong full-on when the south pole of the magnets are within 23mm directly to the front of the chip. The output remains on until I pull back to over 40mm.