View Single Post
  #18   Report Post  
Old March 24th 10, 11:07 PM posted to sci.electronics.design,rec.radio.amateur.homebrew
John Larkin John Larkin is offline
external usenet poster
 
First recorded activity by RadioBanter: Oct 2006
Posts: 21
Default Square wave to psuedo-sine wave?

On Wed, 24 Mar 2010 11:22:28 -0700 (PDT), "dave.harper"
wrote:

On Mar 23, 3:00*pm, John Larkin
wrote:
On Tue, 23 Mar 2010 12:39:59 -0700 (PDT), "dave.harper"

wrote:
I'm trying to come up with a filter or converter that takes a square
wave input and outputs something closer to a sign wave (varying
between ~1.9kHz and 2.1kHz). *It can have some distortion, but I'm
trying to eliminate the sharp leading and trailing edge. *One option
I'm pursuing is a bandpass filter (2 caps and 2 resistors), which
looks to give a reasonable output, but still not quite as smooth as
I'd like.


A lowpass filter is appropriate. You're trying to kill the higher
(odd) harmonics but there's no signal below the fundamental, excepting
DC maybe.

A dual-stage RC lowpass would be pretty good, if you set the -3 dB
point around 2 KHz. A higher-order filter, active or LC, would be even
better. An LC filter isn't unreasonable at 2 KHz.

John


I modeled a few low pass filters, and think this is the best
solution. I have 3 RC low-pass filters and the output looks
relatively sine-like. Thanks to everyone that provided good
suggestions! Here's the schematic in LTSpice (comments appreciated):

Version 4
SHEET 1 1476 680
WIRE 592 -608 0 -608
WIRE -80 -528 -160 -528
WIRE -80 -496 -80 -528
WIRE -160 -464 -160 -528
WIRE 464 -368 32 -368
WIRE 144 -304 80 -304
WIRE 80 -256 80 -304
WIRE 144 -240 144 -304
WIRE 160 -240 144 -240
WIRE 416 -240 416 -256
WIRE 416 -240 384 -240
WIRE -160 -176 -160 -400
WIRE 0 -176 0 -608
WIRE 0 -176 -160 -176
WIRE 160 -176 0 -176
WIRE 464 -176 464 -368
WIRE 464 -176 384 -176
WIRE -592 -144 -592 -192
WIRE -544 -144 -592 -144
WIRE -432 -144 -464 -144
WIRE -352 -144 -352 -192
WIRE -352 -144 -432 -144
WIRE -352 -112 -352 -144
WIRE 160 -112 96 -112
WIRE 592 -112 592 -608
WIRE 592 -112 384 -112
WIRE -592 -96 -592 -144
WIRE -432 -96 -432 -144
WIRE 32 -96 32 -368
WIRE 32 -96 -160 -96
WIRE 160 -48 144 -48
WIRE 448 -48 384 -48
WIRE -592 16 -592 -16
WIRE -432 16 -432 -16
WIRE -352 16 -352 -48
WIRE 448 16 448 -48
WIRE -160 32 -160 -16
WIRE 144 32 144 -48
WIRE 144 32 -160 32
WIRE 144 80 144 32
WIRE 208 80 144 80
WIRE 448 128 448 80
WIRE 96 160 96 -112
WIRE 96 240 -64 240
WIRE -64 256 -64 240
WIRE 96 288 96 240
WIRE -64 336 -224 336
WIRE -224 352 -224 336
WIRE -64 384 -64 336
WIRE -224 432 -384 432
WIRE -224 480 -224 432
FLAG -592 16 0
FLAG 80 -256 0
FLAG -592 -192 +5V
FLAG 416 -256 +5V
FLAG -352 16 0
FLAG -432 16 0
FLAG -352 -192 +2.5V
FLAG 448 128 0
FLAG -80 -496 0
FLAG 208 80 +5V
FLAG -64 448 0
FLAG 96 352 0
FLAG -224 544 0
SYMBOL voltage -592 -112 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
WINDOW 0 -66 54 Left 0
WINDOW 3 47 51 Left 0
SYMATTR InstName V1
SYMATTR Value 5
SYMBOL res -560 -128 R270
WINDOW 0 32 56 VTop 0
WINDOW 3 0 56 VBottom 0
SYMATTR InstName R6
SYMATTR Value 1k
SYMBOL res -448 -112 R0
SYMATTR InstName R7
SYMATTR Value 1k
SYMBOL polcap -368 -112 R0
SYMATTR InstName C3
SYMATTR Value 10µ
SYMBOL Misc\\NE555 272 -144 R0
SYMATTR InstName U1
SYMBOL cap 432 16 R0
SYMATTR InstName C1
SYMATTR Value 10nF
SYMBOL res -176 -192 R0
SYMATTR InstName R2
SYMATTR Value 33500
SYMBOL res -176 -112 R0
SYMATTR InstName R1
SYMATTR Value 1000
SYMBOL cap -176 -464 R0
SYMATTR InstName C2
SYMATTR Value .01µF
SYMBOL cap -80 384 R0
SYMATTR InstName C4
SYMATTR Value .08µF
SYMBOL res -80 240 R0
SYMATTR InstName R3
SYMATTR Value 1000
SYMBOL cap 80 288 R0
SYMATTR InstName C10
SYMATTR Value .08µF
SYMBOL res 80 144 R0
SYMATTR InstName R8
SYMATTR Value 1000
SYMBOL cap -240 480 R0
SYMATTR InstName C11
SYMATTR Value .08µF
SYMBOL res -240 336 R0
SYMATTR InstName R12
SYMATTR Value 1000
TEXT -648 -472 Left 0 !.tran 0 5ms 0 1u
TEXT -648 -432 Left 0 !.ic V(in1)=2.7
TEXT -648 -512 Left 0 ;555 Radio Modem



Your RC values could be optimized. Try using successively bigger
resistors and correspondingly smaller caps in successive stages. As
is, each filter stage heavily loads the previous one.

These RCs each have an unloaded 3 dB point of about 2 KHz, so three in
a row will lose about 9 dB. Making the taus a little shorter will
increase output at the expense of distortion.

I'd expect a 3-pole LC filter to be a lot better.

John