Shop OBEX P1 Docs P2 Docs Learn Events
Refrigerator Magnet Encoder — Parallax Forums

Refrigerator Magnet Encoder

Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
edited 2011-10-30 14:46 in Accessories
Yesterday I received a pair of refrigerator magnets in the mail from a non-profit that wanted me to contribute money. Each measures 3.5"W x 2.75"H and consists of some flexible brown magnetic material as a backing, topped by a vinyl label with the non-profit's message. Planning just to throw them out, I placed them back to back, expecting them to repel each other -- you know, same poles. That's not what happened, though, They stuck together, offset vertically by a fraction of an inch. I could slide one across the other, and they would lock together in increments of what turned out to be 0.163".

Aha! Multipolar magnetic sheet! This could be useful!

I have some SS41 bipolar latching Hall effect sensors left over from an old project. When these are subject to a magnetic "north", they latch in one state; when subjected to a "south", they latch in another state. They seemed a perfect match for the refrigerator magnet material, so I set about to make a simple shaft encoder.

To do so, I peeled the vinyl label from one of the magnets and cut a vertical strip from it about 0.25" wide and 2.6" (16 x 0.163") long. This, I calculated, would wrap perfectly around a 0.83" diameter form that I could spin in front of the sensor to test it. I cut a disk with a hole in it from wood (D'ya see that Erco? WOOD!) using my laser cutter and adhered the magnetic strip with some double stick tape. Of course, I neglected to account for the thickness of the strip in my calculation and came up a little short, as the photo below shows:

attachment.php?attachmentid=79835&d=1301859997

I then mounted the disk on the standoff shown in the photo, chucked it up in my drill press, and placed the energized sensor next to it:

attachment.php?attachmentid=79837&d=1301859998

Here's an image of the scope trace it produced:

attachment.php?attachmentid=79836&d=1301859997

The gap is clearly visible, occurring every 16 pulses. To fix this I would have to make the disk a bit smaller. It would also be a good idea to wrap some thin tape over the strip to keep the ends from pulling away from the disk.

Anyway, this looks like an easy way to make an almost-free encoder from simple materials. For quadrature output, it's necessary only to add another sensor, offset n + 1/4 magnetic pole pairs from the first.

-Phil
431 x 296 - 24K
640 x 480 - 12K
593 x 498 - 55K

Comments

  • ercoerco Posts: 20,256
    edited 2011-04-03 14:19
    Pure genius, PhiPi! I've learned to expect nothing less from you. That sensor is a real bargain at $1.82 from Digikey.

    And wasn't that wood a friggin' JOY to work with? :)

    How about an ultralight robot using 2 or 4 magnetic wheels like this that could climb a vertical steel surface? Do some precision odometry with the encoders and run some dead reckon on the fridge or file cabinet?
  • ElectricAyeElectricAye Posts: 4,561
    edited 2011-04-03 20:11
    That's insanely brilliant!

    But I have a question: what happens if you can't get the poles to match just right when the strip meets up on itself after you wrap it around an object like that? Does that mismatch of poles mess up the encoder or is there a simple way to overcome the skipping of a pole?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-04-03 20:27
    It's "just" a matter of cutting the magnetic strip to the right length and getting the circumference of the disk right. It mostly involves trial and error. Your scope will be your best friend, since any gaps at the joint will be readily apparent. Also, since the sensor is latching, a physical gap may not necessarily represent an electrical gap.

    Without a laser cutter, you can still produce a usable disk. Just chuck up one that's slightly oversize, as I've shown, but without the magnet. Then, with a file or sanding block, and with the disk spinning, work it down to the correct size. If you have a drill press vise, clamp a file in it and use that. It will keep the sides vertical. (My drill press is my lathe. :) )

    As an alternative, you can make the disk slightly undersized and build it up with tape before adhering the magnetic material.

    -Phil
  • ercoerco Posts: 20,256
    edited 2011-04-03 23:56
    You came impressively close to perfection on your first attempt, PhiPi! As you say, some experimentation is required to get the spacing just right. Strictly a matter of mechanically (physically) matching the magnetic gap length to the diameter.

    Using "magnaview" film would help out here to "see" the magnetic field, as shown in this nifty video: http://www.youtube.com/watch?v=TjxqW6GWpMs You can get a small piece of that film for a couple bucks: http://www.magnetsandhealth.com/catalog/product_info.php?cPath=55&products_id=617 or http://www.scientificsonline.com/magnetic-viewing-paper.html

    Magnets are just plain cool, and I think this is a great application and wonderful find from Professor PhiPi!
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-04-04 09:09
    That magnaview film looks cool -- way less messy than loose iron filings!

    The way I determined the pole width was to place one magnet back-to-back with the other, and let them lock in place. Then I measured the offset between their two edges with linear calipers. Next, I shifted one of the magnets by one pole position relative to the other, let it lock in place again, and took another measurement. The difference between the two measurements was the pole-pair width. I then used 16 * width / pi to get the disk diameter. But I should have subtracted twice the material thickness from the result, since the poles have to mate on the outside of the magnet surface, not the inside.

    With the magnaview material, you wouldn't even need a scope to check for a gap. Just wrap the magnaview around the encoder disk and look for uneven spacing where the ends meet.

    -Phil
  • Beau SchwabeBeau Schwabe Posts: 6,566
    edited 2011-04-04 10:24
    Phil,

    Don't knock the gap, as it could be used as a reference sync.... although depending on the circumference, and how you cut the magnetic 'zebra strip' you either get a long extended pulse, or a small brief pulse. Either way a usable sync reference detection. ( Edit: well there is that rare chance that you could be spot on, in which case there wouldn't be any perceivable gap.)

    As far as dead reckoning, the gap is still beneficial. Although it might introduce a small amount of error, the error is self correcting within each revolution and doesn't compound over distance.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-04-04 10:33
    Beau,

    You're right, of course. A friend of mine works with one of the car companies on their electronic ignition systems. Some cars, apparently, use an inductive pickup from a timing gear as an encoder and simply omit a tooth for the reference "pulse". This works great while the engine is running, but it does present some challenges for the ignition timing while starting the engine.

    -Phil
  • ElectricAyeElectricAye Posts: 4,561
    edited 2011-04-04 23:03
    Hey, at the very least, this strip magnet thing is perfect for making a linear encoder.

    Okay, just thought I'd drop that buzzphrase "linear encoder" here so I can find this later on using a search engine for this site. :-)
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-04-04 23:18
    It's be great for linear encoders if the 1/2" wide stuff you get at the hardware store were striped perpendicular to its length. Unfortunately, though, it's striped longitudinally.

    -Phil
  • agfaagfa Posts: 295
    edited 2011-04-05 05:03
    It's be great for linear encoders if the 1/2" wide stuff you get at the hardware store were striped perpendicular to its length. Unfortunately, though, it's striped longitudinally.
    -Phil

    If you want to bad enough, you can find the stuff in sheets and cut it so that it is striped perpendicular.

    agfa
  • jdoleckijdolecki Posts: 726
    edited 2011-04-06 06:18
    Is this common to all magnetic sheets?

    thanks
  • RS_JimRS_Jim Posts: 1,764
    edited 2011-04-14 16:42
    jdolecki wrote: »
    Is this common to all magnetic sheets?

    thanks

    I stopped by Michaels today to see what I could find. Some of their magnetic sheets did not seem to exhibit the multipolar property. I did find some "business card magnets" that are multipolar with a spacing of about .125" I don't have the precision measurement capibility that Phil has. But I got some and connected my scope to a Melexis hall effect sensor (read Parallax) and was very much able to generate the nice square waves. The sheeting is 3.5" long so I need to come up with a wheel about 1.1' in diameter. For $3 and change I have 10 magnets to experiment with.
    RS_Jim
  • Jim FouchJim Fouch Posts: 395
    edited 2011-10-26 17:07
    I ordered some SS41's to play with and use this idea. I also have some magnet sheets for making refrigerator magnets I bought a few years ago and it turns out it is also stripped. It's a pretty fine pitch and I can get a nice square wave out of it on the scope.

    If anyone wants some strips, I can cut them pretty good on the laser and get you a very nice square strip for wrapping acount a disk. I can even cut the disk in any size with the laser too.
  • Jim FouchJim Fouch Posts: 395
    edited 2011-10-30 14:46
    I did more work on this idea this weekend. I was able to get the spacing correct for the magnet material I have and was able to get 28 updates/inch. Not that high, but for a reference feed back it's pretty good.

    I'm working on a robotic camera arm for my motorcycl project and will be using this idea for the feed back on the main arm turret. Since I have a base of 5.75" in diamater, I will get a pretty decent reference feed back for location. I'll also use two limit switches and maybe a center position on startup to know where I'm at.
Sign In or Register to comment.