0
\$\begingroup\$

I'm designing my own rotary encoder using magnets and a Hall-effect sensor.

I'm not getting the linear output I was hoping for. I'm using two magnets and putting the sensor in the middle - like this:

n[]s X n[]s

The n[]s is the magnets, and the X is the sensor. I do get the middle value when it's in neutral position, and the minimum/maximum value when it's 90 degrees to each side (trying for a full 180 degree encoder). But the values in between is more logarithmic then linear.

When looking at the data sheet for any Hall-effect sensor it shows a linear output based on gauss. I have no idea how this Hall effect works and if I should expect a linear gauss based on angle and therefore a linear output.

At this point I'm hoping it's my cheap-directly-from-china-components that are bad so if I buy locally I will automagically get the result I'm looking for.

If this is how Hall effect sensors are supposed to behave then it simply cannot be used in a rotary encoder and I have to go for potentiometers.

EDIT: As requested - a photo:

The outer ring with the magnets are rotating while the sensor is stationary. It can rotate indefinitely, but I'm only interested in 180 degrees.

enter image description here

\$\endgroup\$
5
  • 2
    \$\begingroup\$ I think a photo might help. \$\endgroup\$
    – Transistor
    Commented Jan 15, 2021 at 8:41
  • \$\begingroup\$ I have been playing with quadrature encoders and the output is usually two square wave signals. I also play with individual Hall effect chips and check if they are linear. You might like to compare the devices I played and compare and contrast with yours. The test details are in Appendix B and Refs 8 ~11 of my answer to the following Q&A: Sensor to distinguish between different types of pegs on a pegboard electronics.stackexchange.com/questions/523764/…?. Cheers. \$\endgroup\$
    – tlfong01
    Commented Jan 15, 2021 at 8:49
  • \$\begingroup\$ First of all, the flux should be a closed loop - magnets mounted inside a ferromagnetic ring, but not necessarily. \$\endgroup\$ Commented Jan 15, 2021 at 9:19
  • \$\begingroup\$ @MarkoBuršič Would love to see an example of this because I cannot picture exactly what you mean. \$\endgroup\$
    – Espen
    Commented Jan 15, 2021 at 9:32
  • \$\begingroup\$ Part number of the sensor? Data sheet link? \$\endgroup\$ Commented Jul 6, 2023 at 23:21

2 Answers 2

1
\$\begingroup\$

There are various types of hall sensors, for different tasks. It is unclear on what you want to achieve. If this is an linear sensor of B-field, then this field should be uniform. In case you have two magnets, like in a photo, the field is not uniform, because it self closes through the air. An outside iron ring would give a return path to the magnets. But still I am not sure that you will get a linear output from the hall sensor, since it should have a dual power supply and the output that goes from positive to negative.

However there are special ASICs with companion magnet, that work as encoder, while yours simply can't do the task.

\$\endgroup\$
0
\$\begingroup\$

As a simple explanation, consider that the distance between the Hall sensor and the magnets changes as the gear rotates.

The sensor is flat, and wider than it is thick. Because of this, the distance between the magnets and the sensor varies as the gear rotates.

The magnetic fields of the magnets are also concentrated at two points, so you get a maximum effect only when the sensor is properly aligned so that it is exposed to the maximum flux from the magnets.

As Marko Buršič noted in the comments, it would help to spread the magnetic flux around the whole circle.

A ring of iron inside the magnets and around the sensor would help. The magnets should be "stuck" on the outside of the iron ring, with the sensor inside the iron ring.

\$\endgroup\$
3
  • \$\begingroup\$ Just noticed that if I limit the rotation to 90 degrees, 45 degree in each direction, it does output a very linear result that will work. I just have to create som different gears to accomplish this. Of course if an iron ring will help then I will try this. The more I can turn the sensor, the more accurate data I will get. I'm guessing a ferrite ring is what I need? \$\endgroup\$
    – Espen
    Commented Jan 15, 2021 at 11:40
  • \$\begingroup\$ I think iron, rather than ferrite. \$\endgroup\$
    – JRE
    Commented Jan 15, 2021 at 11:43
  • \$\begingroup\$ To bad. I'm sure ferrite is much easier to find by measure than iron :-) \$\endgroup\$
    – Espen
    Commented Jan 15, 2021 at 11:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.