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.
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.
You do not even need hall latches at all, just hook your two linear hall sensors to ADCs and figure the math to retreive the angle from A/B measurement.
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.
Clever design!
and a near-perfect use-case for anaQuad… OTOH, not interrupt-driven… could definitely generate software interrupts.
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!
Does anybody else see the smiley face in the thumbnail of the video?
I thought it was a smiley face until you mentioned it, then I looked properly. I am still not sure it isn’t.
Check the first frames of the actual video :)
I couldn’t select a better thumbnail for the video because my YT account is not verified yet.
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.
You think that cutting a toothed wheel from magnetic material is easier than sticking magnets together in a circle?
Please elucidate.
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.
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.
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.
could you share that design? I’d be very interested in using something of that sort without needing to recreate the whole circuit
I’ll leave a link here when I post it to OSH Park. Likely this weekend.
I used the same concept for my cnc MPGs, see https://hackaday.io/project/27541-cnc-mpg for more info.
Hi Peter, I like your solution.
If I had owned a 3d printer I guess I would have done basically the same, but I’ve got only very basic tools.
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.
Why not use a rotary Hall Encoder with a diametric magnetized magnet? e.g. Micronas HAL37xy or simular
I wonder if you could add a stronger magnet somewhere around the perimeter to catch on the magnet ring and make some sort of detent or resting position?
Could you add more hall effect sensors to increase the resolution?