sine from square

Started by Squeal, November 23, 2005, 10:24:50 PM

Previous topic - Next topic

Squeal

I am designing an oscillator for the carrier input of a passive ring mod.ring mod I am using a 555 timer for the oscillator and I was wondering if there is a simple way to convert its naturally square wave into a sine wave. Some sort of low pass filter? Any suggestions?

R.G.

It is much, much simpler to start with a sine wave and then convert *that* into a square wave. A Wien bridge or a phase shift oscillator that feeds a comparator will do it nicely.

But to answer your question, yes, you can. Run your 555 oscillator 32 or 64 times faster than you want the resulting output, and feed the high speed clock into a ring counter which generates a sine wave from the high speed clock. There is an article on this at GEO.  Then pick one of the divided-down square wave counter outputs for your square wave.

Another valid answer to your question is no, it's practical to do what you ask in the way you seem to want, filtering down a square wave or waveshaping it to a sine. The filtering and tracking are quite difficult if you approach it from this way.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

Rob Strand

#2
It depends on how perfect you want the sine-wave.

Rather than start with a square-wave you can use the exponential output from the 555 - the signal on the timing cap.  That's closer to sine than the square-wave.  If you vary the frequency with the 555 timing resistor the shape and magnitude of that waveform is consistent over frequency.   You will need to buffer the signal.  The next step is to feed the exponential waveform into a filter.  For a rough sine-wave you can use a fixed filter, the signal will get more exponential as you drop the frequency.   You use the exponential output here.  An improvement is to use a dual pot in for the frequency pot then use the second resistance to form a variable cut-off low-pass filter which essentially provides a tracking filter for the exponential waveform.  This is more sinusoidal than the fixed filter case - you can add a further fixed filter as well.  Is it good enough?  only you can judge that.   It certainly won't be as clean as a proper sinusoidal generator.

Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

GFR

Well you can take the "exponential" out like Rob says but use current sink/sources instead of resistors to charge the cap - the waveform will be a triangle instead of exponential. Or just get rid of the 555 and use a dual opamp oscillator for that (triangle and square wave outputs). Then feed the triangle to a diode clipper to shape the triangle to a sine, you can get very reasonable sines like that. Or use a CMOS function generator chip, I think it's the 8038.

stm

#4
For a simple but tunable SINE oscillator I think the best I've seen so far is the circuit available at:

http://sound.westhost.com/project86.htm

This is a simplified diagram:



You just need a quad op-amp. It can be run from 9V battery power. You can use a dual-ganged pot to set frequency. Author states THD is 0.16% at 1kHz !!!

The article is very interesting to read. I think this is a great DIY test probe oscillator, as well as a building block for anything fancy.

Paul Perry (Frostwave)

It isn't very easy, if you want a very wide frequency range, without switching caps. And, for a ring modulator, you might very well want from say 1 Hz (or perhaps lower!) to 20KHz. THere isn't any 'easy' way to do that (so far as I know) but, the simplest is an exponential current source driving a triangle generator (I recommend the one from the LM13700 data sheet using both halves of a LM13700). And then overdrive another LM13700 section to get the sine.
I seem to remember a reasonably simple wide range 555 sawtooth generator with an exponential current source feeding the cap, if anyone knows where it is, I would be grateful! A saw can be converted to a triangle by a single transistor. (it's a trick.. the transistor is biased off for half the cycle).

Mark Hammer

Is the sine shaper based around the FET in this article useful in this instance? http://ampage.org/hammer/files/hypertriangleclock.gif

Note that the original uses two diodes (a gate-drain as well as gate source) to produce a sineusoidal wave from the (presumed) triangle input. 

I don't know enough theory to understand this FET circuit.  But what I'm wondering is whether it permits easy tunability of waveshape by means other than amplitude of input signal.

R.G.

The FET shaper does work triangle waves to make sines. The amplitude of the triangle and its symmetry is critical to getting a good sine shape. This method is actually a variant of starting with a sine (triangle is almost sine) and then shaping that into a square. Here you start with at triangle and shape that to both sine and square.

The phase shift  and wien bridge oscillators, along with twin t and bridged T can do much the same thing - they amount to very high Q filters that are tunable, and the output of the filter is essentially a sine. Using that signal to drive a clipping stage and that clipped signal to feed the filter amounts to a tracking filter on the square. Tracking is guaranteed since the sine generates the square that the filter is tracking.

Not generating the square from the sine makes it quite difficult to make the tracking filter track.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

Squeal

Thanks for all the input. RG - nice article. The 8 step sequencer is now on my to do list. That would be cool to put in the carrier input. For now I'll probably try the signal off the cap like Rob suggested and see how that feels. It seems that a better aproach would have been to build a sine oscillatorand get a square wave from a comparator. Maybe next time.

Dolly Parton

This does sine and square:



Actually, it can be simplified somewhat.  Reference the pot to ground, get rid of the lower 10K resistor and make the resistance chain from the square output a lot bigger (plus variable for variable amplitude).
gez Dolly

Dolly Parton

Whoops, forgot this wasn't for an LFO.  Probably won't have the range you require...
gez Dolly

Paul Perry (Frostwave)

Quote from: Mark Hammer on November 24, 2005, 09:00:43 AM
Is the sine shaper based around the FET in this article useful in this instance? http://ampage.org/hammer/files/hypertriangleclock.gif
I think the fet is merely acting as a buffer. (you need it though, because changing the load on the output would change the performance of the diode shaper).

Squeal

OK so I'm clueless. Rob- how would I buffer that signal off the cap of the 555?

Rob Strand

The simplest way is to use an JFET-input opamp wired as a buffer (you connect the non-inverting input of the opampr to the cap, output pin is the output).   The opamp will probably *just* have enough input and output range capability, it's going to be close (and I probably should look-up the data sheets before putting you on this path!).  You can get rail to rail opamps but they are more expensive and that defeats the purpose of the simple ckt.

The other alternative is a simple transistor buffer.  You just connect the collector to +V and the base to the cap.  The emitter is the output.  A resistor is connected between the emitter and ground.  It's going to be a relatively high value say the maximum resistance value divided by 10 (perhaps divided by 20 if you want to push it).   The buffering isn't that great but it should be good enough.


Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Squeal

Good enough is good enough. I'll try the transistor.

Squeal

Another quick question: I need to boost the crap out of the input on the ring mod to get any sound through. I've been running my tube screamer at full volume before the ring mod to get that boost. It sounds okay but it is still below bypass level. I've been looking at various boosters including the LPB. Will the LPB be able to give more boost than the tube screamer? If not, is there another simple booster that will?

R.G.

That  ring modulator circuit has to have 1.4V of signal across the diode ring to get any signal through. I believe it's intended for synthesizer sized signals, which are 5V or 10V peak.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

Squeal

Yeah it came off a synth site. But it does work if you can boost it that high. So ya.

R.G.

Oh, I believe it works. I built one in one of my circuits labs back in the early 70's. It's the classic transformer ring mod.

If you use high-ratio transformers you can get away from the high signal requriements. If the transformers are, say, 10:1 with the 10's being on the inside, you get a 10:1 advantage on signal size. It might be good for those purposes to use three transformers: two for the ring mod as shown and one more to give a step up for the carrier.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

Squeal

OK so the higher I can get my signal above that 1.4 volts the better off I'll be, it seems. I'm not sure what ratio my transformers are. I got them at RS and I think they are 1K audio or something.