Dirty sine wave generator

On Friday, September 20, 2019 at 5:47:54 AM UTC-4, Martin Brown wrote:
On 19/09/2019 16:02, bitrex wrote:
On 9/19/19 4:52 AM, Martin Brown wrote:
On 19/09/2019 06:35, bitrex wrote:
Is there a way to extrapolate this D flip flop-based/XOR modified
sine-wave generator to be a little less "steppy" using a couple more
flops or XOR gates? or provide outputs of different phases?

I was thinking about a thing using the TinyLogic series flops/gates
to clock it very fast.

http://zpostbox.ru/digital_generators_of_sine_wave_signals_2.gif

The faster you try to clock it the worse things will get with
propagation delays in the flip flops as drawn.

To take out most of the 5th harmonic component you will need a divide
by 5 counter in the right phase. Each extra component you try to
compensate seriously limits the maximum output frequency that it will
work at. The fundamental will be lowered from f/3 to f/15 by adding
this factor.

The least bad fix might be to treat the output as a current source and
integrate it so that you get a step wise linear approximation.
(or aggressively low pass filter against the fifth harmonic and above)..

What are you trying to do?


I have an I/Q demodulator/detector scheme that has to run pretty fast at
very low voltage, the 0 degree phase path goes through some op amps with
somewhat limited bandwidth and slew rate because they're low voltage
types. it's fed by a reference clock.

the whole system would work fine with square waves if I had the budget
for infinite GBW and slew rate parts but the op amps I can afford on the
budget in the path don't really have enough GBW and slew rate to support
a square wave at the speed I need to go so, I don't want to shove a raw
square into them like a brutal person.

this would work fine to produce a modified sine and a quadrature square
wave and is just what I need, aside from the glitches which causes
problems down the line. using lower value resistors I can just drive the
input of the analog section directly from the flop outputs, the amps are
single-supply biased at the mid-point of the same supply and just drive
it in, nice.

https://imgur.com/a/IahCKuJ

I want to maintain a tight phase relationship between the two signals so
IDK if aggressive low passing is an option here. a couple flops and
gates is within my price/power budget so I'm wishing there was a way to
eliminate the glitch at the source without piling on parts, at that
point I'd likely just resort to DDS. but I'd prefer to be able to
provide a solution that works OK driven by a clock from whatever source
in this case

How about a 2 flip flop Johnson ring counter then?
That can be configured to generate the quadrature square waves.

Integrate them to a triangle wave and use diode shaping.
How wide a range of frequencies does this have to work at?

Why screw with the integrator and the diode mess when you can use a single chip and a few resistors to get a pretty good approximation to a sine wave. A simple filter will get rid of the harmonics. The more steps you use, the more attenuation you get with the same filter. A 14 pin, 8 FF shift register (74xx164) and anything that inverts plus 8 resistors and a single capacitor gets you a pretty simple and effective circuit.

Fewer chips than the integrator/diode thing. Simpler. Easy to see if you have something wrong.

BTW, the 2 FF ring counter doesn't even give you as good an approximation as the other circuit since the timing is equal and the steps have to be equal. The original circuit has unequal timing on the two amplitude bits and unequal amplitude to give a better approximation. The OP's simulation is not correct. It appears his weighting resistors are approximately equal so the amplitudes are the same and it ends up looking like a triangle more than a sine.

--

Rick C.

+- Get 2,000 miles of free Supercharging
+- Tesla referral code - https://ts.la/richard11209
 
On Friday, September 20, 2019 at 11:50:54 AM UTC-4, bitrex wrote:
Just one, around 200-300kHz. Here's the drive current into my load thru
the op amp network at about 200k (slight visible phase shift is due to
the AD8515 being one of the few low voltage op amps I can find in the
LTSPice library, I'll likely be using the twice-as-fast OPA4332):

https://imgur.com/a/f3RWq8j

If not for the glitchin' it'd be near perfect, with only 3 parts.

Not really. Until you get the weights right it will be more like a triangle wave. The wide pulse coming from the FF has to be three times the amplitude of the pulse coming from the clock. It looks like in your circuit the ratio isn't even 2:1.

BTW, something is wrong with the timing, but maybe that's because this is a simulation with unrealistic numbers. The glitch should be much smaller than you are showing.


I'm on
a pretty tight budget for per-unit cost...had to blow most of the budget
on fast low voltage op amp....frustrating!

I don't think the glitches will affect the performance much...I may just
try to live with it...compromise...:(

Why can't you use an 8 bit shift register? It can't be that much more than the dual FF. What parts are you using?

--

Rick C.

++ Get 2,000 miles of free Supercharging
++ Tesla referral code - https://ts.la/richard11209
 
On Thursday, September 19, 2019 at 1:35:33 AM UTC-4, bitrex wrote:
Is there a way to extrapolate this D flip flop-based/XOR modified
sine-wave generator to be a little less "steppy" using a couple more
flops or XOR gates? or provide outputs of different phases?

I was thinking about a thing using the TinyLogic series flops/gates to
clock it very fast.

http://zpostbox.ru/digital_generators_of_sine_wave_signals_2.gif

Two chips, 10 passives. The register does need a reset pulse which can be provided with a cap and resistor on power up if you don't already have one.

https://www.dropbox.com/s/4oiddnggiygir9v/SimpleSineSchematic.png?dl=0

https://www.dropbox.com/s/6npfc9xdkq64fl5/SimpleSineStep.png?dl=0

https://www.dropbox.com/s/cc2861e5n85ki7b/SimpleSineSmooth.png?dl=0

Can't do any better with anything remotely as simple or few chips.

--

Rick C.

--- Get 2,000 miles of free Supercharging
--- Tesla referral code - https://ts.la/richard11209
 
On 9/20/19 11:37 PM, Rick C wrote:
On Friday, September 20, 2019 at 11:50:54 AM UTC-4, bitrex wrote:

Just one, around 200-300kHz. Here's the drive current into my load thru
the op amp network at about 200k (slight visible phase shift is due to
the AD8515 being one of the few low voltage op amps I can find in the
LTSPice library, I'll likely be using the twice-as-fast OPA4332):

https://imgur.com/a/f3RWq8j

If not for the glitchin' it'd be near perfect, with only 3 parts.

Not really. Until you get the weights right it will be more like a triangle wave. The wide pulse coming from the FF has to be three times the amplitude of the pulse coming from the clock. It looks like in your circuit the ratio isn't even 2:1.

BTW, something is wrong with the timing, but maybe that's because this is a simulation with unrealistic numbers. The glitch should be much smaller than you are showing.


I'm on
a pretty tight budget for per-unit cost...had to blow most of the budget
on fast low voltage op amp....frustrating!

I don't think the glitches will affect the performance much...I may just
try to live with it...compromise...:(

Why can't you use an 8 bit shift register? It can't be that much more than the dual FF. What parts are you using?

The sim is 74HC but 74LVC likely for the actual device as needs to go
down to 1.8 volts on the supply hence the CMOS low-voltage type op amps.
I already need at least 1 XOR elsewhere. also a square wave that's 90
degrees advanced from the "sine."

A counter could work, too. If I could use up the extra XORs in something
like this:

<https://www.quora.com/How-do-I-generate-a-sine-wave-with-a-microcontroller>


using up the extra gates in a quad 74LVC86 would be nice. D flip flops
let you easily make the phase-shifted square.
 
On 9/21/19 1:37 AM, bitrex wrote:
On 9/20/19 11:37 PM, Rick C wrote:
On Friday, September 20, 2019 at 11:50:54 AM UTC-4, bitrex wrote:

Just one, around 200-300kHz. Here's the drive current into my load thru
the op amp network at about 200k (slight visible phase shift is due to
the AD8515 being one of the few low voltage op amps I can find in the
LTSPice library, I'll likely be using the twice-as-fast OPA4332):

https://imgur.com/a/f3RWq8j

If not for the glitchin' it'd be near perfect, with only 3 parts.

Not really.  Until you get the weights right it will be more like a
triangle wave.  The wide pulse coming from the FF has to be three
times the amplitude of the pulse coming from the clock.  It looks like
in your circuit the ratio isn't even 2:1.

BTW, something is wrong with the timing, but maybe that's because this
is a simulation with unrealistic numbers.  The glitch should be much
smaller than you are showing.


I'm on
a pretty tight budget for per-unit cost...had to blow most of the budget
on fast low voltage op amp....frustrating!

I don't think the glitches will affect the performance much...I may just
try to live with it...compromise...:(

Why can't you use an 8 bit shift register?  It can't be that much more
than the dual FF.  What parts are you using?


The sim is 74HC but 74LVC likely for the actual device as needs to go
down to 1.8 volts on the supply hence the CMOS low-voltage type op amps.
I already need at least 1 XOR elsewhere. also a square wave that's 90
degrees advanced from the "sine."

A counter could work, too. If I could use up the extra XORs in something
like this:

https://www.quora.com/How-do-I-generate-a-sine-wave-with-a-microcontroller


using up the extra gates in a quad 74LVC86 would be nice. D flip flops
let you easily make the phase-shifted square.

a 4 "step" sine will probably be fine. Don't really want to use more
op-amp sections 1.8 volt CMOS amps with the bandwidth I need aren't that
cheap relatively speaking. this is to go in a semi-disposable product I
got a budget!!
 
On 21/09/19 06:52, bitrex wrote:
On 9/21/19 1:28 AM, Rick C wrote:
On Thursday, September 19, 2019 at 1:35:33 AM UTC-4, bitrex wrote:
Is there a way to extrapolate this D flip flop-based/XOR modified
sine-wave generator to be a little less "steppy" using a couple more
flops or XOR gates? or provide outputs of different phases?

I was thinking about a thing using the TinyLogic series flops/gates to
clock it very fast.

http://zpostbox.ru/digital_generators_of_sine_wave_signals_2.gif

Two chips, 10 passives.  The register does need a reset pulse which can be
provided with a cap and resistor on power up if you don't already have one.

https://www.dropbox.com/s/4oiddnggiygir9v/SimpleSineSchematic.png?dl=0

https://www.dropbox.com/s/6npfc9xdkq64fl5/SimpleSineStep.png?dl=0

https://www.dropbox.com/s/cc2861e5n85ki7b/SimpleSineSmooth.png?dl=0

Can't do any better with anything remotely as simple or few chips.


Thank you looks good. How to get a quadrature signal then becomes a question.
All-pass phase-shifter, maybe.

Add a second set of resistors/capacitor to the Q outputs,
same values but slipped along by 2 outputs.
 
On 9/21/19 1:37 AM, bitrex wrote:
On 9/20/19 11:37 PM, Rick C wrote:
On Friday, September 20, 2019 at 11:50:54 AM UTC-4, bitrex wrote:

Just one, around 200-300kHz. Here's the drive current into my load thru
the op amp network at about 200k (slight visible phase shift is due to
the AD8515 being one of the few low voltage op amps I can find in the
LTSPice library, I'll likely be using the twice-as-fast OPA4332):

https://imgur.com/a/f3RWq8j

If not for the glitchin' it'd be near perfect, with only 3 parts.

Not really.  Until you get the weights right it will be more like a
triangle wave.  The wide pulse coming from the FF has to be three
times the amplitude of the pulse coming from the clock.  It looks like
in your circuit the ratio isn't even 2:1.

BTW, something is wrong with the timing, but maybe that's because this
is a simulation with unrealistic numbers.  The glitch should be much
smaller than you are showing.


I'm on
a pretty tight budget for per-unit cost...had to blow most of the budget
on fast low voltage op amp....frustrating!

I don't think the glitches will affect the performance much...I may just
try to live with it...compromise...:(

Why can't you use an 8 bit shift register?  It can't be that much more
than the dual FF.  What parts are you using?


The sim is 74HC but 74LVC likely for the actual device as needs to go
down to 1.8 volts on the supply hence the CMOS low-voltage type op amps.
I already need at least 1 XOR elsewhere. also a square wave that's 90
degrees advanced from the "sine."

A counter could work, too. If I could use up the extra XORs in something
like this:

https://www.quora.com/How-do-I-generate-a-sine-wave-with-a-microcontroller


using up the extra gates in a quad 74LVC86 would be nice. D flip flops
let you easily make the phase-shifted square.
 
On 9/21/19 1:28 AM, Rick C wrote:
On Thursday, September 19, 2019 at 1:35:33 AM UTC-4, bitrex wrote:
Is there a way to extrapolate this D flip flop-based/XOR modified
sine-wave generator to be a little less "steppy" using a couple more
flops or XOR gates? or provide outputs of different phases?

I was thinking about a thing using the TinyLogic series flops/gates to
clock it very fast.

http://zpostbox.ru/digital_generators_of_sine_wave_signals_2.gif

Two chips, 10 passives. The register does need a reset pulse which can be provided with a cap and resistor on power up if you don't already have one.

https://www.dropbox.com/s/4oiddnggiygir9v/SimpleSineSchematic.png?dl=0

https://www.dropbox.com/s/6npfc9xdkq64fl5/SimpleSineStep.png?dl=0

https://www.dropbox.com/s/cc2861e5n85ki7b/SimpleSineSmooth.png?dl=0

Can't do any better with anything remotely as simple or few chips.

Thank you looks good. How to get a quadrature signal then becomes a
question. All-pass phase-shifter, maybe.
 
On Friday, September 20, 2019 at 10:52:12 PM UTC-7, bitrex wrote:

D flip flops
let you easily make the phase-shifted square.

But, your 8-way flipflop thing only requires a second chip (reset on an edge of bit 4)
to a second summing junction. Why would you want a phase-shifted
square?

A second 74HC273 is not going to break the bank on cost...
Heck, with two of 'em you could lengthen the period to ten
steps from eight, and have a D-flop to spare. (fifteen steps is 1.5 periods, use
the first ten for I, last ten for Q).
 
On 9/21/19 2:27 AM, Tom Gardner wrote:
On 21/09/19 06:52, bitrex wrote:
On 9/21/19 1:28 AM, Rick C wrote:
On Thursday, September 19, 2019 at 1:35:33 AM UTC-4, bitrex wrote:
Is there a way to extrapolate this D flip flop-based/XOR modified
sine-wave generator to be a little less "steppy" using a couple more
flops or XOR gates? or provide outputs of different phases?

I was thinking about a thing using the TinyLogic series flops/gates to
clock it very fast.

http://zpostbox.ru/digital_generators_of_sine_wave_signals_2.gif

Two chips, 10 passives.  The register does need a reset pulse which
can be provided with a cap and resistor on power up if you don't
already have one.

https://www.dropbox.com/s/4oiddnggiygir9v/SimpleSineSchematic.png?dl=0

https://www.dropbox.com/s/6npfc9xdkq64fl5/SimpleSineStep.png?dl=0

https://www.dropbox.com/s/cc2861e5n85ki7b/SimpleSineSmooth.png?dl=0

Can't do any better with anything remotely as simple or few chips.


Thank you looks good. How to get a quadrature signal then becomes a
question. All-pass phase-shifter, maybe.

Add a second set of resistors/capacitor to the Q outputs,
same values but slipped along by 2 outputs.

Great! I'll use an extra XOR section for inverter A9 and Bob's yer Dad's
uncle (is that the saying)
 
<ignore my earlier post; it had too many errors>

On Friday, September 20, 2019 at 10:52:12 PM UTC-7, bitrex wrote:

D flip flops
let you easily make the phase-shifted square.

But, Rick C's 8-way flipflop thing only requires a few extra sections
tacked on the end (and a second summing junction).

Why would you also want a phase-shifted square?

A second 74HC273 is not going to break the bank on cost...
Heck, with two of 'em you could lengthen the half-period to ten
steps from eight, and have a section to spare. (fifteen steps is 1.5 half-periods,
resistors to sum from the first ten for I, last ten for Q).
 
On 21.9.19 08:52, bitrex wrote:
On 9/21/19 1:28 AM, Rick C wrote:
On Thursday, September 19, 2019 at 1:35:33 AM UTC-4, bitrex wrote:
Is there a way to extrapolate this D flip flop-based/XOR modified
sine-wave generator to be a little less "steppy" using a couple more
flops or XOR gates? or provide outputs of different phases?

I was thinking about a thing using the TinyLogic series flops/gates to
clock it very fast.

http://zpostbox.ru/digital_generators_of_sine_wave_signals_2.gif

Two chips, 10 passives.  The register does need a reset pulse which
can be provided with a cap and resistor on power up if you don't
already have one.

https://www.dropbox.com/s/4oiddnggiygir9v/SimpleSineSchematic.png?dl=0

https://www.dropbox.com/s/6npfc9xdkq64fl5/SimpleSineStep.png?dl=0

https://www.dropbox.com/s/cc2861e5n85ki7b/SimpleSineSmooth.png?dl=0

Can't do any better with anything remotely as simple or few chips.


Thank you looks good. How to get a quadrature signal then becomes a
question. All-pass phase-shifter, maybe.

Are you intending to use the outputs as oscillator signals to
an I/Q (image reject) mixer?

If yes, you do not need to create a sine wave, as practically all
analog (non-DSP) mixers work by switching the incoming signal
with the oscillator signal sign bit. I balanced mixers the input
is inverted according to the sign of the oscillator signal, and
in single-ended mixers the input is just switched on and off in
sync with the oscillator signal sign bit.

In this case a two-flip-flop twisted ring counter will produce
two square waves in perfect quadrature.

--

-TV
 
On Saturday, September 21, 2019 at 1:41:55 AM UTC-4, bitrex wrote:
On 9/21/19 1:37 AM, bitrex wrote:
On 9/20/19 11:37 PM, Rick C wrote:
On Friday, September 20, 2019 at 11:50:54 AM UTC-4, bitrex wrote:

Just one, around 200-300kHz. Here's the drive current into my load thru
the op amp network at about 200k (slight visible phase shift is due to
the AD8515 being one of the few low voltage op amps I can find in the
LTSPice library, I'll likely be using the twice-as-fast OPA4332):

https://imgur.com/a/f3RWq8j

If not for the glitchin' it'd be near perfect, with only 3 parts.

Not really.  Until you get the weights right it will be more like a
triangle wave.  The wide pulse coming from the FF has to be three
times the amplitude of the pulse coming from the clock.  It looks like
in your circuit the ratio isn't even 2:1.

BTW, something is wrong with the timing, but maybe that's because this
is a simulation with unrealistic numbers.  The glitch should be much
smaller than you are showing.


I'm on
a pretty tight budget for per-unit cost...had to blow most of the budget
on fast low voltage op amp....frustrating!

I don't think the glitches will affect the performance much...I may just
try to live with it...compromise...:(

Why can't you use an 8 bit shift register?  It can't be that much more
than the dual FF.  What parts are you using?


The sim is 74HC but 74LVC likely for the actual device as needs to go
down to 1.8 volts on the supply hence the CMOS low-voltage type op amps..
I already need at least 1 XOR elsewhere. also a square wave that's 90
degrees advanced from the "sine."

A counter could work, too. If I could use up the extra XORs in something
like this:

https://www.quora.com/How-do-I-generate-a-sine-wave-with-a-microcontroller


using up the extra gates in a quad 74LVC86 would be nice. D flip flops
let you easily make the phase-shifted square.

a 4 "step" sine will probably be fine. Don't really want to use more
op-amp sections 1.8 volt CMOS amps with the bandwidth I need aren't that
cheap relatively speaking. this is to go in a semi-disposable product I
got a budget!!

Why would you need *more* op amps? Every amplifier is also a filter... or can be.

--

Rick C.

-+- Get 2,000 miles of free Supercharging
-+- Tesla referral code - https://ts.la/richard11209
 
On Saturday, September 21, 2019 at 1:37:53 AM UTC-4, bitrex wrote:
On 9/20/19 11:37 PM, Rick C wrote:
On Friday, September 20, 2019 at 11:50:54 AM UTC-4, bitrex wrote:

Just one, around 200-300kHz. Here's the drive current into my load thru
the op amp network at about 200k (slight visible phase shift is due to
the AD8515 being one of the few low voltage op amps I can find in the
LTSPice library, I'll likely be using the twice-as-fast OPA4332):

https://imgur.com/a/f3RWq8j

If not for the glitchin' it'd be near perfect, with only 3 parts.

Not really. Until you get the weights right it will be more like a triangle wave. The wide pulse coming from the FF has to be three times the amplitude of the pulse coming from the clock. It looks like in your circuit the ratio isn't even 2:1.

BTW, something is wrong with the timing, but maybe that's because this is a simulation with unrealistic numbers. The glitch should be much smaller than you are showing.


I'm on
a pretty tight budget for per-unit cost...had to blow most of the budget
on fast low voltage op amp....frustrating!

I don't think the glitches will affect the performance much...I may just
try to live with it...compromise...:(

Why can't you use an 8 bit shift register? It can't be that much more than the dual FF. What parts are you using?


The sim is 74HC but 74LVC likely for the actual device as needs to go
down to 1.8 volts on the supply hence the CMOS low-voltage type op amps.
I already need at least 1 XOR elsewhere. also a square wave that's 90
degrees advanced from the "sine."

An XOR is an inverter. A two input AND or OR gate will give you any phasing of square wave you want on the Johnson ring counter.


A counter could work, too. If I could use up the extra XORs in something
like this:

https://www.quora.com/How-do-I-generate-a-sine-wave-with-a-microcontroller

For an MCU that is the silliest circuit I've ever seen. The MCU can count any sequence needed without the XORs, not that you are talking about using an MCU.


using up the extra gates in a quad 74LVC86 would be nice. D flip flops
let you easily make the phase-shifted square.

Maybe you need to read a little about ring counters. They have a lot of nice features.

--

Rick C.

--+ Get 2,000 miles of free Supercharging
--+ Tesla referral code - https://ts.la/richard11209
 
On 9/21/19 12:10 PM, bitrex wrote:

If yes, you do not need to create a sine wave, as practically all
analog (non-DSP) mixers work by switching the incoming signal
with the oscillator signal sign bit. I balanced mixers the input
is inverted according to the sign of the oscillator signal, and
in single-ended mixers the input is just switched on and off in
sync with the oscillator signal sign bit.

In this case a two-flip-flop twisted ring counter will produce
two square waves in perfect quadrature.


One of the phases has to be put thru an inductive transducer first, V -
I, then Kelvin-sense V across the transducer. If I had a high supply
voltage to work with I'd just use some fast op amps, square waves and no
prob as you say. I don't I'm really constrained on the supply voltage in
this app.

They can support sines or modified-sines at the freq I need to go at and
in my tests with bench signal gen the phase shift detector works great.
Drive the analog portion with a square and run into the slew rate limit
of the op amps and blech!

Mind you another requirement is it has to run from a clock I can't just
DDS some sines of the appropriate phase relationships from a uP as I'd
do in my own project or something.
 
On 9/21/19 7:39 AM, Tauno Voipio wrote:
On 21.9.19 08:52, bitrex wrote:
On 9/21/19 1:28 AM, Rick C wrote:
On Thursday, September 19, 2019 at 1:35:33 AM UTC-4, bitrex wrote:
Is there a way to extrapolate this D flip flop-based/XOR modified
sine-wave generator to be a little less "steppy" using a couple more
flops or XOR gates? or provide outputs of different phases?

I was thinking about a thing using the TinyLogic series flops/gates to
clock it very fast.

http://zpostbox.ru/digital_generators_of_sine_wave_signals_2.gif

Two chips, 10 passives.  The register does need a reset pulse which
can be provided with a cap and resistor on power up if you don't
already have one.

https://www.dropbox.com/s/4oiddnggiygir9v/SimpleSineSchematic.png?dl=0

https://www.dropbox.com/s/6npfc9xdkq64fl5/SimpleSineStep.png?dl=0

https://www.dropbox.com/s/cc2861e5n85ki7b/SimpleSineSmooth.png?dl=0

Can't do any better with anything remotely as simple or few chips.


Thank you looks good. How to get a quadrature signal then becomes a
question. All-pass phase-shifter, maybe.


Are you intending to use the outputs as oscillator signals to
an I/Q (image reject) mixer?

If yes, you do not need to create a sine wave, as practically all
analog (non-DSP) mixers work by switching the incoming signal
with the oscillator signal sign bit. I balanced mixers the input
is inverted according to the sign of the oscillator signal, and
in single-ended mixers the input is just switched on and off in
sync with the oscillator signal sign bit.

In this case a two-flip-flop twisted ring counter will produce
two square waves in perfect quadrature.

One of the phases has to be put thru an inductive transducer first, V ->
I, then Kelvin-sense V across the transducer. If I had a high supply
voltage to work with I'd just use some fast op amps, square waves and no
prob as you say. I don't I'm really constrained on the supply voltage in
this app.

They can support sines or modified-sines at the freq I need to go at and
in my tests with bench signal gen the phase shift detector works great.
Drive the analog portion with a square and run into the slew rate limit
of the op amps and blech!
 
On Saturday, September 21, 2019 at 12:11:57 PM UTC-4, bitrex wrote:
On 9/21/19 12:10 PM, bitrex wrote:

If yes, you do not need to create a sine wave, as practically all
analog (non-DSP) mixers work by switching the incoming signal
with the oscillator signal sign bit. I balanced mixers the input
is inverted according to the sign of the oscillator signal, and
in single-ended mixers the input is just switched on and off in
sync with the oscillator signal sign bit.

In this case a two-flip-flop twisted ring counter will produce
two square waves in perfect quadrature.


One of the phases has to be put thru an inductive transducer first, V -
I, then Kelvin-sense V across the transducer. If I had a high supply
voltage to work with I'd just use some fast op amps, square waves and no
prob as you say. I don't I'm really constrained on the supply voltage in
this app.

They can support sines or modified-sines at the freq I need to go at and
in my tests with bench signal gen the phase shift detector works great.
Drive the analog portion with a square and run into the slew rate limit
of the op amps and blech!

Mind you another requirement is it has to run from a clock I can't just
DDS some sines of the appropriate phase relationships from a uP as I'd
do in my own project or something.

I don't get what that means. Why is an MCU not an option because of the clock??? The MCU can run on an internal RC clock and sync to the supplied clock using an interrupt or polling. Finish the calculation or table lookup and stop the CPU to wait for the clock edge.

--

Rick C.

-++ Get 2,000 miles of free Supercharging
-++ Tesla referral code - https://ts.la/richard11209
 
On 21/09/2019 04:29, Rick C wrote:
On Friday, September 20, 2019 at 5:47:54 AM UTC-4, Martin Brown
wrote:
On 19/09/2019 16:02, bitrex wrote:
On 9/19/19 4:52 AM, Martin Brown wrote:
On 19/09/2019 06:35, bitrex wrote:
Is there a way to extrapolate this D flip flop-based/XOR
modified sine-wave generator to be a little less "steppy"
using a couple more flops or XOR gates? or provide outputs of
different phases?

I was thinking about a thing using the TinyLogic series
flops/gates to clock it very fast.

http://zpostbox.ru/digital_generators_of_sine_wave_signals_2.gif



The faster you try to clock it the worse things will get with
propagation delays in the flip flops as drawn.

To take out most of the 5th harmonic component you will need a
divide by 5 counter in the right phase. Each extra component
you try to compensate seriously limits the maximum output
frequency that it will work at. The fundamental will be lowered
from f/3 to f/15 by adding this factor.

The least bad fix might be to treat the output as a current
source and integrate it so that you get a step wise linear
approximation. (or aggressively low pass filter against the
fifth harmonic and above).

What are you trying to do?


I have an I/Q demodulator/detector scheme that has to run pretty
fast at very low voltage, the 0 degree phase path goes through
some op amps with somewhat limited bandwidth and slew rate
because they're low voltage types. it's fed by a reference
clock.

the whole system would work fine with square waves if I had the
budget for infinite GBW and slew rate parts but the op amps I can
afford on the budget in the path don't really have enough GBW and
slew rate to support a square wave at the speed I need to go so,
I don't want to shove a raw square into them like a brutal
person.

this would work fine to produce a modified sine and a quadrature
square wave and is just what I need, aside from the glitches
which causes problems down the line. using lower value resistors
I can just drive the input of the analog section directly from
the flop outputs, the amps are single-supply biased at the
mid-point of the same supply and just drive it in, nice.

https://imgur.com/a/IahCKuJ

I want to maintain a tight phase relationship between the two
signals so IDK if aggressive low passing is an option here. a
couple flops and gates is within my price/power budget so I'm
wishing there was a way to eliminate the glitch at the source
without piling on parts, at that point I'd likely just resort to
DDS. but I'd prefer to be able to provide a solution that works
OK driven by a clock from whatever source in this case

How about a 2 flip flop Johnson ring counter then? That can be
configured to generate the quadrature square waves.

Integrate them to a triangle wave and use diode shaping. How wide a
range of frequencies does this have to work at?

Why screw with the integrator and the diode mess when you can use a
single chip and a few resistors to get a pretty good approximation to
a sine wave. A simple filter will get rid of the harmonics. The
more steps you use, the more attenuation you get with the same
filter. A 14 pin, 8 FF shift register (74xx164) and anything that
inverts plus 8 resistors and a single capacitor gets you a pretty
simple and effective circuit.

Fewer chips than the integrator/diode thing. Simpler. Easy to see
if you have something wrong.

I am inclined to agree. I thought he was pushing hard up against the
actual speed capabilities of the parts not down at a few hundred kHz.
BTW, the 2 FF ring counter doesn't even give you as good an
approximation as the other circuit since the timing is equal and the
steps have to be equal. The original circuit has unequal timing on
the two amplitude bits and unequal amplitude to give a better
approximation. The OP's simulation is not correct. It appears his
weighting resistors are approximately equal so the amplitudes are the
same and it ends up looking like a triangle more than a sine.

A two step approximation to a sine wave is always going to look pretty
dreadful - that is why is suggested piecewise linear approximation which
would otherwise work fairly well for a spot frequency - even more so
with a bit of diode shaping to lop the top off.

The important thing that the 2 FF ring does provide is a locked phase
quadrature output which was one of his other unsatisfied requirements.

--
Regards,
Martin Brown
 
On 9/22/19 4:58 AM, Martin Brown wrote:

Why screw with the integrator and the diode mess when you can use a
single chip and a few resistors to get a pretty good approximation to
a sine wave.  A simple filter will get rid of the harmonics.  The
more steps you use, the more attenuation you get with the same
filter.  A 14 pin, 8 FF shift register (74xx164) and anything that
inverts plus 8 resistors and a single capacitor gets you a pretty
simple and effective circuit.

Fewer chips than the integrator/diode thing.  Simpler.  Easy to see
if you have something wrong.

I am inclined to agree. I thought he was pushing hard up against the
actual speed capabilities of the parts not down at a few hundred kHz.

300kHz FS square wave out of an op amp with a barely 7 V/uS slew rate
(because it's a micro-power part) - sucks!
 
On 9/22/19 4:58 AM, Martin Brown wrote:
On 21/09/2019 04:29, Rick C wrote:
On Friday, September 20, 2019 at 5:47:54 AM UTC-4, Martin Brown
wrote:
On 19/09/2019 16:02, bitrex wrote:
On 9/19/19 4:52 AM, Martin Brown wrote:
On 19/09/2019 06:35, bitrex wrote:
Is there a way to extrapolate this D flip flop-based/XOR
modified sine-wave generator to be a little less "steppy"
using a couple more flops or XOR gates? or provide outputs of
different phases?

I was thinking about a thing using the TinyLogic series
flops/gates to clock it very fast.

http://zpostbox.ru/digital_generators_of_sine_wave_signals_2.gif



The faster you try to clock it the worse things will get with
propagation delays in the flip flops as drawn.

To take out most of the 5th harmonic component you will need a
divide by 5 counter in the right phase. Each extra component
you try to compensate seriously limits the maximum output
frequency that it will work at. The fundamental will be lowered
from f/3 to f/15 by adding this factor.

The least bad fix might be to treat the output as a current
source and integrate it so that you get a step wise linear
approximation. (or aggressively low pass filter against the
fifth harmonic and above).

What are you trying to do?


I have an I/Q demodulator/detector scheme that has to run pretty
fast at very low voltage, the 0 degree phase path goes through
some op amps with somewhat limited bandwidth and slew rate
because they're low voltage types. it's fed by a reference
clock.

the whole system would work fine with square waves if I had the
budget for infinite GBW and slew rate parts but the op amps I can
afford on the budget in the path don't really have enough GBW and
slew rate to support a square wave at the speed I need to go so,
I don't want to shove a raw square into them like a brutal
person.

this would work fine to produce a modified sine and a quadrature
square wave and is just what I need, aside from the glitches
which causes problems down the line. using lower value resistors
I can just drive the input of the analog section directly from
the flop outputs, the amps are single-supply biased at the
mid-point of the same supply and just drive it in, nice.

https://imgur.com/a/IahCKuJ

I want to maintain a tight phase relationship between the two
signals so IDK if aggressive low passing is an option here. a
couple flops and gates is within my price/power budget so I'm
wishing there was a way to eliminate the glitch at the source
without piling on parts, at that point I'd likely just resort to
DDS. but I'd prefer to be able to provide a solution that works
OK driven by a clock from whatever source in this case

How about a 2 flip flop Johnson ring counter then? That can be
configured to generate the quadrature square waves.

Integrate them to a triangle wave and use diode shaping. How wide a
range of frequencies does this have to work at?

Why screw with the integrator and the diode mess when you can use a
single chip and a few resistors to get a pretty good approximation to
a sine wave.  A simple filter will get rid of the harmonics.  The
more steps you use, the more attenuation you get with the same
filter.  A 14 pin, 8 FF shift register (74xx164) and anything that
inverts plus 8 resistors and a single capacitor gets you a pretty
simple and effective circuit.

Fewer chips than the integrator/diode thing.  Simpler.  Easy to see
if you have something wrong.

I am inclined to agree. I thought he was pushing hard up against the
actual speed capabilities of the parts not down at a few hundred kHz.

BTW, the 2 FF ring counter doesn't even give you as good an
approximation as the other circuit since the timing is equal and the
steps have to be equal.  The original circuit has unequal timing on
the two amplitude bits and unequal amplitude to give a better
approximation.  The OP's simulation is not correct.  It appears his
weighting resistors are approximately equal so the amplitudes are the
same and it ends up looking like a triangle more than a sine.

A two step approximation to a sine wave is always going to look pretty
dreadful - that is why is suggested piecewise linear approximation which
would otherwise work fairly well for a spot frequency - even more so
with a bit of diode shaping to lop the top off.

The important thing that the 2 FF ring does provide is a locked phase
quadrature output which was one of his other unsatisfied requirements.

This 4 flip-flopper with the outputs taken from Q and "delayed" not Q
for two phases the should be good enuff

<https://imgur.com/a/SZ6Px9N>
 

Welcome to EDABoard.com

Sponsor

Back
Top