Determine the distance between a magnet and a hall effect sensor? Answered
As the title say, I am looking for a way to determine / measure the distance between the magnet and the hall effect sensor. What I want to archive is that the trigger (or the switch to LED) only activate if the magnet within ~0.5 cm - 0.3 cm . Any more than that, it wont do anything.
My code right now light up the led whenever it detect if the magnetic field but the distance is way too large ( about 3-4cm ). So anything to reduce that down to 0.5 would be the best.
Please throw in any suggestion, recommendation , sample code or solution if you have. I am much appreciated .
EDIT 1: I want to used arduino for this prototype.
the sensor that I am using is this
A little bit more info on what I am working on is that I mount the magnet to a wheel that rotate about 200-500rpm. and whenever the sensor pick up the magnetic field, it light up LED. but since it rotate, it tend to pick up the magnetic field instead at 1 location, it pick up in an arc. So that why I want to narrow down the range of the sensor
UPDATE: NEW QUESTION WITH MORE CLARIFICATION https://www.instructables.com/answers/Create-standstill-effect-with-LED-from-hall-effect/