Magnetic Spheres Line Up For Rotary Encoder Duty

When it comes to rotary encoders, there are plenty of options. Most of them involve putting a credit card number into an online vendor’s website, though, and that’s sometimes just not in the cards. In that case building your own, like this encoder using magnetic spheres, is a pretty cool way to go too.

If he’d had less time to spare, we imagine [Antonio Ospite] would have gone for a commercial solution rather than building an encoder from scratch. Then again, he says his application had noise considerations, so maybe this was the best solution overall. He had some latching Hall effect sensors lying around, but lacked the ring magnet that is usually used with such sensors in magnetic encoders. But luckily, he had a mess of magnetic spheres, each 5 mm in diameter. Lined up in a circle around a knob made from a CD spindle, the spheres oriented themselves with alternating poles, which is just what the Hall sensors want to see. The sensors were arranged so the pulses are 90° apart, and can resolve 4.29° steps. Check out the video below to watch it work.

Small, cheap and effective are always good things. But magnets aren’t the only thing behind homebrew rotary encoders. A couple of microswitches might do in a pinch, or maybe even scrapped hard drives would suffice.

21 thoughts on “Magnetic Spheres Line Up For Rotary Encoder Duty

  1. i modeled me an encoder housing that only used 8 magnets. short of splurging to get smaller magnets so i can pack them in tighter, though the size of the sensors likely limits how small i can go (not to mention the limits of my 3d printer’s resolution). looking to make a part thats only a little bit bigger than the knob itself, all a single unit.

    one idea i had to increase the resolution is to use linear hall sensors in addition to hall latches to give me sub-tick precision. something like take the integer tick count from the latches, and then add the analog component on as a factional part of the count. the delta between last and previous counts is the output.

      1. hard to make that interrupt driven. i suppose its good enough for my application though. i need a scroll wheel to go with the mini trackball i got for my raspi tablet.

  2. Three thanks to you.
    One for sharing your project, two for the link to the excellent pdf on Hall effect sensors, and three for a good excuse to buy some of those toy magnets!

  3. Wouldn’t it be simpler to use a toothed wheel like a bicycle sprocket, and a single magnet, like car antilock brake(wheel rotation) sensors use?

    I use Honeywell’s APS00B magnetic analog angle encoder and a single magnet. Currently $3.43 at Digikey. Cheaper or less noisy ones are available too from different manufacturers. I have it and a buffer amp on a little 20×20 mm board with 4 mounting holes. Total BOM with magnet, connectors and printed enclosure is about $15 in qty 1. Precision (noise) is better than a tenth of a degree, and it gives semi-absolute position at powerup: it has a 180 degree ambiguity that’s usually easy to resolve in most applications.

    It makes a fantastic non-contact encoder that doesn’t mind getting grimy. I’m finding all kinds of uses for it, and am assembling a batch of nine right now. If there’s much interest drop a note here and I’ll consider throwing the board design into OSHPark’s shared project repo.

      1. The toothed wheel does not need to be (hard) magnetic, just ferromagnetic (e.g. made out of steel). You just need one magnet stationary behind the sensor. The wheel modulates the field the sensor sees.

      2. It’s about what you have spare, if you already have a metal toothed wheel lying around, use that, I had those magnetic spheres.

        Also, my intuition would suggest that in a DIY setup direct magnets could be easier to deal with than having one single bias magnet react with ferromagnetic teeth, but TBH I have no data about that.

      3. Like [ao2] says, it’s about what you have available. With a mill and an indexing table you could make a custom one. I’d knock one out on the mill this evening if I needed one, but I wouldn’t bother: ferromagnetic metal toothed wheels are easy to find in a variety of sizes. They’re these nifty things called “gears” or “sprockets”. In a pinch, you could cut your own out of old transformer laminations with scissors.

      1. You can make your own 3d printer with basic tools ;) but it takes time and I understand that sometimes you just want to make something. Funny to see that no idea is unique. Keep up the good work.

Leave a Reply to ao2Cancel 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.