Microminiature Hall Effect Rotary Encoder Help

Discussion in 'The Projects Forum' started by Dash_Merc, Jul 9, 2010.

  1. Dash_Merc

    Thread Starter New Member

    Jun 27, 2010
    9
    0
    I've looked all around on the internet and not managed to find anything really helpful, so I'm asking here, on the hope that somebody knows how to help me.

    First, the outline:

    I've got a pocket watch case. It has a winding stem. I want to sense the rotation of the winding stem, including speed and direction. Basically, I'd like an *absolute* position rotary encoder, but I can't even find any mechanical encoders that will fit inside the case.

    I want to try making a rotary encoder out of some kind of magnet attached to the shaft of the winding stem and a hall effect sensor. I would like to use one, or no more than two hall effect sensors (SOT-23 or smaller) to achieve this result. What solutions are there, and how would I go about fabricating it and programming it? I would like to know the absolute position of the stem if possible, but if not, just the speed and direction of rotation would be nice.

    Remember, this has to be *small*. Like *really really* small.

    Oh -- and it can't cost a fortune. Basically, a simple $1-2 chip or two and a cheap, small magnet or two. Something like the Allegro A1230 seems like it should do the trick, but I'm not sure if it will be enough just by itself, nor how to actually construct the rotation-sensing assembly.

    If anybody can point me to a document or three, or provide some shared experience or advice, I would really appreciate it.

    Thank you.
     
  2. Externet

    AAC Fanatic!

    Nov 29, 2005
    758
    57
    Hi.
    You may be pushing too much the requierements; The space available in an 'empty' pocket watch is not much.
    If you can fit an optical computer mouse sensor inside, you may succeed.
    To do it with Hall sensors, yes, after you engineer attaching magnets to the turning shaft.
    If the shaft gets a 90 degree mechanism to drive a larger diameter wheel, it will be easier.

    For magnetic; parts 5,6,7. For optical, You need parts 1 and 3 as here:

    http://www.citizen-micro.com/tec/encoder.html

    Which is again a simplified mouse sensor.
    If the contrast bands are instead printed with steel dust mixed with superglue on a disc and then zapped to become magnetic, your Hall approach may work.
    In general, ordering an assembly and canibalizing its guts, may fit. You still prefer to right angle drive from the winding knob.

    Hope it helps somehow
     
    Last edited: Jul 9, 2010
    Dash_Merc likes this.
  3. Dash_Merc

    Thread Starter New Member

    Jun 27, 2010
    9
    0
    If I can figure out how to fit an optical encoder in there, I guess that would be an acceptable solution, but I guess then the question is: how do I make it sense direction as well as speed? Would a straight-stripe version be sufficient for that, or would I need to generate a two-row encoder wheel? or Would I just use two sensors spaced a known degree-variance apart and do some math to determine the direction?

    Again, with an optical encoder, space would definitely be an issue. Doing a 90-degree thing would be possible but exceedingly difficult, and require very tiny machine parts that I would like to avoid. I'm going for as few breakable mechanical components as possible, with the only one (so far) being a mechanical SPST pushbutton.

    I wonder if maybe I could get a regular rotary encoder that uses hall effect sensors inside the body (I know they exist) and disassemble the housing, gutting it to make it smaller? I wonder...

    And as far as the encoder goes, in general, I doubt I would need it to have very high resolution, as the winding stem has a very small diameter, and turning it with any kind of accuracy by hand would become increasingly difficult the higher the resolution of my encoder...though I suppose that could be adjusted with software.

    EDIT:

    A thought occurred to me:

    What if I take two SOT-23 hall sensors and a single small two-pole magnet, mount the magnet on the shaft so that north is one half of the rotation, and south is the other, and then position the hall sensors a few milimetres apart on a board beneath the magnet. Then, one should receive a N pulse slightly before the other. So if I lay it out like this:

    .........N--S..........
    ____A_____B____

    ...then if A receives a N-pulse slightly before B, it means the shaft is rotating anticlockwise, and if B receives the N-pulse slightly before A, it means it's rotating clockwise. And I can get speed, too. (But I only get a resolution of one pulse per revolution, which I would be ok with, but I'd like something more akin to 4 or 8 pulses...I guess just more magnets?)

    So I guess that would work, just like the larger designs, like the one on adafruit's website...but what about using only one sensor. Is it possible to calculate direction from that? Are there sensors that can do that?
     
    Last edited: Jul 9, 2010
  4. BMorse

    Senior Member

    Sep 26, 2009
    2,675
    234
    I do not think using a unipolar hall effect would work for you unless they both use the same magnet pole.... since a Rotary encoder depends on the state of BOTH inputs to determine direction of travel and I do not believe you will be able to mount small enough magnets to get that great of a resolution.....

    This is the only company I can think of that manufacture miniature ones, I believe their smallest one is around 12mm in diameter... >>>http://www.nemicon.com/miniature.htm


    B. Morse
     
  5. Dash_Merc

    Thread Starter New Member

    Jun 27, 2010
    9
    0
    Those may be too big for my application, but they look very high-quality. I might get some from them for a future project, or maybe I'll measure and see if I can get one to fit...though a mechanical encoder from Sparkfun is about the same size (but square). Just checked the product page, and it looks to be 1.3mm square. Hmm.

    As for the hall effect sensors, I would intend on some kind of pulse to occur when the N swings by the sensor, and the opposite pulse would occur when the S swings by...so I suppose I'd either ignore the S, or use it to get double resolution or something. Man, my brain hurts.

    Apparently, though, http://profmason.com/?p=703 shows that this method can produce very similar results to a regular rotary encoder, so I might even be able to skip the coding headaches and just copy-pasta some code or use a library.
     
    Last edited: Jul 9, 2010
  6. bertus

    Administrator

    Apr 5, 2008
    15,646
    2,345
  7. Dash_Merc

    Thread Starter New Member

    Jun 27, 2010
    9
    0
    So by the looks of it, those encoders are designed to mate with similarly-sized motors. Some of their offerings look pretty neat, and it would appear that the smallest they have is 10mm in diameter, which might actually be sufficiently small for my application, but I haven't gotten to the point where I can measure or test-fit, since I'm still in the theoretical and planning stage for most of this. I'm still waiting for breadboard-compatible parts to arrive in the mail for me to test various pieces of my project and make sure I understand the theory behind their operation before I try and assemble a complete schematic, design a board layout, and fabricate the board. Surface-mount, I might add. The high degree of possibility for error is why I'm trying to come up with this solution before I even begin building the project (thus making testing-as-I-go quite difficult).

    I guess what I'm *really* looking for is an explanation on how I could make my own encoder system using basic parts and not requiring buying a manufactured solution that comes in an enclosure, which was designed for a different application (maybe unless I could safely disassemble it or remove the enclosure without breaking it). The smaller I can make this, the better. If I can get the whole assembly (hand-built) to fit in the space of about 5mm thickness (so the board would be almost *right* up against the winding stem), that would be ideal. I'm looking for a way to take a shaft and put a hall sensor next to it with a magnet on the shaft and accurately determine direction and speed of rotation. The optical method is acceptable, provided I can get speed *and*direction out of it, but it might wind up being too big once it's all put together...

    So can anybody explain to me how I can measure degree of rotation using one hall sensor (or two if necessary, but no more) and a magnet (or more than one if necessary)? The examples I've found focus mostly on speed over direction, and are really more designed to count single complete rotations of something (usually a wheel), and nowhere is there a clear explanation of how to do it. The closest I've found is http://www.extremenxt.com/hallrotate.htm, but when I emailed the guy who came up with it, his email address is dead and bounced the email back as undeliverable, thus making it impossible for me to ascertain the science behind it, and how I can implement it without using lego programming. There's no real theory explained there, just a straight how-to. I want to know how I can make that myself, more miniaturised, and some pseudo-code explanation of how to interpret it, as well as an answer as to whether that can measure speed *and* direction, or just speed (it seems there is no unique identifier for position, so there's really no way I can see to judge rotational position or direction, but maybe I'm just missing something).

    Thanks for your help so far, everybody, but I'm determined to keep digging, because I know there has to be a better solution out there somewhere that doesn't involve buying a pre-made part and hoping it fits.

    Would possibly wiring a vibration motor without the weight on it to the shaft be a method for me to measure rotational speed and direction? I can take a battery and deliver voltage to a simple two-lead battery either in a clockwise direction or anticlockwise direction, based on which direction the battery is facing...so couldn't I expect to rotate the shaft of the motor in either direction and receive a similarly-directed voltage? Electric motors can be used as generators, I know, so I wonder if this might be a feasible solution. I could just sense the polarity of the resulting current to determine direction of rotation, and the level of the voltage to determine speed, am I right? Maybe I'm just crazy?

    I know hall effect rotation sensing is possible in the fashion I'm looking for, but I just don't know how to do it. There are unipolar and bipolar sensors in varying sensitivities available all over the place. There are all ranges of magnet types available everywhere. I just don't know how to bring it all together. I saw a patent application for an encoder that could sense rotation with a single N/S magnet spun directly over an IC inside an enclosure, but I can't find any clearly-defined method of making that myself from scratch.

    UPDATE:

    I found an interesting lead. I'm looking into it when I get home from work: http://www.austriamicrosystems.com/eng/Products/Magnetic-Encoders/Rotary-Encoders/AS5030
     
    Last edited: Jul 9, 2010
  8. Externet

    AAC Fanatic!

    Nov 29, 2005
    758
    57
    Spinning a micromotor as the ones inside cellphones will signal direction by recognizing polarity and speed proportional to voltage outputted. Two wires output, no power supply ever, fits in the housing. That is your simplest idea. Brilliant, simple!, sturdy, reliable and inexpensive as can be. Go for it.
    Or you want indicator readout on the watch housing ?
     
    Dash_Merc likes this.
  9. John P

    AAC Fanatic!

    Oct 14, 2008
    1,632
    224
    I think this might be easier with an optical sensor, not to mention the fact that it won't attract metal objects to the case.

    You could use two reflective optical sensors like the ones made by Sharp Inc:
    http://media.digikey.com/pdf/Data Sheets/Sharp PDFs/GP2L09,24,26.pdf

    The target would be simply a cylinder with alternating black and white stripes; it could be just half black and half white. That would give you 4 sensed points per revolution, or you could use more stripes and get more resolution in the output.
     
    Last edited: Jul 9, 2010
    Dash_Merc likes this.
  10. Dash_Merc

    Thread Starter New Member

    Jun 27, 2010
    9
    0
    @Externet - Knowing that my vibration motor idea is valid is very helpful and reassuring. I'm going to do some experimentation with that and see what I can come up with. It won't be anything like an absolute position sensor, but it will at least be velocity-based, and I can determine how quickly to cycle through, say, several menu options, based on how quickly the motor is spinning. It might be difficult to get a consistent signal out of it, but I'm going to give it a shot.

    @John P - That optical sensor you linked me to might do the trick. Knowing I can just use a drum instead of a disk is quite helpful, too. For some reason, I hadn't thought of that. My question would still be whether I can sense direction of rotation in addition to speed.

    Thank you both for the helpful ideas and reassurances.

    As for that link I posted, I ordered a sample of the part and I'm going to do some experimentation once it gets here. I like the simplicity of it, that I can just attach a simple tiny two-pole magnet to the end of the shaft and it will accurately track the angular position (and therefore direction and speed of rotation) of the magnet, emitting values from 0 to 255 (making for 256 possible rotary positions per revolution). The only tricky part would be mounting the SSOP...I might either have to mount it on a side, with wires supporting the other side and connecting the pins on that side to the pads on the board...or I might try making a tiny board just big enough to fit the chip on, and mounting at a 90-degree angle to the main board with solder points to join them. The possibilities are many.

    As for my intention with this encoder, I would essentially be using it to set the time on the watch. I would use the rotary input to move the time forward or backward, depending on what direction the user was rotating the encoder shaft.

    Thank you all for your help. If anybody has any other ideas, please feel free to shoot them off in here, as they will all be useful in some manner of educating me. :D
     
  11. John P

    AAC Fanatic!

    Oct 14, 2008
    1,632
    224
    When I said "two reflective optical sensors" I meant that's how you sense the direction of rotation. The sensors would be mounted so that they're 90 degrees out of phase when reading the pattern on the drum; in other words, when one is at the center of a white stripe, the other is half way through the transition from white to black.

    Sharp Inc makes a variety of these reflective sensors, with different optimal ranges from device to target and different mounting options, and different degrees of focus (how sharply the transition from black to white would be seen). I've been a satisfied customer in the past.
     
  12. Dash_Merc

    Thread Starter New Member

    Jun 27, 2010
    9
    0
    @John P - Oh, then I suppose that would be a perfect application. Thanks for explaining that bit to me. :p

    I'll go and do some experimentation and try some of these suggestions you've all thrown my way, and whatever my results are, I'll bring them back here and post them for public record.

    If anyone else feels like adding anything to this discussion, please feel free to. :)

    Thanks for all your help!

    -Dash

    UPDATE:

    An acquaintance of mine pointed me to this product: http://www.alps.com/WebObjects/catalog.woa/E/HTML/Encoder/Incremental/EC05E/EC05E1220203.html. It's a 5mm square open-shaft rotary encoder. Tiny, simple, perfect. It's got a hexagonal shaft, and produces 12 pulses over 12 detents, which should give me 144 pulses per 360 degrees, if I'm understanding correctly how these things work. I'm still going to give the optical encoders and the Austria Microsystems chip I found a good effort, and I will report back with my findings as I arrive at them.
     
    Last edited: Jul 10, 2010
Loading...