Hall Effect Limit Switches For A 3D Printer


We’re used to thinking of limit switches as a mechanical device that cuts the motor connection before physical damage can occur. [Anthony] decided to try a different route with this project. He built this set of no-contact limit switches using a hall effect sensor. The small black package sticking out past the end of the protoboard is the sensor. It is used to detect a magnetic field.

[Anthony] chose to use an Allegro A3144 sensor. Apparently it is no longer in production but was easy to find for a song and dance on eBay. When thinking about the design he decided to add two LED indicators, one lights when the switch is open and the other when it has been tripped. This would have been easy to do with just one LED, but he needed to add more parts to get both working. In the lower left corner of the protoboard you can see the configurable gate device (74LVC1G58) he added to monitor the hall effect sensor and switch the output and LEDs accordingly.

39 thoughts on “Hall Effect Limit Switches For A 3D Printer

  1. Get an old honeywell keyboard, the type with hall effect key switches, and you can open up the keyswicthes and remove the Hall element, and it works as mentioned here. The Honeywell keyboards were the best and most reliable. Killed of by the cheap membrane ones of course, but surplus stores have them.

    1. “Get an old honeywell keyboard” … when you wrote this in 2013, we were just recovering from a debt-fueled recession and I remember these things going for $10 then.

      We’re now in the middle of another debt-fueled bubble, and these things are selling for $100+.

  2. The problem is the hysteresis. With a mechanical switch, you can create a very precise sensor that cuts in and out within fractions of a micrometer or better. With a hall sensor, everything around it affects the magnetic field and you need a large hysteresis for the switching, which means a large uncertainty in where the actuator really is when the limit is triggered.

      1. reliability – they still work after being soaked in oil
        unlike mechanical or optical ones

        as long as you are not covering your printer in oil you will be better off with super cheap mechanical, or super precise optical ones

    1. Last page of the write-up addresses hysteresis. The sensor has built in hysteresis. The configurable logic gate also has schmitt trigger input but not necessary because of the sensor’s hysteresis.

    2. Hysteresis does not make the trigger point “random” or wander about like your comment seems to imply. The trigger point for a given sensor is always at the same Gauss level, although the level itself might be stated as a range in the datasheet, so the absolute trigger point might differ between sensors. Hysteresis just prevents oscillation around the trigger point. In order to repeat a measurement, just move back a few millimeter until the sensor turns off and then re-approach it. Note that mechanical switches also provide hysteresis if you push the button beyond the trigger point (which in fact you will always do). Some more technical hall sensor info here: http://www.akm.com/Brochures/HallSensorsTechnicalGuide.pdf.

      1. Indeed, but the variability of the magnetic field does. If you place some ferromagnetic metal anywhere near the sensor, it will affect how it senses the magnetic field.

        Mechanical switches have next to no uncertainty in where they switch off as you take the pressure away from the switch. The magnetic sensor however has to assume that the field can fluctuate even when everything stays still, so you’re never quite sure where the switching will actually happen.

        1. Yes, you are correct. I wouldn’t use them for positional sensing in environments with ferromagnetic metals. Luckily, that’s not a problem in this use case (3D printer).

    3. The mechanical switches have a large Hysteresis too. That is why the firmwares all go forward until the switch hits then back up until it turns off and use that as the set point, so the switch is always approached from the same direction. This also does the right thing for hall effect sensors.

      Though, if you are fixing the limit switches on the basic reprap design, moving the z switch from the bottom of the movement to the top is by far the biggest and simplest win for precision.

    1. That’s a Chinese clone of this: http://reprap.org/wiki/Hall-%CE%98

      The design has more parts, but the functionality is exactly the same. They chose to use an Op-Amp to implement a Schmitt trigger, whereas Anthony’s design simply rely on the built-in hysteresis of the Allegro A3144 sensor. The Op-Amp design has the advantage of an adjustable sensitivity, I suppose, at the cost of a bigger board and more parts.

      1. you would obviously mount the sensor shrouded from strong light. Also those slots are pretty well shrouded from outside light anyway, it is very hard to get enough light in from the outside to get a reading.

      1. not really:

        a song and dance (American)
        a long and complicated statement or story, especially one that is not true (usually + about ) She gave me some song and dance about her kids always being sick and not being able to get to the meetings.

        song and dance
        n Informal
        1. Brit a fuss, esp one that is unnecessary
        2. US and Canadian a long or elaborate story or explanation, esp one that is evasive

  3. When we built a robotic tape library (prototype) 23 years ago, we included both “hard” and “soft” limit switches to protect the axis motors from burning out. Optosensors were monitored by software to signal each end of travel, but just beyond those (about 1 cm) were mechanical limit switches that would cut the power to the motor if it went beyond the “soft” limit. This would require physically moving the motor carriage(?) back within the area of the soft limits, but it saved us from burning out expensive stepper motors.
    It was a “belt and suspenders” type of safety, We had experienced several times previously where the software failed to stop/reverse the motors.

  4. Reprap Morgan is using hall effect sensors at the moment, and I am not seeing any calibration or repeatability problems here. It could be because the sensors are located close to the centre of the machine, limiting external interference…

    I’ll have to see how it behaves long term.

    No song and dance here…

  5. Do not forget that limit switches were always intended to be a “HARD WIRED” safety factor that would work when all else fails. Hall effect switches may be appealing in some ways, but when an irrestible force meets an immovable object – the world ends? or we find out that expensive things can be broken

  6. Maybe it’s better to use ready-made inductive proximity sensors. They are easy to use, industrial solution, metal case, good price.

    Inductive Proximity Sensors detect metal objects without touching them. This technology is used in applications where the metal object to be detected is within few millimeters of the sensor face.

    Something like this one http://www.buyincoins.com/new_en/details/new-inductive-proximity-sensor-detection-switch-npn-dc-6-36v-lj12a3-4-z-bx-product-12325.html

  7. strange, noone really targets the issue.
    the issue is the rise time of the switch and its synchronisation with the stepper driver and location.

    hall effect suffers not from the sensor being the issue, but the magnetic field it senses itself being variable. stick a magnet next to an alloy rail and move it at high speed. guess what happens? oh. lenz law. the magnetic field is altered. aluminium is a conductor and forms eddy currents. mount your hall effect sensor close to the rail, what happens? the trigger point is altered by velocity!

    use a mechanical switch… you have contact wear, bounce, false hits, inertia… they vary. theres a long pipeline of latency.

    LATENCY is the issue.

    use a photo interrupt?
    most people get it utterly wrong and try sticking this little interrupter out in the air and get a blade to line up with it. often a plastic blade. fail to realise a lot of plastic is transparent in the IR range. and of course, its delicate. one misaligned blade or sensor and crunch… because so far, most designs for 3d printers are obviously made by people with no experience of industrial machinery. tear apart an inkjet and repurpose it, but when it comes to operating an actual milling machine day in day out… anyway, i digress….

    when you check the specs on the photointerrupter, look at the FALL times on the transistor. thats the way most people set them up and never give it a second thought.

    do yourself a favour. engage brain cells and look at the RISE time. about a 20:1 difference iirc last time i looked at a data sheet….

    then look at your carriage and the sensor and contemplate how to REVERSE the mode of operation. keep the light blocked and trigger only when its open.

    basically… if the rise time to the trigger threshold is lower than the pulse rate of the stepper… you have uncertainty. there is an indefinite number of pulses that may have occurred during that rise time. isnt that plainly obvious? get your head out of the damn box! the method of triggering doesnt matter,

    its about trying to always trigger on the same angular position regards the stepper and the pulses driving it…

    mechanical switches should be hardware overrides, final fallback safety. hard switches vs soft switches. they arent repeatable enough for accuracy.
    nothing says OFF quite like a double pole breaker to the power supply…

    photointerrupts are the only way. the only PRECISE method where you can reduce undesired variables to a bare minimum.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.