sine wave generator

It's pretty easy to make a sorta decent sine wave generator. I can switch R1 with an HC analog mux to make FSK. Three resistors and two dual diodes bend the triangle into a sine.

R6 makes the sine look a little nicer, but doesn't affect the FFT much, so I could leave it out. The 3rd harmonic is about -26 dBc either way. The values are very un-scientifically fiddled.

Version 4 SHEET 1 1180 680 WIRE 528 32 224 32 WIRE 672 32 528 32 WIRE 720 32 672 32 WIRE 816 32 720 32 WIRE 976 32 896 32 WIRE 1024 32 976 32 WIRE 1056 32 1024 32 WIRE 224 48 224 32 WIRE 528 64 528 32 WIRE 976 80 976 32 WIRE 352 112 320 112 WIRE 368 112 352 112 WIRE 640 112 608 112 WIRE 656 112 640 112 WIRE 320 144 320 112 WIRE 288 160 144 160 WIRE 608 160 608 112 WIRE 400 176 352 176 WIRE 432 176 400 176 WIRE 528 176 528 128 WIRE 528 176 512 176 WIRE 576 176 528 176 WIRE 144 192 144 160 WIRE 224 192 224 128 WIRE 288 192 224 192 WIRE 720 192 720 32 WIRE 720 192 640 192 WIRE 976 192 976 160 WIRE 976 192 912 192 WIRE 1056 192 976 192 WIRE 576 208 528 208 WIRE 320 240 320 208 WIRE 352 240 320 240 WIRE 368 240 352 240 WIRE 608 240 608 224 WIRE 656 240 608 240 WIRE 672 240 656 240 WIRE 912 240 912 192 WIRE 1056 240 1056 192 WIRE 528 256 528 208 WIRE -320 288 -352 288 WIRE -288 288 -320 288 WIRE -112 288 -160 288 WIRE -80 288 -112 288 WIRE 64 304 16 304 WIRE 112 304 64 304 WIRE 224 304 224 192 WIRE 224 304 192 304 WIRE 272 304 224 304 WIRE 400 304 400 176 WIRE 400 304 352 304 WIRE -352 336 -352 288 WIRE -160 336 -160 288 WIRE 16 336 16 304 WIRE 912 352 912 304 WIRE 912 352 752 352 WIRE 1056 352 1056 304 WIRE 1056 352 912 352 WIRE 752 384 752 352 WIRE 912 400 912 352 WIRE 1056 400 1056 352 WIRE -352 448 -352 416 WIRE -160 448 -160 416 WIRE 16 448 16 416 WIRE 752 512 752 464 WIRE 912 512 912 464 WIRE 1056 512 1056 464 FLAG -352 448 0 FLAG -160 448 0 FLAG -320 288 +5 FLAG -112 288 -5 FLAG 528 256 0 FLAG 352 112 +5 FLAG 640 112 +5 FLAG 352 240 -5 FLAG 656 240 -5 FLAG 16 448 0 FLAG 672 32 OUT FLAG 144 192 0 FLAG 64 304 KICK FLAG 400 176 MID FLAG 1024 32 SINE FLAG 912 512 0 FLAG 1056 512 0 FLAG 752 512 0 SYMBOL voltage -352 320 R0 WINDOW 0 61 39 Left 2 WINDOW 3 64 76 Left 2 SYMATTR InstName V1 SYMATTR Value 5 SYMBOL Opamps\\UniversalOpamp 320 176 R0 SYMATTR InstName U1 SYMBOL Opamps\\UniversalOpamp 608 192 R0 SYMATTR InstName U2 SYMBOL voltage -160 320 R0 WINDOW 0 55 40 Left 2 WINDOW 3 57 76 Left 2 SYMATTR InstName V2 SYMATTR Value -5 SYMBOL res 528 160 R90 WINDOW 0 66 57 VBottom 2 WINDOW 3 68 56 VTop 2 SYMATTR InstName R1 SYMATTR Value 1K SYMBOL res 368 288 R90 WINDOW 0 68 58 VBottom 2 WINDOW 3 73 56 VTop 2 SYMATTR InstName R2 SYMATTR Value 2K SYMBOL res 208 288 R90 WINDOW 0 70 58 VBottom 2 WINDOW 3 75 56 VTop 2 SYMATTR InstName R3 SYMATTR Value 100K SYMBOL cap 512 64 R0 WINDOW 0 -44 2 Left 2 WINDOW 3 -50 33 Left 2 SYMATTR InstName C1 SYMATTR Value 10n SYMBOL voltage 16 320 R0 WINDOW 3 38 113 Left 2 SYMATTR InstName V3 SYMATTR Value PULSE(1 0 100u) SYMBOL res 208 32 R0 WINDOW 0 -53 36 Left 2 WINDOW 3 -52 66 Left 2 SYMATTR InstName R4 SYMATTR Value 1K SYMBOL res 912 16 R90 WINDOW 0 70 58 VBottom 2 WINDOW 3 70 59 VTop 2 SYMATTR InstName R5 SYMATTR Value 1K SYMBOL res 992 176 R180 WINDOW 0 -58 71 Left 2 WINDOW 3 -55 44 Left 2 SYMATTR InstName R6 SYMATTR Value 50 SYMBOL diode 896 240 R0 WINDOW 0 -75 9 Left 2 WINDOW 3 -101 47 Left 2 SYMATTR InstName D1 SYMATTR Value 1N4148 SYMBOL diode 1072 304 R180 WINDOW 0 -74 47 Left 2 WINDOW 3 -103 9 Left 2 SYMATTR InstName D2 SYMATTR Value 1N4148 SYMBOL diode 896 400 R0 WINDOW 0 -63 21 Left 2 WINDOW 3 -91 53 Left 2 SYMATTR InstName D3 SYMATTR Value 1N4148 SYMBOL diode 1072 464 R180 WINDOW 0 -71 48 Left 2 WINDOW 3 -103 9 Left 2 SYMATTR InstName D4 SYMATTR Value 1N4148 SYMBOL res 768 480 R180 WINDOW 0 52 64 Left 2 WINDOW 3 54 32 Left 2 SYMATTR InstName R7 SYMATTR Value 1K TEXT -208 176 Left 2 !.tran 400u TEXT -296 64 Left 2 ;FSK Modem Sine Generator TEXT -264 112 Left 2 ;J Larkin Dec 19 2012

--
John Larkin         Highland Technology, Inc 

jlarkin at highlandtechnology dot com 
 Click to see the full signature
Reply to
John Larkin
Loading thread data ...

How good a sine wave generator did you want? What sort of frequency range did you want to cover? What sort of output amplitude and power did you need? Are efficiency and cost interesting issues?

If you could tell us what you were trying to do, we might be able to help ...

--
Bill Sloman, Sydney
Reply to
Bill Sloman

And why use an 8-pin dual op-amp, a bunch of resistors, a bunch of _diodes_, etc., when an 8-pin PIC, two resistors and two caps will do the job?

--
My liberal friends think I'm a conservative kook. 
My conservative friends think I'm a liberal kook. 
 Click to see the full signature
Reply to
Tim Wescott

e
d

and you could skip the mux for FSK, just use a pin to toogle between frequencies

-Lasse

Reply to
langwadt

Because I'd have to write amd test a bunch of code, and program the chips. And because we don't use PICs.

--
John Larkin                  Highland Technology Inc 
www.highlandtechnology.com   jlarkin at highlandtechnology dot com    
 Click to see the full signature
Reply to
John Larkin

The FSK (Bell 202 compatible) has to be phase coherent. That's not real hard to do in software, if you're careful, but no programming is a lot easier than some programming. Phase-coherent FSK is easier if you use DACs instead of PWM... depends on the gory details of the PWM generator.

--
John Larkin                  Highland Technology Inc 
www.highlandtechnology.com   jlarkin at highlandtechnology dot com    
 Click to see the full signature
Reply to
John Larkin

So what do you use instead of PICs? AVR's used to be recommended here ...

I'd probably put it all inside a medium-sized programmable logic device, if the PIC/AVR wasn't cheaper.

--
Bill Sloman, Sydney
Reply to
Bill Sloman

rote:

he

id

e

. And

.highlandtechnology.com  jlarkin at highlandtechnology dot com

I don't know if the thrid harmonic at -27dB is a problem or not. I made a bunch of these one opamp Wien-bridge oscillators in the last project, with just diode AGC. Gain control portion shown...

+-||---+ +---R1---+---R2--+--R3--+ | | |\ | GND +-|-\ | | >---------+ |+/

R1=1k ohm R2=1.5kohm R3 = 549 ohm Gives ~5Vp-p output amplitude with 3rd harmonic a bit less than 40dB down, (Which was good enough for me.) You can reduce R3 for less distortion.. or play with the R2/R3 ratio, but then you have worry about tolerance issues. Anyway probably not useful as you'd have to switch two R's to change the frequency... and one of them is floating.

George H.

Reply to
George Herold

And

Incwww.highlandtechnology.com  jlarkin at highlandtechnology dot com

I can get -32 dBc at the 3rd harmonic, by tweaking values a little. I could probably do better if I applied some math and science, instead of just fiddling.

For a 1200 baud FSK modem working over local twisted pairs, I could get away with transmitting the triangle, or probably just the square wave. This modem is a tedious and literally profitless project, and the sine shaping looks like the only interesting part of the design.

The triangle+shaper thing shifts frequency instantly, phase coherent, no amplitude change. I suspect that a Wein bridge won't do that as well.

--
John Larkin                  Highland Technology Inc 
www.highlandtechnology.com   jlarkin at highlandtechnology dot com    
 Click to see the full signature
Reply to
John Larkin

Can you say what this is for? Curiosity just peaked

Reply to
Bob E.

e:

wo

w the

r did

o

the

ips. And

t highlandtechnology dot com

ld

ddling.

way

dem is

ke the

Sure.. though there is no integrator in the diode limited Wein bridge so it may stabilize quickly. (It's got no memory of what happened the last cycle.) I mostly thought I'd post it since I hadn't seen a circuit that used the diodes to just clip off the top of the the sine wave beofre. Maybe someone else can use it.

George H.

.highlandtechnology.com  jlarkin at highlandtechnology dot com

Reply to
George Herold

the

did

And

highlandtechnology dot com

fiddling.

is

the

[snip excess poorly configured sig]

Clipping the top of a triangle wave is a known-good method of cutting harmonics. ...Jim Thompson

--
| James E.Thompson, CTO                            |    mens     | 
| Analog Innovations, Inc.                         |     et      | 
 Click to see the full signature
Reply to
Jim Thompson

the

did

the

chips. And

highlandtechnology dot com

fiddling.

is

the

Clip the triangle at 2/3 and the third is down ~67dB

I've been known to run an oscillator at multiples of the desired frequency and subtract out square wave bits and pieces.

The ring-around-the-rosy shift-register driving summing resistors works well... just some clock filtering and you have a near-perfect sine wave. ...Jim Thompson

--
| James E.Thompson, CTO                            |    mens     | 
| Analog Innovations, Inc.                         |     et      | 
 Click to see the full signature
Reply to
Jim Thompson

It's the apartment submetering/security/intercom system at Battery Park City, about 1720 apartments as I recall. I did that about 30 years ago, and it's still working. I did software uart+fsk in the remotes, cleverly using 1200 and 2400 Hz instead of the Bell standard

1200/2200. The old Novation 202-type analog modems didn't mind, but modern DSP modems don't like it. The Novations have mostly died and I need to make some replacements.
--
John Larkin         Highland Technology, Inc 

jlarkin at highlandtechnology dot com 
 Click to see the full signature
Reply to
John Larkin

can

nd two

below the

ency

power did

le to

f

l do the

e chips. And

inat highlandtechnology dot com

t
,

ot

d

could

t fiddling.

et away

s modem is

s like the

no

e
   ...Jim Thompson

It produces a staircase approximation to a sine-wave. The error signal is a funny-looking sawtooth that flips sign between the rising edges and the falling edges, but hasn't got much low frequency content. You rapidly start needing precision resistors and low resistance switches to keep the lower frequency components below the high frequency stuff that leaks through a rudimentary low pass filter.

--
Bill Sloman, Sydney
Reply to
Bill Sloman

And

Incwww.highlandtechnology.com jlarkin at highlandtechnology dot com

fiddling.

is

the

What about the Wien variation posted below? The distortion looks pretty good with random small signal mosfets, how might it do with a matched pair like:

formatting link

Version 4 SHEET 1 1192 956 WIRE 96 -416 64 -416 WIRE 192 -416 176 -416 WIRE 192 -368 192 -416 WIRE 288 -320 272 -320 WIRE -176 -224 -176 -240 WIRE -64 -224 -64 -240 WIRE 64 -176 64 -416 WIRE 80 -176 64 -176 WIRE 192 -176 160 -176 WIRE 192 -144 192 -176 WIRE 176 -96 176 -320 WIRE 288 -96 288 -320 WIRE 288 -96 272 -96 WIRE 64 32 64 -176 WIRE 80 32 64 32 WIRE 176 32 176 -96 WIRE 176 32 160 32 WIRE 192 32 176 32 WIRE 288 32 288 -96 WIRE 288 32 272 32 WIRE 144 128 144 112 WIRE -80 144 -112 144 WIRE 64 144 64 32 WIRE 64 144 0 144 WIRE 112 144 64 144 WIRE 288 160 288 32 WIRE 288 160 176 160 WIRE 416 160 288 160 WIRE 112 176 0 176 WIRE -112 192 -112 144 WIRE 144 208 144 192 WIRE 416 208 416 160 WIRE 0 304 0 176 WIRE 0 304 -64 304 WIRE 96 304 0 304 WIRE 192 304 160 304 WIRE 288 304 288 160 WIRE 288 304 272 304 WIRE 416 320 416 288 WIRE -64 384 -64 368 WIRE -32 384 -64 384 WIRE 0 384 -32 384 WIRE -32 416 -32 384 FLAG -176 -144 0 FLAG -176 -240 Vcc FLAG -64 -144 0 FLAG -64 -240 Vee FLAG 144 112 Vcc FLAG 144 208 Vee FLAG -112 192 0 FLAG -32 416 0 FLAG 416 320 0 SYMBOL Opamps\\LT1014 144 96 R0 WINDOW 3 20 -1 Left 2 SYMATTR InstName U1 SYMBOL voltage -176 -240 R0 WINDOW 123 0 0 Left 2 WINDOW 39 0 0 Left 2 SYMATTR InstName V1 SYMATTR Value 12 SYMBOL voltage -64 -240 R0 WINDOW 123 0 0 Left 2 WINDOW 39 0 0 Left 2 SYMATTR InstName V2 SYMATTR Value -12 SYMBOL res 16 128 R90 WINDOW 0 0 56 VBottom 2 WINDOW 3 32 56 VTop 2 SYMATTR InstName R1 SYMATTR Value 10k SYMBOL res 176 16 R90 WINDOW 0 0 56 VBottom 2 WINDOW 3 32 56 VTop 2 SYMATTR InstName R2 SYMATTR Value 20k SYMBOL res 288 16 R90 WINDOW 0 0 56 VBottom 2 WINDOW 3 32 56 VTop 2 SYMATTR InstName R3 SYMATTR Value 220 SYMBOL res 288 288 R90 WINDOW 0 0 56 VBottom 2 WINDOW 3 32 56 VTop 2 SYMATTR InstName R4 SYMATTR Value 10k SYMBOL cap 160 288 R90 WINDOW 0 0 32 VBottom 2 WINDOW 3 32 32 VTop 2 SYMATTR InstName C1 SYMATTR Value 16n SYMBOL cap -80 304 R0 SYMATTR InstName C2 SYMATTR Value 16n SYMBOL res -16 288 R0 SYMATTR InstName R5 SYMATTR Value 10k SYMBOL res 400 192 R0 SYMATTR InstName R10 SYMATTR Value 100k SYMBOL nmos 272 -368 R90 SYMATTR InstName M1 SYMATTR Value 2N7002 SYMBOL pmos 272 -144 R90 SYMATTR InstName M2 SYMATTR Value BSS84 SYMBOL res 192 -432 R90 WINDOW 0 0 56 VBottom 2 WINDOW 3 32 56 VTop 2 SYMATTR InstName R6 SYMATTR Value 10k SYMBOL res 176 -192 R90 WINDOW 0 0 56 VBottom 2 WINDOW 3 32 56 VTop 2 SYMATTR InstName R7 SYMATTR Value 10k TEXT -200 -80 Left 2 !.tran 0 5 0 1u uic

Reply to
bitrex

Can you possibly just use the new AD Hart modem Chip? AD5700 Sometimes reading more then the "Ideas for Design/Design Ideas" pages in Exx does pay off. Not often, but once in a while.

Steve

Reply to
Owen Roberts

And

Incwww.highlandtechnology.com jlarkin at highlandtechnology dot com

fiddling.

is

the

That circuit is very delicate. Reducing the loop gain by just 2% kills the oscillation. If you increase the gain maybe 5%, it's more energetic but the clipping gets gross.

--
John Larkin                  Highland Technology Inc 
www.highlandtechnology.com   jlarkin at highlandtechnology dot com    
 Click to see the full signature
Reply to
John Larkin

The digital modem chips don't work in my application, because the FSK frequencies aren't exact.

--
John Larkin                  Highland Technology Inc 
www.highlandtechnology.com   jlarkin at highlandtechnology dot com    
 Click to see the full signature
Reply to
John Larkin

te:

n

two

ow the

y

er did

to

do the

chips. And

ncwww.highlandtechnology.com jlarkin at highlandtechnology dot com

t

could

fiddling.

t away

modem is

like the

no

ty

..

e

he

.highlandtechnology.com  jlarkin at highlandtechnology dot com

Did you try my didoe AGC thing? Once the oscillations build up, it switches right away.

(at least according to LTspice)

George h.

Reply to
George Herold

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.