2

In a sine/cosine encoder, position information is encoded in two 90 degree phase shifted sinusoidal signals. Typically, the approach to decode this information is by generating a coarse quadrature signal and sum a finer position information, interpolated through the arctan function:

My question relates to this implementation. Since both signals originate from the same source, I assume that the cosine signal does not encode any extra information that can be extracted purely from the sine signal. Although they are both generated from the same source, the cosine signal will have phase, gain and offset errors in relation to the sine signal, which limit the accuracy of the previous calculation. So why are both signals used? To obtain the fine position information, can't the arctan function be applied to an original signal, for instance the sine wave, and a "virtual" 90 degree offset signal, cosine, generated from this sine wave, therefore eliminating these sources of error?

user275717
  • 21
  • 2
  • You cannot resolve ambiguity with just sine (or just cos) for example between the first and second quadrants with sine. –  Feb 02 '21 at 17:48
  • 1
    Sine or cosine alone is enough if you have another parallel system to resolve the "which quadrant" ambiquity. Sin and cos are useful to have because there's so many applications where both of them are needed and should be calculated if there's available only the angle from another sensor type. –  Feb 02 '21 at 18:04

3 Answers3

3

Consider this:

enter image description here

Now assume you have a sin value of 0.0. Where are you? x = 0 or x = pi? You cannot tell from this information. If, however, you also have the cos, then you know from it that you are at x = 0 if cos(x) = 1 or you are at x = pi if cos(x) = -1.

jwh20
  • 7,917
  • 1
  • 17
  • 28
1

The encoder position is normally measured at regular intervals, and frequently multiple revolutions may occur between sample times. Hardware for accumulating a digital quadrature position is widely available on microcontrollers and this hardware may be used to keep track of how many quadrants were traversed between samples. If only sine and cosine values at the sample times were available then the maximum speed for the encoder would be roughly 1/2 electrical revolution per sample period; by using a hardware quadrature decoder the speed may be much higher.

The coarse signal is not redundant because it is sampled at a much higher rate than the fine signal.

A single sine or cosine signal digitized into a pulse train can measure a speed only half that of a digital quadrature signal, and cannot be used to determine direction.

Buttle
  • 111
  • 1
0

The inverse of sine or cosine is the same in two quadrants, so it won't give you the deterministic angle. Further:

$$V_{sin}=V_{ref} sin\varphi$$ $$sin\varphi=\frac{V_{sin}}{V_{ref}}$$

As you see, the angle calculation through asin() would be related to the V_ref fluctuation, cable resistance,...

$$V_{cos}=V_{ref} cos\varphi$$ $$tg\varphi =\frac{V_{ref} sin\varphi}{V_{ref} cos\varphi}$$ $$\varphi =arctg\frac{V_{sin}}{V_{cos}}$$

Phi=atan2(V_sin, V_cos);

You can get an idea why atan() is better way, because you get rid of V_ref and possible voltage drop. With newer methods, neither atan() is used, rather a closed loop filter, named Angle Tracking Observer because atan() is quite CPU intense computation.

Marko Buršič
  • 23,961
  • 2
  • 20
  • 33
  • Thank you for the answer. My question was not quite clear. The proposed transformation would still be atan(), applied to the digitized sine signal and a mathematically generated cosine from the sine signal (same waveform plus 90 degree phase difference). This generated cosine appears to me to be the same as the measured one, but with the added benefit of having the same Vref, no offset and a perfect 90 degree phase difference. Ambiguity is resolved aswell with the atan() transformation. Would this still pose a problem? – user275717 Feb 02 '21 at 18:22
  • 1
    @GDomingos What do you use for $V_{ref}$? that Marko has shown, and is required if you artificially determine the cosine component. The advantage of arctan(sin,cos) is that $V_{ref}$ is not required. It is likely that if there are errors in acquiring $V_{sin}$, then those same errors will also apply to measuring $V_{cos}$...and your determination of angle will have decent accuracy. BTW: the CORDIC algorithm is efficient for calculating the atan2() function, and also gives $\sqrt{sin^2+cos^2}$ to boot. – glen_geek Feb 02 '21 at 20:48
  • You can't generate a "virtual" signal, because it won't follow the position, if it's unknown at that time?? Moreover atan2() as @glen_geek recommends is a good choice VS. asin() that may take even longer time to compute and it needs V_ref + estimated voltage drop over wires,... – Marko Buršič Feb 02 '21 at 21:07