Adding hall sensors to a motor

Hi all,

I have an outrunner motor that I’d like to install hall sensors on for using with ODrive. The reason for the hall sensors as opposed to an encoder is mostly a space consideration. The motor will be coupled to a gearbox in such a manner that there isn’t really a clean way to mount an encoder either on the backside of the motor, or between the motor and the gearbox (unless there’s some very tiny encoder out there, like the size of a quarter…).

So what I’m hoping to do is to affix hall sensors either to the plate that mounts the motor to the gearbox (since the exposed underside of the motor is the side that’s up against the gearbox), or affix them onto the windings of the motor directly. Either way they’ll be able to be right up against the magnets.

This is the motor in question:

I’ve looked up some tutorials for how to do this and it seems very doable, but I have a couple of questions:

  1. Where do I position the sensors along the perimeter of the motor? Some explanations said that the positioning depends on how the motor is wound, but I haven’t been able to find any more specifics on that. Anyone able to tell from the specs on the website how I’d position them? I do have the motors, so if there’s some test that I can do with them to figure it out I can do that too.

  2. How much precision do I need in positioning them? Like 0.01"? 0.001"? Just so I know if it’s the kind of thing that I should plan when machining the motor mount, or if it’s something that can be adjusted by hand when they’re installed.

  3. If anyone has any advice on choosing through-hole hall sensors that are good for BLDCs, that would be much appreciated as well.

Thanks for your help!

How many coils and rotor magnets does the motor have? The 3D model pictures seem to show 24 coils and 28 magnets, but the photos look like maybe 27 coils, but none are at an angle where I can for sure count them reliably.

For most configurations, simply spacing the sensors equally around the motor is a valid arrangement. 9 coils/12 magnets is the only one I know of where this doesn’t work.

I think it’s best for the sensors to be placed half way between coils, to minimize the chance of them responding to the magnetic field of the coil instead of the rotor magnets. Usually the equal spacing arrangement is the only valid sensor placement that also puts all of them precisely half way between coils. But I’m not entirely sure that it matters, since I’ve seen some larger motors with sensors embedded in the stator teeth, right where I’d expect the coil field to be strongest.

Positioning doesn’t seem to be all that critical. Once you get the sensors on, try hooking them up to 3 LED’s on a breadboard so you can turn the motor by hand and watch the sensors switch on and off as the magnets pass them :slight_smile: Each step is relatively large, so there’s quite a bit of wiggle room before it won’t work at all. But obviously the timing will be better if you position them precisely.

To find all valid arrangements, the best trick I know is to make an image where the width in pixels is number_of_coils x number_of_magnets, and then draw two rows of rectangles spanning the width of the image representing the coils and magnets (the width of the rectangles representing coils will be image_width / number_of_coils). Then on a third row, draw 3 lines representing the sensors. One precisely between two magnets, one 2/3 of a magnet width ahead of it, and one 2/3 of a magnet width behind. That will give you a valid sensor arrangement, and then you can move the sensors around as long as each one retains the same relationship to a magnet of the same polarity.

Here’s an image showing three valid arrangements for 12 coils/14 magnets, the third of which is goofy but hopefully helps show what makes an arrangement valid or not The magnet rectangles alternate red and blue to show the polarity of the magnets, but coil rectangles alternate color just so you can see the boundaries clearly (there’s no functional difference between the different colored coils). Note how there’s always one sensor line right at the beginning of a blue magnet, one 2/3 into a blue, and one 1/3 into a red. And how in the middle equal spacing arrangement, the sensors are also precisely between coils.

US1881 hall sensors are good. Here’s a photo of a motor with some of them hot glued to it for testing :slight_smile: (better to use epoxy for permanent attachment since hot glue might soften when the motor gets warm)


Thanks so much for the detailed info! That makes it very clear. I’ll report back if there are any notable findings when I assemble it.