Electrical – Cancel latching hall effect sensor effect

hall-effectlatchsensor

I want to use a hall effect sensor to detect when a door is close or not; the sensor would be in the door frame, and a little permanent magnet would be on the door. However, I learned that the sensor I got is latching: at first it outputs 0, when I bring the magnet in the right direction it turns 1, and when I remove the magnet it stays 1.

For my project, I want the sensor to turn HIGH only when the magnet is close to the sensor. To solve this, I could probably get a different non-latching hall effect sensor, but I wanted to know if there was a way to do this with the current sensor I have.

I thought about using a 2nd magnet that would by default make the sensor output 0, but would not be powerful enough to compensate the field generated by the magnet on the door.

Better ideas? Is it worth it?

Best Answer

The document @SteveG linked describes the latching hall effect sensor as latching one value when it detects either a positive ("north") or negative ("south") field and switching to the other value only when it detects the opposite field. Your magnet has both north and south ends, so you should arrange for the magnet to pass north and south across the sensor in one direction when the door is closing and in the opposite direction when the door is opening. If the setup is N then S when the door is closing, and S then N when it is opening, then the sensor will output the latched S value when the door is closed and the latched N value when it is open. The magnet would have to be one where the N and S ends were separated by some distance, like a bar magnet. A disk magnet probably wouldn't work because it would be difficult to pass the N and S sides across the sensor in the manner described.