Let's say I have a 60 Hz sine wave, and I want to create a second wave of the same frequency, but with a phase difference controlled by another analog input voltage, - 10 to 10 V for instance. Is there a chip or simple circuit that can do this? I want to control the shift from 0 to 360 degrees
2 Answers
You can use a phase locked loop chip to create a version of your input voltage that is 90 degrees distant.
If you used a potentiometer with top connected to original and bottom connected to phase shifted version then the wiper can sweep an output that is phase shifted anywhere between zero and 90 degrees.
Imagine that pot was a digipot then you get digital control of the phase angle. If you wanted analogue control then use an ADC to digitize the control signal.
You can also use an opamp integrator to generate a 90 degree signal and this may be preferable in terms of simplicity.
Making this work across the full 360 can be done by using an opamp inverter to add or subtract 180 degrees to the original and the 90 degree signals.
You could also use comparators and analogue switches to make the process fairly seamless.
-
\$\begingroup\$ Well, that would only get me 90 degree of shift, right? I thought of generating a sine and cosine signal then using multipliers to multiple the sine and cosine of the control voltage to the "reference" waves and adding them together. It worked in excel but I didn't know if it would work IRL \$\endgroup\$ Commented Oct 8, 2016 at 17:27
-
\$\begingroup\$ i have added stuff to my answer to suggest full seamless control. \$\endgroup\$– Andy akaCommented Oct 8, 2016 at 17:31
-
\$\begingroup\$ Yeah tats something I didn't think about. It would probably be a bit simpler. I was just seeing if there was some Uber sexy method :P \$\endgroup\$ Commented Oct 8, 2016 at 17:33
-
\$\begingroup\$ The problematic bit is tracking an input signal that may move a few hertz up and down. This is best solved with a PLL and this starts to complicate things of course, making the solution sexy ONLY if you like PLLs. \$\endgroup\$– Andy akaCommented Oct 8, 2016 at 17:41
-
1\$\begingroup\$ Another complication to consider is the amplitude of the input. If the amplitude is not held constant, when mixing with the 90 degrees PLL output, the phase will vary proportionately. It might be better to use two cascaded PLLs so that input amplitude changes don't produce a phase error. \$\endgroup\$– Andy akaCommented Oct 8, 2016 at 17:52
One 'simple' way would be to synthesize the second waveform with a microcontroller, resetting the output waveform with a timer triggered by the zero crossings of the reference input. The phase shift would be a time delay so if you really needed voltage control you'd have to digitize the input voltage and scale it to give a timer preset.
Of course the devil is in the details. If the reference has jitter or the frequency varies, results will vary.
A similar thing could be done in hardware with a phase-locked-loop with a sinusoidal-output VCO.
Edit: Your suggested method of generating cos(), say with an RC network and a bit of gain, then using the trig identity:
\$\sin(\omega t + \sigma) = \sin(\omega t)\cos(\sigma) + \cos(\omega t)\sin(\sigma) , -\pi/2 \le \sigma \le \pi/2 \$
..could work, but you would need the nonlinear functions of the control voltage to feed to the 4-quadrant multipliers. Do-able but messy.
-
\$\begingroup\$ Luckily, I'll be using a PLC for the control signal so I can just use math to so it. I did it originally using and ADC, microcontroller and two DDSs. Since the DDS had a phase register I could just take the ADC value and load it into the phase register. This works extremely well, but I was just seeing if there was an all analog way \$\endgroup\$ Commented Oct 8, 2016 at 17:53
-
1\$\begingroup\$ You should be able to do it with a quad op-amp and an AD5262 dual digital pot. +/-5V supplies. One 5V SPI input for control. No expensive drifty multipliers, no PLL, no muss no fuss. \$\endgroup\$ Commented Oct 8, 2016 at 17:59