# Square to triangle wave converter frequency range adjustment

I am working on a synth module that converts a square wave (generated digitally: High - 10v; Low - 0v; Duty cycle = 50%) to triangle wave output. I've found this schematic that works for an already extended range of frequencies - 470Hz to 20kHz: It also successfully works in Ltspice: Output for 5kHz: Output for 500Hz:

However, in the musical sense I would like to go down to lower frequencies such as 50Hz. Current schematic struggles with such low frequencies:

Adjusting capacitors (LTspice schematic C1=100n; C2=100n;C8=470n) seems to be a solution for 50Hz signal:

I think it's possible to change these values during operation. Placing analog switches (e.g. CD4066) is probably something I should try:

The issue with this approach might be a sharp volume change in case switches are connected/disconnected by some voltage signal related to specific input frequency.

1. Would this approach of using switches work?
2. Is there any better solution for continuous adjustment of operation for this circuit?
• Study CD4046 VCO. Like many function generators, the actual oscillator starts with triangle, and generates square from that. The 555 chip takes a somewhat similar approach. Commented Nov 13, 2022 at 15:53
• @glen_geek thank you for the idea - I will take a look at the datasheet. However I was hoping of being able to input external square signal and processing it to form triangle Commented Nov 13, 2022 at 16:27
• See also my answer at this post. I forgot the "Howland" pump ... which can also be used. electronics.stackexchange.com/questions/645611/… Commented Dec 11, 2022 at 8:51

Perhaps another approach with current mirrors.

This circuit transforms the rectangular input into a triangle at the same frequency.
There are some limits and some sort of "feedback" must be used.

The parameter here is nn, can range from 0.1 to 100 with the devices used.
Which mean tested from 2 Hz to 2000 Hz.

NB: one can add two resistors (5 to 10 Meg not necessarily equal, one wired from VT to ground, and the other wired from VT to +12V) for offsetting voltage at Vt.
I tried 5 Meg for the "up" resistor and 10 Meg for the "low". Slight change of DC voltage ("up").

Tried with an integrator ... see the defect at 10 kHz.
NB: the multiplier should be a "multiplying" DAC.

Here is the practical "currents" generator. 1 Ohm should not used.

Modified with Wilson mirrors. More closest values of current.
Be aware for "power dissipation" for the BJT ... (for some BJT, 20 mA with 15 V ... ~ 360 mW ...)

DC Analysis

• It looks like this circuit is putting current into a capacitor to integrate the square wave into a triangle. In that case the output amplitude will be dependent on frequency, which the OP wanted to avoid. Commented Nov 13, 2022 at 20:59
• This is only the basic idea. I added the fact that some "sort of feedback" must be used. The parameter nn is for the simulation. A circuit for this function must be done (measure the input period and this will adapt the current reference for it, thus the amplitude). In the simulation, it is very well working, and quasi with no delay in the range I tested. Commented Nov 13, 2022 at 21:08
• Could you please clarify what's the purpose of R5 and R8 in your schematic? Are they floating or connected to something? I will try testing this idea tomorrow in LTspice Commented Nov 13, 2022 at 22:41
• R5 and R8 are just used for checking the complementary mirror currents in transistor Q3-Q4 and Q5-Q6. Commented Nov 14, 2022 at 6:16
• The "discharge" current is a little too big, so it discharges completely the capacitor. Mirror current with discrete devices are not very "good". A structure as a Wilson could help wiki.analog.com/university/courses/electronics/text/chapter-11 and also an current offset, not checked. Try also a little resistor at the emitter of Q4. Commented Nov 15, 2022 at 9:04

I can't find any results for 554UD1. I assume it's an op-amp.

Do this:

1. Do not use OP-amps as comparators. Doing so is like using a knife to turn a screw instead of a screwdriver. Use instead a comparator with a rail-to-rail output.
2. Do not use a BJT for Q4, because its on voltage is too high and varies. Use instead a MOSFET.
3. Do not convert a square wave to triangle with an integrator, because its output level is inversely proportional to frequency; amplifying that output at high frequencies adds noise. Instead, do it the other way around: convert a triangle wave to a square wave. Use a standard triangle wave generator circuit (it uses an op-amp and an integrator plus a comparator as a Schmitt trigger to convert it to a square wave, which is then fed back to the input of the integrator). Then, add a PLL (Phase Lock Loop) to lock this square wave to the incoming square wave. (Granted, locking over such a wide range of frequencies will be tricky.) Note: when the input frequency jumps, in your present solution the volume wavers, while in my proposed solution the frequency glides.
4. For a variable resistor to set the frequency ("R" in the circuit I linked), use an Optical FET: H11F1
5. In your schematic, show where the output is.