I'm dealing with a small automation project, a rack and pinion system controlled by an Arduino card with two limit switches to ensure that the rack moves within the boundaries. I have been trying both photointerrupters and hall-effect switches and both of them seems working without problems. Which sensor should I use if I need to prioritize reliability and correct functioning in time? I heard that optical sensors are sensible to environmental light, dust and aging. Which are the minus points of an hall-effect switch? In this case I mean a unipolar hall-effect switch, will all the logic already build in, and that it can be connected to a microcontroller with a simple pull-up resistor.
I'm not hall sensor export but I can tell you I worked on a lot of consumer printers and scanners, and every time we did some kind of limit switch it was a hall effect. So that's got to tell you something ;)
With a little online research I found this paper that talks about the hall effect and it's disadvantages. They don't seem like they would negatively affect your project as you described it though.
Basically the limitations they mentioned are distance that the sensor works at (not really a problem for your limit switch), sensitivity change over temperature, and the presence of an offset voltage. Again if you're just detecting when something hits an edge I'd guess it wouldn't be a problem.
Here's the article:
Since you mention mechanical systems like rack and pinion, it sounds like there is dirt, dust, and grease in the environment. In this case I'd definitely go for Hall sensors first. Grease, dust, and dirt don't effect them. Metal shavings can, but no worse than they would effect a optical sensor either.
Hall sensors can be fooled by external magnetic fields, but fortunately those fall off fast with distance. Usually the magnet a Hall sensor is trying to detect is much much closer, and therefore produces a much stronger field than something like a motor that is multiple inches away.
Both are reasonably good solutions.
You have identified the main factors that affect optical sensors. Worse case you may also manage interruption from spider webs and insects generally.
Hall sensors can be affected by extraneous external magnetic fields - but this is unlikely to be a problem in most situations. Occasionally you can get unexpected fields of some magnitude at a distance from the source. I long ago saw a situation where a CRT display would distort slightly whenever an elevator's power cable loop being trailed by an elevator on the other side of the wall swept past the rear of the screen. Separation was probably one metre or more.
Rats seem to like to eat PVC (specifically) cable sheath - regardless of the sensor or power system it feeds.
Either type of sensor will have a degree of hysteresis. This will depend on the specific design but the Hall sensor will probably have more hysteresis. Hysteresis is useful in reducing the effect of operation/ de-operation "bounce" but may need to be allowed for. Worst case an excessively astute control system may shut a motor down if it does not detect sensor operation when motor power is applied.
An early US manned space launch* was aborted when an umbilical cable pulled clear as the rocket started to lift and one pin pulled out before the other, creating an anomalous circuit configuration. The computer decided to abort the launch , turned off the motors and the rocket settled back onto the pad without disaster. The astronaut who had control of the escape tower firing kept his cool and did not trigger the eject system. Had he done so the mission would have been much delayed. As it was they launched successfully a few days later. You should be able to better than NASA when it comes to sensor bounce :-).
*- Gemini VI - The man in the high castle who made the brave and technically improper but mission saving decision not to eject was Walter Schirra