Linear Hall Effect Sensor for Adjustable Endstops

Has anyone experimented with a Analog Linear Hall Effect Sensor for a replacement to limit switches? Example Sensor

I have seen examples of using hall effect sensors in replacement of limit switches, but those are only the digital kind. Using Linear Hall Effect sensors could allow for fine tuning of the exact actuation point purely through code. Unfortunately I don’t think there is a way to have the Rio command the motor controllers over CAN that a limit switch has been pressed and the linear hall effect sensors cannot be plugged into motor controllers directly as they are analog devices. So I am currently not sure how this can be done effectively, but I would like to know what everyone else thinks. Is this even something worth pursuing?

Edit: Analog Hall Effect not Digital

They work. Hysteresis with hall effect limits is real though.

Has a team ever implemented them?

Yeah. I don’t have a write up but we’ve used magnets and Hall effect limit switches in the past for elevators, arms, and turrets.

I assume you are talking about the digital kind not the analog kind?


I see what you are looking at now. Setting the limit based on the strength of the field. I mean… it could work but seems like a lot of extra work for a limit switch that could be set in a 3D printed holder and just adjusted up or down by a bit and reprinted.

It seems like it would be pretty straightforward to just read the analog signal on either the Rio or another connected microcontroller, then use a digital output to “drive” the limit switch input of the motor controller. You could also use the analog out of the Rio against a comparator or just read the analog value and configure a soft limit on the motor controller based on encoder position. I don’t know if the voltages would be directly compatible or if you’d want some flavor of transistor between, or if it would be fine running on the Rio or you’d want a dedicated controller. I’d be wary about a hacked-together limit switch solution if it was for people-safety, but it should be fine for mechanism positioning, certainly no worse than the no-limit-switch setup I’m sure gets run on countless robots.

Those magnetic rotary encoders are actually two linear Hall sensors…

There are commercial linear ones. You need to make sure to have other magnetic materials away from where you are sensing. Especially moving things and actual magnets!

The primary problem is that it’s hard to really accurately correlate magnetic field strength (which Hall sensors measure) with distance. Apart from the individual variation between sensors, the presence of soft magnetic materials (steel screws, rivets…) in the vicinity of the magnet or the sensor will distort the field.

Generally, you want to use Hall sensors such that they’re intentionally quite nonlinear. For example, in 2018, we used Littelfuse Hall sensors as end switches for our elevator. We put the sensors on the sides of the outer rails, and the magnet on the side of the carriage, so that the magnet would move into and out of the sensitive range of the sensor quite quickly. In this way, small variations in the “trigger distance” (how far from the sensor the magnet needs to be to activate it) only have a small effect on where in the elevator’s travel the switch is triggered.

As @Weldingrod1 mentioned, most of the rotary encoders we use in FRC (CTRE mag encoder, Thrift absolute encoder, etc.) are based on Hall sensors. But those use two or more sensors, and do a sin/cos angle calculation, so that changes in the strength of the field basically cancel out.


We have been using small IR sensors in place of limit switches