close-circle
Close
0%
0%

anaQuad!

Reliably increase your quadrature-encoder's resolution using an ADC (or a bunch of comparators?)

Similar projects worth following
close
Some quadrature-encoders output analog waveforms, rather'n digital.

Typically, these analog waveforms are thresholded via a comparator (often built-in to the encoder circuitry) to create the typical digital-quadrature we expect from an optical encoder.

However, some encoders don't have that thresholding-circuitry built-in, in which case it's possible to use the analog waveforms to increase the positional resolution!

A good example of such an encoder is that from an old computer's ball-mouse, wherein typically (it seems) the *analog* output from the phototransistors is fed into a microcontroller with Schmitt-trigger *digital* inputs.

In my latest experiment, I have succeeded in *quadrupling* the positional resolution without dramatically increasing the processing time required. That's 1152 discernible steps from merely 72 "slots"!

New: Thoughts on anaQuad as a means for communication, similar to LVDS...

The basic idea is to increase the positional-resolution of an analog-output encoder by looking for *crossover* between various multiples of the input-signals... E.G. the first obvious crossover to detect is when channel A crosses over its inverse. In the thresholding-sense, this is equivalent to detecting when the sine-wave passes the halfway point. However, detecting *crossovers*, rather than thresholds, results in much better noise and calibration-immunity. Further, more crossovers can be detected than can be accomplished by merely thresholding each of the channels, by e.g. detecting for the crossover between channel A and channel B, or even channel A and -2 * channel B.

So far, anaQuad2x and anaQuad4x achieve 2x and 4x the resolution of a typical digital-output (or digital-thresholded) encoder's 4 steps per slot, giving 8 steps and 16 steps per slot, respectively. anaQuad6x and anaQuad8x are in the works to give 24 steps and 32 steps per slot.

Additionally, this same technique can be used for other locked-phase signals, such as two (of the three) 120-degree hall-effect sensors used on some BLDC motors.

An explanation of anaQuad's functionality follows the videos...

------------------------

(New: 3/11/16: Thoughts on using anaQuad as a communication-method similar maybe to LVDS 4/1/17: More thoughts in the latest log!)

Here's a video of anaQuad running at 4x, with a bit of functional-explanation.

From a 72-slot encoder, 1152 discernible positions can be detected per revolution.

And now, a computer-mouse's encoder, 48 slots -> 768 measurable positions.

This guy's a great (unintentional) test of the system's functionality despite somewhat dramatic calibration-error... The software's configured for a sine wave from 0 to 2.5V, (no software change from the previous experiment) and the encoder's outputting 1V to 3V (whoops), yet seems to be working surprisingly well.

I'm half-tempted to draw up a huge gauge, attach a long needle, and see just how much accuracy/precision I'm actually getting out of this.... and Done:

Maybe at some point I'll hook up my DC motor-positioning software and have a really big dial on the wall indicating something to fractional-degree resolution... (and to test the accuracy of that positioning-software despite things like the "snappy" action of motors intended for speed rather'n positioning, etc.)

An excessively-complicated galvanometer ;)

-----------------

Initial Thoughts: https://hackaday.io/project/9351/log/32010-quadrature-encoders-with-analog-output

Summarized:

Typically, the somewhat-sinusoidal outputs of the phototransistors are made square via comparators or Schmitt-Triggers.

Thresholding channels A and B

   _______         _ A-squared
  |       |       |
  | .-¯-. |       |
  |/     \|       |/  
 -/-------\-------/---
 /|       |\     /|
A |       | '-_-' |
 _|       |_______|     
  :.      :       :
  : . 90-degree phase-shift
  :  .    :       :
  :   ._______    :    _ B-squared
  :   |   :   |   :   |
  :   | .-¯-. |   :   |
  :   |/  :  \|   :   |/
 -----/-------\-------/
  :  /|   :   |\  :  /|
  : B |   :   | '-_-' |
  :  _|   :   |_______| 
  :   :   :   :   :   :
  :   :   :   :   :   :
      0   1   2   3   0
      |<------------->|
      One encoder-cycle.
      Four Discernible Positions.           
This method gives four discernible positions for each "slot" on an encoder's disk. So, e.g. if that old ball-mouse had 48 slots around the disk, then it probably measured 192 positions per revolution.

An easy way to double that resolution is to look at crossover of the analog waveforms between the channels...

      Here
        |    And Here
        v       |
    .-¯-.-¯-.   |   A   B
   /   /:\   \  v  /   /
 -/---/---\---\---/---/
 /:  /: : :\  :\ /:  /
 -_-' : : : '-_-'-_-'
  :   : : :   : : :
  0   1 : 2   3 : 0
       1.5     3.5
  |<------------->|
  One encoder-cycle.
  Six Discernible Positions.    
And to find the '0.5' and '2.5' positions, merely invert one channel and look for the

appropriate crossover.

Crossover-detection is actually quite easy, based on the fact that we're watching every transition; we only need to check for *two* crossovers, rather than all those possible.

HAH!!!
 I reversed A and B in this drawing! 
 (and likely elsewhere)
(A is usually represented by sin(x),
 B by cos(x))


       ~B   A   B  
      .-¯-.-¯-.-¯-.   ~B  A   B
  B  /   /:\ /:\   \ /   /   /
    X---/-:-X---\---X---/---/
 ~B  \ /. :/:\: :\ /:\ /:  /
  A _-'-_-' : '-_-'-_-'-_-'
      : . : : : : : : : :
      H A B C D E F G H A

 Say we're 'at' position A...
 So, checking for either H or B...
 B:  Channel ~B crosses Channel A
 H:  Channel B crosses Channel A
We don't have to do too much here... knowing which transition happened recently, we look for two other transitions;

from position A, it can either go to B or to H, depending on the direction.

From A -> B: channel A crosses the inverse of channel B: So test for A > ~B

From A -> H: channel A crosses channel B: So test for A < B

From B -> C: cB crosses c~B: B > ~B
From B -> A: cA crosses c~A: A < ~A

... I'll leave the rest to you.

Then we have a switch() statement in an update() function:

switch(lastPhaseState)
{
 case PHASESTATE_A:
    //Advancing Right to B
    if( adcVal_A > INVERT_CHANNEL(adcVal_B) )
    {  
       anaEnc_position++;
       lastPhaseState = PHASESTATE_B;
    }
    //Advancing Left to H
    else if( adcVal_A < adcVal_B )
    {  
       anaEnc_position--;
       lastPhaseState = PHASESTATE_H;
    }
    //else, wait here...
    break;
 //From B -> C: cB crosses c~B:  B > ~B
 //From B -> A: cA crosses c~A:  A < ~A
 case PHASESTATE_B:
    //Advancing Right to C
    if( adcVal_B > INVERT_CHANNEL(adcVal_B) )
    {
       anaEnc_position++;
       lastPhaseState = PHASESTATE_C;
    }
    //Advancing Left to A
    else if( adcVal_A < INVERT_CHANNEL(adcVal_A) )
    {
       anaEnc_position--;
       lastPhaseState = PHASESTATE_A;
    }
    //else, wait here...
    break;
....

This system is tested-functional! Woot!

Resolution can be quadrupled by doing a tiny bit of math (this is now functional!).


Click "Read More" for quite a bit more!

Read more »

anaQuad-0.10-4.zip

Here we go! This is anaQuad 4x, which can resolve an analog-output optical-encoder's output to 16 steps per slot.

Zip Archive - 27.84 kB - 03/07/2016 at 11:23

download-circle
Download

  • more graphing...

    esot.eric04/14/2017 at 10:36 0 comments

    UPDATE: Ramblings on LVMDS feasibility/usefulness... why do I do this? See the bottom.

    ---------

    A little more on LVMDS (anaQuad serial-transmission)

    explained below...

    -----------------

    Thought I'd experiment with different graphing-methods... my old go-to online-grapher seems to be down, so here's another:

    The idea was to show only the crossovers, for a half-period of the quadrature-signal... one half sine-wave, which is the passing of one "slot" in the encoder-disk over the photo-sensor (the other half-sine-wave would be passing of the light-blocking material, which I can't figure out the name for, at the moment... maybe "tooth"?). The other half-sine-wave would be basically the same.

    So we have two piecewise-equations:

    y1(t) = sin(t)       * (t<pi/8)   * (t>-1)  
          + sin(t)       * (t>pi/8)   * (t<3*pi/8)
          + sin(t+pi/2)  * (t>3*pi/8) * (t<5*pi/8)
          + sin(t)       * (t>5*pi/8) * (t<7*pi/8)
    
    y2(t) = -sin(t)      * (t<pi/8)   * (t>-1)
          + sin(t+pi/2)  * (t>pi/8)   * (t<3*pi/8)
          + -sin(t+pi/2) * (t>3*pi/8) * (t<5*pi/8)
          + -sin(t+pi/2) * (t>5*pi/8) * (t<7*pi/8)

    As it stands, I think it's a bit too funky to visualize, the other graphs were more intuitive for me.

    But the ultimate goal, here, (which I'd forgotten until I started writing this, having developed these graphs before the ordeal at home weeks ago) is to make it easier to visualize an encoder (or LVMDS) where the speed/direction changes...

    E.G. For an encoder-disk, we'd be talking about say a motor slowing to a stop at a specific position. With a poorly-tuned algorithm, it might oscillate around that point due to overshoot. Then, graphing that using the method shown here would allow for a more ideal simulation where speed/position isn't affected by other factors such as the motor's windings or friction. That'd help for explanation-purposes.

    E.G.2. For LVMDS, we'd be talking about transmission of data-bits, wherein a "1" would be represented by a clockwise-rotation of one "step" and a "0" would be represented by a counter-clockwise-rotation of a "step."

    The latter-case would be much easier to visualize with this sort of graphing technique... E.G. show the transmission of a data-byte in this anaQuad method. So, maybe I'll get there.

    As it stands, this graphing program only allows for two plots... so the color-coordination doesn't really make sense... it doesn't correspond to anything in particular, you have to look at the piecewise functions to see what's happening.

    Also, this only demonstrates the simplest implementation of anaQuad, which only doubles the resolution of a typical digital-output optical-encoder.

    (If this were compared to two LVDS signals, this method doubles the number of bits that can be transferred within one "eye" or one bit-clock, which would be the blue line crossing over the horizontal axis at 0 and PI).

    So, maybe I need to write a program to do the graphing... or at least generate the necessary equations.

    We'll see.

    #Iterative Motion also could benefit from a GUI, so maybe it makes sense to try to refresh myself on OpenGL...

    Oh, I have a relatively simple idea for LVMDS... brb.

    So, here we can see the binary pattern 11011000 transmitted via anaQuad aka LVMDS... not quite as visually-intuitive as I'd prefer, but a start, anyhow.

    Also, doesn't show the hysteresis method explained in a previous log, wherein a switch in direction/bit-value would maybe take *two* crossovers to detect, rather than one, just to assure stability, should the electrical-values end-up *near* a crossover, rather than halfway-between.

    So, you might be able to see, if there were *two* parallel LVDS signals, their "eyes" would align on the half-sine-wave roughly-outlined in blue. Two data-bits could be transferred simultaneously between 0 and 3.14, one bit on each "signal."

    With LVMDS, using two electrically-similar signals...

    Read more »

  • LVMDS revisited...

    esot.eric04/01/2017 at 14:01 3 comments

    It's been some time... I don't recall what LVMDS stands for anymore...

    LVDS = Low-Voltage Differential-Signalling...

    And the M...? Multi?

    Some theorizing was presented in previous logs (long ago), here's my attempt at trying to remind myself what I was thinking.

    -------------

    Anyways, here's anaQuad revisited:

    There are two sine-waves, with a 90-degree phase-shift between 'em. (the two blue lines). These are, e.g. the outputs of the two Quadrature signals of an optical-encoder.

    anaQuad, again, increases the resolution of the encoders by looking at crossovers between various multiples of the two input signals. By *inverting* the two input-signals (red), we can detect 8 positions (8 cross-overs) per full-cycle (the blue dots). (This resolution is twice as high as could be detected with digital quadrature signals).

    By multiplying the input-signals by ~2, we can double the resolution to 16 positions (the green dots). The resolution can be further-increased by adding more [and more complicated] multiples of the two input-signals, but let's ignore all these for a second and just look at the red and blue waves.

    The red and blue waveforms give 8 positions per full cycle. That's 4 positions per half-cycle, using two quadrature signals.

    That's for increasing the resolution of a quadrature [optical] encoder with analog output.

    -----------------

    Imagine, now, if these crossovers represented data-bits in a serial-data-stream...

    -------------------------

    First some background...

    Here's an "eye diagram" for a regular ol' serial-data-stream (e.g. RS-232)

    (http://electronicdesign.com)

    The waveforms forming the "eye" are numerous bits of a data-stream overlayed atop each other.

    (http://electronicdesign.com)

    When the bit in the center is high, and the two surrounding it are low (#7, above), you'll see a full-sine-wave, starting low on the left, rising to the top of the "eye," and ending low on the right. (If the baud-rate is *really slow* compared to the rise/fall times, it'll look more like a square-wave... as one might expect of a digital signal. For a high-speed serial data-stream, the rise-times and fall-times are almost as long as the high-level and low-level bits, making the waveform more of a sine-wave.)

    Similarly, when the bit in the center is low, and the two surrounding it are high (#5), you'll see the same half-sine-wave flipped upside-down.

    When three bits are high (#4), you get the top line straight across. Three low, straight across the bottom (#2)... And several other combinations (two bits high, one bit low (#8), and so-forth).

    So the eye-diagram shows many bit-patterns overlapping. One might say the center of the "eye" is sampled by the input of the receiving shift-register.

    -----------------------

    Now, for a *differential* serial data signal, we'd see a similar diagram; for every high-bit on one wire, the other wire sends a simultaneous low bit, and vice-versa. It's symmetrical across the horizontal line bisecting the eye (wee!).

    Generally, the receiver might be e.g. a comparator connected to those two opposite-valued signals. When one signal is higher than the other, the output of the comparator is 1, when the other signal is higher, the output is 0.

    The bit-value is, essentially, determined at the *time of crossover* between the two input-signals. (Though, technically, most LVDS receivers *sample* the bit-value in the middle of the "eye").

    --------------

    Now let's go back to anaQuad...

    anaQuad works by looking at the *crossover* of two signals, much like differential-signals (LVDS). But, does-so between not only the input-signal (blue) and its inverse (red), but also a second input-signal and its inverse (the second blue and red pair, respectively)... (as well as multiples thereof (green), which I'm ignoring for now).

    By transmitting two signals, in quadrature (the two blue waveforms), at the same frequency as, say, an LVDS...

    Read more »

  • The Idea...

    esot.eric03/30/2017 at 08:48 0 comments

    The idea of anaQuad is to use an analog-quadrature source (such as the encoder disks used in an old "ball-mouse") to achieve significantly higher resolution than could be achieved by treating that quadrature-signal digitally. While being relatively immune to analog noise, calibration-error, etc.

    It does-so, reliably, by *not* looking at analog *thresholds*, but instead looking at analog *crossovers*. This is well-explained in these pages.

    There are several potential sources... Some quadrature-encoders output an analog signal rather than digital (again, e.g. looking at the output of the photo-transistors in a computer's ball-mouse). Some other sources include the hall-effect sensors used in BLDC motors (these are usually 120 degrees out of phase, rather than 90, as in quadrature, but anaQuad120 can handle that).

    To *use* this system... Currently it's a software-only approach:

    Two analog-to-digital converters are necessary for each encoder.

    (Though, theoretically this could be implemented in hardware with a few comparators and op-amps, or maybe even voltage-dividers!)

    anaQuad (the software) implements a non-blocking function-call to test the current state of your ADCs and determine the current state (and therefore update the "position")...

    In all, it executes only a handful of instructions to detect a change in position, or lack thereof. So as long as it's called often-enough (faster than changes can occur), it puts little strain on your system. The same could be accomplished with a non-blocking digital quadrature-encoder routine in only a few fewer instruction-cycles. This could be called in a timer interrupt or from your main loop (if everything therein is non-blocking, and it loops fast enough).

    Interestingly, anaQuad appears capable of "resynchronizing" if a few "steps" go undetected. So, e.g. if your main loop is slowed for some reason during one cycle, and a few anaQuad "steps" are missed, as long as the next few main-loops are faster, the system won't lose any steps! (Again, probably smarter to use a timer interrupt if you're not certain).

  • Home-made anaQuad discs!

    esot.eric04/30/2016 at 09:29 5 comments

    @Logan linked an interesting and easy-to-build encoder-disk method in a comment over at @Norbert Heinz's #Self replicating CNC for 194 (or more) countries project (which has a bunch of ideas for various positioning systems)...

    Check out this guy: https://botscene.net/2012/10/18/make-a-low-cost-absolute-encoder/

    I'll let the image speak for itself:

    So, the current implementation of anaQuad(4x) would give 16 positions with that disk, per revolution. But, that could easily be bumped to 32 via software, and there's no reason the disk has to have only two "poles".

    I think something like this would be easier to build than the ol' "slotted" style disks, since slots would require a tiny (or masked) sensing-area, etc.

  • Another common source for use of anaQuad120! Optical Drives!

    esot.eric04/09/2016 at 05:42 0 comments

    anaQuad120 was mentioned in a previous log entry, here: https://hackaday.io/project/9984/log/33419-anaquad120 wherein a couple hall-effect transistors from a BLDC-motor can be used as an encoder. In the previous log, I used those from a 5.25in floppy drive. But there's a better source, and these could be easily used as a dial for most purposes...

    OK, so this is the spindle-motor from a DVD-drive. You can clearly see the hall-effecttransistors. Awesome. This guy wants to rest in something like 36 positions per revolution, but isn't nearly as "snappy" as the floppy-drive's spindle-motor. I haven't rigged it up yet,it just occurred to me, and it's a bit difficult to follow the traces under the motor. But, definitely doable, and its size/shape is highly-conducive to being used as a dial such as a volume-control or something.

    So, again, anaQuad120 allows for treating a system like this much like a quadrature-encoder. Most quadrature-encoders meant as dials are only 16 "detents" per revolution and cost around $3 apiece, so here's a source for 36-position encoders :)

    There exist hall-effect sensors that output a digital signal... so it's possible that's the case, here, in which case anaQuad isn't necessary... regular quadrature-decoding would probably work (despite they're most-likely 120deg out of phase, rather'n 90deg). But, judging by the fact these sensors are 4-pin rather'n 3-pin, they're probably analog-output... and anaQuad would work happily with that, and likely increase the resolution from 36 positions per revolution to (was it 12x?) a few hundred (if somehow that's useful...).

    Another thought, especially on the higher-resolution, this shaft could be attached to a motor's... And then you've got a few hundred positions per revolution.

  • LVMDS-continued

    esot.eric03/11/2016 at 15:21 3 comments

    NOTE: 3-27-17... ~ 1yr later. Did I write this? It's gonna take a week+ to recall this mindset!

    ---------

    So... first, I want to mention that quadrature signalling is used for communication... I don't fully understand the details, but I think it's used for FM radio transmissions in order to send the Stereo audio-data over a single transmission carrier-wave. So, in a sense, it achieves communication of *two* different data-streams over a single wire, at the same bit-clock...

    This is a little bit different than that, I think, because its intent is to send *digital* data, and... two separate data-streams? Nah, too complex for me to figure out right now...

    Back to the wired-realm, where there's a "clock" signal separate from the "data" signal(s)...

    So, is this maybe better/faster than, say LVDS?

    Well, one interesting discovery of this system is the fact that its "lock-step" design--based on a state-machine looking for comparisons--apparently allows it to determine the "position" regardless of its actually running in a lock-step fashion... What do I mean by this...? Using nothing but simple comparisons (e.g. from a comparator, or several?) between the four signals received at the receiving-side (+clock, -clock, +data, -data), a handful of comparators could emulate anaQuad2x... Looking at the outputs of those comparators a digital value is achieved representing the "phase" or "position" of the quadrature-signal.

    Low-and-behold... LVDS inputs *are comparators*... so, maybe, one LVMDS signal combined with several LVDS receivers could actually give a somewhat digital output... in this case, I don't mean digital as in a single digital *bit*, but more like an entire *nibble* received within one clock-cycle. Take it a step further, the "lock-step" design requires a bit of processing (I think) to iterate through those comparisons in order to find the new "position"... so...? We have generally accepted that long-distance communication at high-data-rates is usually quite a bit slower than the processors/FPGAs/Logic receiving them... The receiver has a state-machine running at 8x the transmitted signal... Bam.

    So, is this a good idea...? What benefit is there, really...? If LVDS is slowed to some maximum rate due to its ability to swing levels to reliably-readable values fast enough... then wouldn't this system (LVMDS) run into that same problem...? Wouldn't it limit the "nibble-rate" to that same limit...?

    This is where I'm not yet certain... On the one hand, maybe the "nibble-rate" is limited to a full-swing signal... which, for anaQuad, would be the equivalent of a 90-degree positional-change... (Actually, this limitation is probably a good one for several reasons... first of all, it means that the signal "transition" will never exceed that of an LVDS signal "transition", so should work in the same electrical/physical conditions, and second, the "auto-positioning" of the system works to -135 to 180deg, but is a bit iffy around the 180 and -180 marks).

    Anyways, plausibly, instead of using direct multi-level digital transmission, wherein each "position" represents a binary value, instead, maybe, use multi-level digital *change*... wherein each "position" represents a *change* in binary-value...

    I haven't thought this whole thing through, completely...

    As far as physical implementation in the experimental-realm:

    I think reception of anaQuad2x could be handled by four LVDS receivers, or even just four (fast) comparators... I need to think this one through a bit, still... And, transmission...? We'll come back to that.

  • anaQuad Communication - LVMDS?

    esot.eric03/11/2016 at 14:52 3 comments

    Low Voltage Multi-Digital Signalling...?

    Maybe.

    Imagine LVDS... I'll go with FPD-Link, as I've used it before...

    First: You have a clock... typically a "bit" clock...

    Then you have a data line (or several)... It's not so much unlike, say, SPI... (Clock/Data on separate signals).

    Electrically, it's a bit different than SPI, in that, in part, LVDS uses *differential* signal-pairs...

    Now here's where it gets interesting for anaQuad...

    One of the more-difficult aspects of anaQuad is the fact that you need to "invert" the inputs... If you have a signal that's *not* centered at *ground*, then inversion is a bit difficult, requiring knowledge of the magnitude and offset of the signal. Even more complicated is *scaling*... I'll come back to that.

    In my experiments, it was found to be surprisingly reliable *despite* this, but if you *didn't* have to do this--if the inverted signal was *part* of the signal--then it would be even more reliable.

    So, back to LVDS... We have *two* wires for each signal... They are *differential*, meaning that one is essentially the inverse of the other. This is for several reasons, including increased noise-immunity *and* decreased noise-emission.

    When this data's fed into a receiver, the receiver *typically* looks for... duh duhn dunnnnn... *crossover* of the two signals.

    So now... that's *exactly* what makes anaQuad so much more reliable than I even expected when designing it with that goal in mind... it's looking for *crossover* of (various multiples of) the signals...

    So, I mentioned *scaling* of the input signals... In order to achieve anaQuad4x, we have to use not only the *non-inverted* and *inverted* signals (used also by anaQuad2x), but we *also* need the two signals *scaled*... (I use signal*2, but that isn't *exact*, it's just *easy math* for the processor). But: Scaling (properly) *absolutely* requires knowledge of the DC-offset (and magnitude?) of the original signal... which, again, I just threw in a random value that was close, and it seems to work surprisingly well despite having-done. But, it would be *great* if the DC-offset was not in the picture... and, low-and-behold that's exactly what using differential signaling does for yah... removes the DC-offset. BooYah!

    So, now... Could it be used as a *communication* method... similar to LVDS...? e.g. anaQuad4x can detect 16 different positions in a single cycle... Comparing that to LVDS, that would mean for every singular bit transmitted in LVDS (alongside the clock signal), 8 different levels could be detected.

    Is this helpful...? I'm not certain... I'll come back to that in the next project-log...

  • anaQuad120

    esot.eric03/09/2016 at 09:24 0 comments

    Alright, so here's the spindle-motor from a 5.25in floppy drive...

    This guy has 3 Hall-effect sensors to sense the timing necessary to power the motor's windings. There are multiple North/South-pole magnets around the motor, so while these are spaced about 22.5degrees apart around the motor, they sense the magnets at 120 degrees apart.

    Low and behold, the crossover-detection method used in anaQuad can be made to work with two of these 120-degree phase-shifted signals (normal 'quadrature' signals are 90-degrees phase-shifted). Here's a plot of 120-degree phase-shift (two channels, and multiples thereof):

    So, no problem detecting 12 positions per magnet.

    Here's the 'scope output of one of the Hall-Effect sensors as I rotated the motor through one full revolution:

    So, there appears to be 12 magnets on the motor.

    Thus, with the crossovers shown in the graph, above, there should be no problem detecting 144 positions per revolution. Since this kind of motor has quite a bit of momentum, as well as having particular positions it wants to stay in (kinda like a stepper-motor), higher resolution than that probably doesn't make a whole lot of sense... But, it's probably possible with additional multiples of the input-signals (just as anaQuad2x has been bumped up to 4x and could definitely go to 6x). This motor seems to have 72 positions it wants to rest in ("detents") per revolution...

    These particular Hall-Effect sensors have two "outputs." The voltage *between* these outputs is what we're looking for. So, either, use an ADC with differential inputs (and preferably one that has scaling, as well, since 0.25V is pretty small), or we'll need to add some op-amps. (Some, especially newer, Hall-Effect sensors include those op-amps internally, so their single output might swing from 0V to 5V. Some other ones actually contain thresholding circuitry, so couldn't be used with anaQuad, just as there are quadrature optical encoders that only output square-waves).

    This particular motor/driver combo has clearly-marked inputs: "12" "5" "G" and "C"... when powered with 5V and 12V, leaving "C" disconnected, the motor spins on its own. Connecting "C" (Control?) to GND causes it to stop, which is perfect for using this system as an input "knob" or whatnot.

    So, there you have it. This guy might be handy for some sort of jog-dial or scroll-wheel, where you might want to spin it and allow it to spin-down on its own. Could also be used as something like this:

    And, it might be a bit hokey, but it could, I suppose, be attached to another motor's shaft and used as an encoder (at which point higher-scaling might be handy).

  • almost plug-n-play!

    esot.eric03/08/2016 at 15:28 0 comments

    Plugged in a computer-mouse's encoder, 48 slots -> 768 measurable positions.

    This guy's a great (unintentional) test of the system's functionality despite somewhat dramatic calibration-error... The software's configured for a sine wave from 0 to 2.5V, (no software change from the previous experiment) and the encoder's outputting 1V to 3V (whoops), yet seems to be working surprisingly well.


  • 6x... 24 steps per slot...?

    esot.eric03/08/2016 at 08:41 0 comments

    Is it worth it...? We're at 4x as it is, 6x can be accomplished with the 4x cases (A, B, -A, -B, 2A, and 2B) and the addition of 4A and 4B (and maybe their inverses).

    It appears that 4x isn't perfectly-spaced... in fact, the crossover of 2A and B is somewhere around the midpoint of 1/2 and 2/3 of the 2x case... so adding 4A/B to get 6x (rather than upping to 8x) kinda makes sense.

    More code, is it worth it...?

    (8x would require 1/2 A and 1/2 B...)

    All this multiplication can be handled by shift, *if* signed-shift is defined (which is debatable). 2* is a single shift, which is no prob for most uC's, 1/2A likewise. 4*, though, would be two shifts... some uCs might implement arbitrary-shifting in a single CPU cycle, so 4* would be just as quick as 2* on those uCs, but e.g. AVRs have single-shift operators, so 4* would require two CPU cycles... and... 2* can also be implemented as A+A, which is usually a single cycle instruction... Of course, this all gets a bit more complicated if, e.g., the ADC's are 10-bit and the architecture is 8-bit...

    And, again, I'm not sure signed-shift is well-defined and architecture-independent.

    So, contemplations...

View all 13 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates