Thursday, September 12, 2013

Saw wave frequency doubler

After listening to Grant Falkenburg's demo of the JP8000 on youtube, I realized that it would be cool to have the option to add a secondary wave to the output of the super saw oscillators, one octave lower than the original frequency.

This got me thinking about how to create a frequency divider, which in turn led me to come up with a way to create a frequency doubler as well.

I have dreamt up both the divider and the doubler, but only the doubler has been breadboarded and tested. My initial design was revised a few times and the current design seems to work fairly well for frequencies up to at least 5kHz, and looks ok but with a little bit distorted output all the way up to at least 10kHz. I don't think frequencies above 10kHz are all that interesting as the doubled frequency (20kHz) is starting to push the limits of human hearing.

In any case, I have yet to actually listen to the result, I have only watched it on my oscilloscope. I also do not currently have a saw wave source (Well, I actually do, but my function generator cannot output saw waves and I cannot be bothered connecting the little phatty to the circuit) so I tested the circuit using a triangle wave instead. The end result should be pretty similar though.

The idea of the circuit is to detect when the original saw wave crosses 0V. This is done using an opamp in a comparator configuration, which will output a constant negative voltage slightly less than the negative supply voltage when the input wave is > 0V and a constant positive voltage slightly less than the positive supply voltage when the output is negative. The output is then scaled down to half the amplitude of the input wave. By summing the two and amplifying by 2, the result is a saw wave with double the frequency and the same amplitude as the input.

This picture shows the input wave (triangle) and the resulting square wave output by the comparator (after scaling to 50% of the input amplitude):



Here is a drawing of the circuit. The potmeter across the second op amp adjusts the attenuation of the comparator output which in turn adjusts the symmetry of the two parts of the output wave. With a 10v p/p input wave and a supply voltage of +/- 15V, the attenuation should be about 1/6 (giving the square wave output from the comparator a swing from -2.5 to 2.5 volts). As opamps cannot really handle a gain of less than 1 when in the normal inverting mode, a 8.2K resistor is connected to gnd (see this page for a detailed explanation):





The breadboarded circuit is really tiny:

One thing to be aware of is that the output of the circuit is inverted with relation to the input wave. This can be corrected by using the last opamp of the TL074 as an inverting amplifier with unity gain to invert the result back.

Here is a photo of the result at around 1-3kHz:
Inside the red square you can see both the input waves and the resulting wave with the doubled frequency. Notice that both parts of the new wave have the same starting voltage and the same amplitude as the original wave (one square on the scope equals 5V).


This photo shows the result at around 10kHz:
As you can see, the starting point of the second part of the output wave is higher than the first part. Also, the fall from the top of the first part to the bottom of the second part is not instant, it is slightly slanted (This is of course also the case for the 1kHz wave but it is not visible as the scale is different).

The reason for both these errors is that the rise time of the square wave output from the comparator is a little bit too slow. I doubt that it will be a big problem at this frequency. At higher frequencies the problem becomes more and more pronounced, but as mentioned earlier I do not expect the circuit to be used above 10kHz anyway.

Next up is the frequency divider, but to build that I need a flip flop.