Dirty sine wave generator - Page 2

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Re: Dirty sine wave generator
On 9/21/19 1:37 AM, bitrex wrote:
Quoted text here. Click to load it



Quoted text here. Click to load it

Quoted text here. Click to load it


Quoted text here. Click to load it



Re: Dirty sine wave generator
On Friday, September 20, 2019 at 10:52:12 PM UTC-7, bitrex wrote:

Quoted text here. Click to load it

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).

Re: Dirty sine wave generator

<ignore my earlier post; it  had too many errors>

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

Quoted text here. Click to load it

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).

Re: Dirty sine wave generator
On Saturday, September 21, 2019 at 1:37:53 AM UTC-4, bitrex wrote:
Quoted text here. Click to load it

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.  


Quoted text here. Click to load it

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.  


Quoted text here. Click to load it

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
We've slightly trimmed the long signature. Click to see the full one.
Re: Dirty sine wave generator
On Friday, September 20, 2019 at 5:47:54 AM UTC-4, Martin Brown wrote:
Quoted text here. Click to load it
  
Quoted text here. Click to load it
  
Quoted text here. Click to load it
  
Quoted text here. Click to load it
  
Quoted text here. Click to load it
  
Quoted text here. Click to load it
.
t  
Quoted text here. Click to load it
h  
Quoted text here. Click to load it
  
Quoted text here. Click to load it
e  
Quoted text here. Click to load it
t  
Quoted text here. Click to load it
  
Quoted text here. Click to load it
  
Quoted text here. Click to load it
e  
Quoted text here. Click to load it
e  
Quoted text here. Click to load it
  
Quoted text here. Click to load it
o  
Quoted text here. Click to load it
  
Quoted text here. Click to load it
  
Quoted text here. Click to load it

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, t
he more attenuation you get with the same filter.  A 14 pin, 8 FF shift reg
ister (74xx164) and anything that inverts plus 8 resistors and a single cap
acitor 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 a
s the other circuit since the timing is equal and the steps have to be equa
l.  The original circuit has unequal timing on the two amplitude bits and u
nequal amplitude to give a better approximation.  The OP's simulation is no
t correct.  It appears his weighting resistors are approximately equal so t
he 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
We've slightly trimmed the long signature. Click to see the full one.
Re: Dirty sine wave generator
On 21/09/2019 04:29, Rick C wrote:
Quoted text here. Click to load it
The faster you try to clock it the worse things will get with
Quoted text here. Click to load it

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.
Quoted text here. Click to load it

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

Re: Dirty sine wave generator
On 9/22/19 4:58 AM, Martin Brown wrote:
Quoted text here. Click to load it

Quoted text here. Click to load it

Quoted text here. Click to load it

Quoted text here. Click to load it

Quoted text here. Click to load it

Quoted text here. Click to load it

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

Re: Dirty sine wave generator
On Sunday, September 22, 2019 at 11:37:29 AM UTC-4, bitrex wrote:
Quoted text here. Click to load it

? The
Quoted text here. Click to load it

t
Quoted text here. Click to load it

 to see
Quoted text here. Click to load it

on
Quoted text here. Click to load it

ars his
Quoted text here. Click to load it
  
Quoted text here. Click to load it
h  
Quoted text here. Click to load it
  
Quoted text here. Click to load it

I suppose "good enuff" is an engineering criteria.  But I don't know why yo
u are tossing away the extra output on each phase?  You can use four output
s to drive your analog signals and get something much better for the cost o
f a resistor.  What you are doing is simply horrible and an offense to man  
and nature!  Why???

--  

  Rick C.

  +-+ Get 2,000 miles of free Supercharging
We've slightly trimmed the long signature. Click to see the full one.
Re: Dirty sine wave generator
On 9/23/19 10:34 AM, Rick C wrote:

Quoted text here. Click to load it

I was just following e.g. fig 5 in:

<https://www.tinaja.com/glib/rad_elec/digital_sinewaves_11_76.pdf>

It's not obvious to me how to get a quadrature output from your version  
in either four or 8 flop configuration, simply using a set of shifted  
resistor values on the not-Q outputs didn't seem to work. But maybe I  
did something wrong.

Re: Dirty sine wave generator
On 23.9.19 19:16, bitrex wrote:
Quoted text here. Click to load it


Quoted text here. Click to load it


Quoted text here. Click to load it


For quadrature, you have to take half of the outputs as is
and the second half inverted and shift the resistors by
half of the register length.

Just draw the waveforms.

--  

-TV

Re: Dirty sine wave generator
On 9/23/19 2:16 PM, Tauno Voipio wrote:
Quoted text here. Click to load it


Quoted text here. Click to load it


Quoted text here. Click to load it

Okay, that works. It was the part about taking half the outputs from Q  
and half from not-Q for quadrature I wasn't getting. Thnx

Re: Dirty sine wave generator
On Monday, September 23, 2019 at 11:16:56 AM UTC-7, Tauno Voipio wrote:
Quoted text here. Click to load it



Or, lengthen the chain by another quarter-cycle worth of flipflops.
The added flipflops are going to replicate the inverse of the early
FFs in the chain, because a half-cycle delay of a sine is its negative.
Keeping it all flipflops takes more energy, but works to higher frequency
because there's no inverter delay.

I keep getting confused; that makes this a good exercise!

Re: Dirty sine wave generator
On 9/23/19 10:33 PM, whit3rd wrote:
Quoted text here. Click to load it

It would sure help if one of y'all could post a schematic of these ideas  
for e.g. 4 and 8 flop cases because I'm a bit confused at this point  
too, and I'm not sure if I've got it correct in my sim...

Thanks!

Re: Dirty sine wave generator
On Monday, September 23, 2019 at 10:33:08 PM UTC-4, whit3rd wrote:
Quoted text here. Click to load it
on  
Quoted text here. Click to load it
  
Quoted text here. Click to load it

That can be done with no extra chips by using the 8 bit shift register the  
'164 with four FFs in the ring counter and two others as the follow on.  

There is still an inverter delay limiting the FF clock speed at the end of  
the ring counter chain, but maybe you are referring to the delay of the out
puts causing distortion in the waveform.  


Quoted text here. Click to load it

It's not that complex, although I was confused about the nature of the quad
rature signal.  I think someone mentioned needing only a square wave quadra
ture signal which is easier to get than the sine wave quadrature signal eve
n if that is also not too hard.  

--  

  Rick C.

  ++- Get 2,000 miles of free Supercharging
We've slightly trimmed the long signature. Click to see the full one.
Re: Dirty sine wave generator
On Monday, September 23, 2019 at 12:16:15 PM UTC-4, bitrex wrote:
Quoted text here. Click to load it
y
ich
.
y you are tossing away the extra output on each phase?  You can use four ou
tputs to drive your analog signals and get something much better for the co
st of a resistor.  What you are doing is simply horrible and an offense to  
man and nature!  Why???
Quoted text here. Click to load it
  
Quoted text here. Click to load it

I used a '4017 to make a stepped sine wave like that.  First harmonics at
  
the 11th (or something like that.)  The only 'gotcha' was the output impeda
nce of the
'4017 which needed to be factored into the resistor values.    

George H.

Re: Dirty sine wave generator
On Monday, September 23, 2019 at 12:16:15 PM UTC-4, bitrex wrote:
Quoted text here. Click to load it
y
ich
.
y you are tossing away the extra output on each phase?  You can use four ou
tputs to drive your analog signals and get something much better for the co
st of a resistor.  What you are doing is simply horrible and an offense to  
man and nature!  Why???
Quoted text here. Click to load it

I'm pretty sure fig 5 is wrong.  The value of the resistors may be reversed
, or just wrong.  The middle step should be the big one since that is where
 the sine wave slope is steepest.  They show that in the waveform, but that
 waveform does not match the resistor values.  Look at your waveform vs. fi
g 5.  


Quoted text here. Click to load it
  
Quoted text here. Click to load it

Here are the waveforms...

http://arius.com/photos/SimpleSine_Filter.jpg

You will need to figure out your opamp biasing since LTspice digital parts  
are 1 volt logic default and I didn't feel like messing with the details.  
I actually got a better result with a passive filter but the issues are mos
tly LTspice vs. the real world I believe.  

Here is the schematic, 300 lines.  I used 6 FFs of a 14 pin, 8 FF shift reg
ister you can buy virtually anywhere, 74xx164 and an inverter you can use y
our XOR for.  

If you want to view the stepped waveform add small resistors in front of C1
 and C2 and look at the voltage across these resistors.  

Version 4
SHEET 1 2328 680
WIRE 1936 -624 1840 -624
WIRE 2016 -624 2000 -624
WIRE 1840 -544 1840 -624
WIRE 1872 -544 1840 -544
WIRE 2016 -544 2016 -624
WIRE 2016 -544 1952 -544
WIRE 2112 -544 2016 -544
WIRE 2176 -544 2112 -544
WIRE 2176 -512 2176 -544
WIRE 1552 -496 1456 -496
WIRE 1904 -496 1552 -496
WIRE 1904 -480 1904 -496
WIRE 656 -464 480 -464
WIRE 768 -464 656 -464
WIRE 1056 -464 768 -464
WIRE 1344 -464 1056 -464
WIRE 1488 -464 1344 -464
WIRE 1680 -464 1552 -464
WIRE 1840 -464 1840 -544
WIRE 1840 -464 1680 -464
WIRE 1872 -464 1840 -464
WIRE 2016 -448 2016 -544
WIRE 2016 -448 1936 -448
WIRE 1744 -432 1600 -432
WIRE 1872 -432 1744 -432
WIRE 480 -416 480 -464
WIRE 768 -416 768 -464
WIRE 1056 -416 1056 -464
WIRE 1344 -416 1344 -464
WIRE 1600 -400 1600 -432
WIRE 1904 -400 1904 -416
WIRE 2176 -400 2176 -432
WIRE 1936 -304 1840 -304
WIRE 2016 -304 2000 -304
WIRE 1840 -224 1840 -304
WIRE 1872 -224 1840 -224
WIRE 2016 -224 2016 -304
WIRE 2016 -224 1952 -224
WIRE 2112 -224 2016 -224
WIRE 2176 -224 2112 -224
WIRE 256 -208 -32 -208
WIRE 544 -208 256 -208
WIRE 656 -208 544 -208
WIRE 832 -208 656 -208
WIRE 1488 -208 832 -208
WIRE 1680 -208 1552 -208
WIRE 1840 -208 1840 -224
WIRE 1840 -208 1680 -208
WIRE 1456 -176 1456 -496
WIRE 1600 -176 1600 -320
WIRE 1600 -176 1456 -176
WIRE 1904 -176 1600 -176
WIRE 2176 -176 2176 -224
WIRE -32 -160 -32 -208
WIRE 256 -160 256 -208
WIRE 544 -160 544 -208
WIRE 832 -160 832 -208
WIRE 1904 -160 1904 -176
WIRE 1744 -144 1744 -432
WIRE 1744 -144 1616 -144
WIRE 1840 -144 1840 -208
WIRE 1872 -144 1840 -144
WIRE 1456 -128 1456 -176
WIRE 1616 -128 1616 -144
WIRE 2016 -128 2016 -224
WIRE 2016 -128 1936 -128
WIRE 1744 -112 1744 -144
WIRE 1792 -112 1744 -112
WIRE 1872 -112 1792 -112
WIRE 1744 -96 1744 -112
WIRE 1904 -80 1904 -96
WIRE 2176 -64 2176 -96
WIRE 1616 -48 1616 -64
WIRE 768 -32 768 -336
WIRE 768 -32 -704 -32
WIRE 1456 -32 1456 -48
WIRE 1744 0 1744 -16
WIRE -704 144 -704 -32
WIRE -608 144 -704 144
WIRE -464 144 -544 144
WIRE -288 144 -464 144
WIRE -64 144 -128 144
WIRE -32 144 -32 -80
WIRE -32 144 -64 144
WIRE 0 144 -32 144
WIRE 224 144 160 144
WIRE 256 144 256 -80
WIRE 256 144 224 144
WIRE 288 144 256 144
WIRE 480 144 480 -336
WIRE 480 144 448 144
WIRE 512 144 480 144
WIRE 544 144 544 -80
WIRE 544 144 512 144
WIRE 576 144 544 144
WIRE 768 144 768 -32
WIRE 768 144 736 144
WIRE 800 144 768 144
WIRE 832 144 832 -80
WIRE 832 144 800 144
WIRE 864 144 832 144
WIRE 1056 144 1056 -336
WIRE 1056 144 1024 144
WIRE 1088 144 1056 144
WIRE 1152 144 1088 144
WIRE 1344 144 1344 -336
WIRE 1344 144 1312 144
WIRE 1376 144 1344 144
WIRE 1440 144 1376 144
WIRE 1664 144 1600 144
WIRE 1728 144 1664 144
WIRE 1968 144 1888 144
WIRE -288 192 -320 192
WIRE 0 192 -32 192
WIRE 288 192 256 192
WIRE 576 192 544 192
WIRE 864 192 832 192
WIRE 1152 192 1120 192
WIRE 1440 192 1408 192
WIRE 1728 192 1696 192
WIRE -592 288 -704 288
WIRE -320 288 -320 192
WIRE -320 288 -592 288
WIRE -32 288 -32 192
WIRE -32 288 -320 288
WIRE 256 288 256 192
WIRE 256 288 -32 288
WIRE 544 288 544 192
WIRE 544 288 256 288
WIRE 832 288 832 192
WIRE 832 288 544 288
WIRE 1120 288 1120 192
WIRE 1120 288 832 288
WIRE 1408 288 1408 192
WIRE 1408 288 1120 288
WIRE 1696 288 1696 192
WIRE 1696 288 1408 288
WIRE -704 320 -704 288
WIRE -208 336 -208 240
WIRE -208 336 -544 336
WIRE -16 336 -208 336
WIRE 80 336 80 240
WIRE 80 336 -16 336
WIRE 368 336 368 240
WIRE 368 336 80 336
WIRE 656 336 656 240
WIRE 656 336 368 336
WIRE 944 336 944 240
WIRE 944 336 656 336
WIRE 1232 336 1232 240
WIRE 1232 336 944 336
WIRE 1520 336 1520 240
WIRE 1520 336 1232 336
WIRE 1808 336 1808 240
WIRE 1808 336 1520 336
WIRE -544 368 -544 336
WIRE -704 464 -704 400
WIRE -544 464 -544 448
WIRE -544 464 -704 464
WIRE -544 480 -544 464
FLAG -544 480 0
FLAG -592 288 CLOCK
FLAG -16 336 RESET
FLAG 2112 -224 OUT_A
FLAG -64 144 Q0
FLAG 224 144 Q1
FLAG 512 144 Q2
FLAG 800 144 Q3
FLAG 1088 144 Q4
FLAG 1376 144 Q5
FLAG 1968 144 Q7
FLAG 1664 144 Q6
FLAG 1744 0 0
FLAG 2112 -544 OUT_B
FLAG 656 -208 SUM_A
FLAG 656 -464 SUM_B
FLAG 2176 -64 0
FLAG 2176 -400 0
FLAG 1904 -400 0
FLAG 1904 -80 0
FLAG 1456 -32 0
FLAG 1552 -496 5V
FLAG 1616 -48 0
FLAG 1792 -112 BIAS
FLAG -464 144 Feedback
FLAG 1680 -208 INV_A
FLAG 1680 -464 INV_B
SYMBOL Digital\dflop 80 96 R0
SYMATTR InstName A1
SYMBOL Digital\dflop 368 96 R0
SYMATTR InstName A2
SYMBOL Digital\dflop -208 96 R0
SYMATTR InstName A0
SYMBOL Digital\dflop 656 96 R0
SYMATTR InstName A3
SYMBOL Digital\dflop 944 96 R0
SYMATTR InstName A4
SYMBOL Digital\dflop 1520 96 R0
SYMATTR InstName A6
SYMBOL Digital\dflop 1808 96 R0
SYMATTR InstName A7
SYMBOL Digital\dflop 1232 96 R0
SYMATTR InstName A5
SYMBOL Digital\inv -608 80 R0
SYMATTR InstName A9
SYMBOL voltage -704 304 R0
WINDOW 3 -118 -65 Left 2
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR Value PULSE(0 1 0 10ns 10ns 250ns 500ns)
SYMATTR InstName V1
SYMBOL voltage -544 352 R0
WINDOW 3 37 91 Left 2
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR Value PULSE(0 1 0 10ns 10ns 510ns)
SYMATTR InstName RESET
SYMBOL res -48 -176 R0
SYMATTR InstName R1
SYMATTR Value 12.0k
SYMBOL res 240 -176 R0
SYMATTR InstName R2
SYMATTR Value 4.99k
SYMBOL res 528 -176 R0
SYMATTR InstName R3
SYMATTR Value 4.99k
SYMBOL res 816 -176 R0
SYMATTR InstName R4
SYMATTR Value 12.0k
SYMBOL res 464 -432 R0
SYMATTR InstName R5
SYMATTR Value 12.0k
SYMBOL res 752 -432 R0
SYMATTR InstName R6
SYMATTR Value 4.99k
SYMBOL res 1040 -432 R0
SYMATTR InstName R7
SYMATTR Value 4.99k
SYMBOL res 1328 -432 R0
SYMATTR InstName R8
SYMATTR Value 12.0k
SYMBOL res 1728 -112 R0
SYMATTR InstName R9
SYMATTR Value 2.45k
SYMBOL res 1584 -416 R0
SYMATTR InstName R10
SYMATTR Value 4.99k
SYMBOL cap 2000 -320 R90
WINDOW 0 0 32 VBottom 2
WINDOW 3 32 32 VTop 2
SYMATTR InstName C3
SYMATTR Value 1nF
SYMBOL cap 2000 -640 R90
WINDOW 0 0 32 VBottom 2
WINDOW 3 32 32 VTop 2
SYMATTR InstName C4
SYMATTR Value 1nF
SYMBOL res 1968 -240 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R11
SYMATTR Value 2k
SYMBOL res 1968 -560 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R12
SYMATTR Value 2k
SYMBOL res 2160 -192 R0
SYMATTR InstName R13
SYMATTR Value 100k
SYMBOL res 2160 -528 R0
SYMATTR InstName R14
SYMATTR Value 1meg
SYMBOL voltage 1456 -144 R0
WINDOW 3 34 72 Left 2
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR Value 3.3
SYMATTR InstName V2
SYMBOL cap 1600 -128 R0
SYMATTR InstName C5

SYMBOL Opamps\LT1215 1904 -192 R0
SYMATTR InstName U1
SYMBOL Opamps\LT1215 1904 -512 R0
SYMATTR InstName U2
SYMBOL cap 1552 -480 R90
WINDOW 0 59 55 VBottom 2
WINDOW 3 32 -4 VTop 2
SYMATTR InstName C2

SYMBOL cap 1488 -192 R270
WINDOW 0 34 4 VTop 2
WINDOW 3 64 66 VBottom 2
SYMATTR InstName C1

TEXT -304 616 Left 2 !.tran 30us
TEXT -8 616 Left 2 !.options gmin=1e-10 abstol=1e-10 cshunt=1e-16
TEXT 440 392 Left 3 ;74xx164 - 14 pin  DIP
TEXT 608 616 Left 2 !.IC V( INV_A)=1.1V V( INV_B)=1.1V V( SUM_A)=0.5  
V(SUM_B)=0.5V
RECTANGLE Normal 1920 368 -368 32 1

--  

  Rick C.

  +++ Get 2,000 miles of free Supercharging
We've slightly trimmed the long signature. Click to see the full one.
Re: Dirty sine wave generator
On 9/22/19 4:58 AM, Martin Brown wrote:

Quoted text here. Click to load it

Quoted text here. Click to load it

Quoted text here. Click to load it

Quoted text here. Click to load it

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!

Re: Dirty sine wave generator
On Sunday, 22 September 2019 16:42:06 UTC+1, bitrex  wrote:
Quoted text here. Click to load it

? The
Quoted text here. Click to load it

t
Quoted text here. Click to load it

 to see
Quoted text here. Click to load it

low slew rate can help it become more sine-like, at least if it doesn't ove
rshoot wildly.


NT

Re: Dirty sine wave generator
On 22/09/2019 16:42, bitrex wrote:
Quoted text here. Click to load it

Quoted text here. Click to load it

Quoted text here. Click to load it

Quoted text here. Click to load it

Another option might be to use a comparator to turn the analogue signal  
into digital and then correlate against the references with digital XOR.  
ISTR one 1980s's portable low frequency LBI system used one bit  
digitisation this way. If you do it well you can get about 60% (2/pi) of  
the available correlated signal detected on a good day.

--  
Regards,
Martin Brown

Re: Dirty sine wave generator
On Sunday, 22 September 2019 17:21:30 UTC+1, Martin Brown  wrote:
Quoted text here. Click to load it
Some GPS receivers use a comparator to digitise the incoming signal.

John

Site Timeline