+5V One-Quadrant Squarer

Update 11/24/2024:

The LM3900  circuits based on a +15V single supply power for analog waveform generation and signal processing do work well, but there have also been some nice gains in ±15V linear circuit development, such as a newer low-cost trimless VCA design. So, the Model III EMS development will feature both +15V and ±15V designs, taking the best of each form of circuit design.

Update 3/17/2023:

The +5V circuits do work well, but I have since decided that +15V single supply power for analog waveform generation and signal processing has several advantages. Among them are 20 years of research and development in LM3900 circuit designs.


As part of the +5V circuit design build out for my Model III Electronic Music Synthesizer, I wanted to explore a variety of non-linear signal processing elements for waveform shaping and generation using Translinear circuit (TL) topologies. The test circuit below is a one-quadrant squarer, an adaption of Figure 2.12 in Chapter 2, "Current-mode Circuits from a Translinear Viewpoint," by Barrie Gilbert. This is from Analogue IC design: the current-mode approach. The book in general, but this chapter in particular, offer fantastic insights into linear and non-linear signal processing with BJTs. Some other chapters deal with IC CMOS transistor designs, but these are less tractable for SDIY work. The chapter deals with many useful circuit designs, including details about Barrie Gilbert's famous TL sine generator, which Open Music Labs also explores in depth as the Sinulator.


Because 1∙Vbe ≪ 5.0V, I had concluded that many of these TL designs would be amenable to +5V implementation. In fact, a +5V voltage rail can support several Vbe drops, and rail-to-rail op amps even out the possible circuit design topologies. The +5V square generator below itself was adaption of a version I had created previously in October of 2020 using the LM3900 operated on +15V unipolar power supplies. The LM3900 is a quad current-mode or transimpedance op amp for which currents can be directly entered into the inputs. I cover usage of the LM3900 device over at my Beyond Application Note 72 blog.

Based on this previous success, I was relatively confident that a version with conventional voltage op amps would work. For the +5V circuit design, I chose a Microchip Technology MCP6022-I/P dual op amp in PDIP8 packaging. This CMOS op amp is virtually perfect; it has 10MHz bandwidth, operates on low power, it has neglible Ib and drift over temperature, it provides rail-to-rail outputs, and Vos ≤ 500μV.

Carrying over various learning from my unipolar LM3900 circuit designs, I actually did learn more about using voltage op amps on unipolar power. The quiescient op amp voltage output can be set to any desired voltage using a simple resistor divider. By chosing a system implementation where the +5V power is acutally a fairly precise reference voltage (≤0.4% with a MCP1700 LDO regulator), op amp output voltages can be easily set with 1% precision resistors. Except for extremely precise requirements, the precision resistor voltage divider eliminates the use of a LM4040 precision shunt voltage reference and/or an op amp buffer. I used this arrangement for my +5V Trimless VCA to set precisely normative I/O voltage levels.

For waveform shaping applications in a synthesizer, I felt it was not necessary to have extremely accurate non-linear operation, and so an ultra-matched NPN transistor array was not required. As a result, I selected the fairly ubiquitous LM3046 array, and obtained very good results. The important thing is, all of the transistors are in a single package to mitigate thermal effects, they are fairly well-matched already, and have moderate Rbe for a useful current ranges. Not the very best, but certainly good enough. As will be seen, the circuit operation is logarithmic + antilogarithmic, and so there is nominally very little temperature coefficient effect.

Schematic and I/O Relationship.

An essential Theory of Operation follows.

Op amp U1A and the 2N5087 PNP transistor form a Voltage-Controlled Current Source (VCCS) that level shifts 1.5V to 4.0V Vi into a 0-1mA output current. It was convenient for higher voltage output compliance (relative to +5V...)  to accept a full-scale input of Δ2.5V, but use a level-shift at the input, and a voltage attenuation of ÷2.5X to enable creating an output ΔV of 1.0V across the 1.00kΩ 1% resistor connected to the +5V rail. This ΔV provides a 0-1mA current, and due to circuit design the full I/O relationship is non-inverting: increasing Vi causes more ΔV at the 2N5087 emitter, which causes more current to be generated, limited to -1V/1.00kΩ, or -1mA. As the 2N5087 is a very high β device, the vast majority of emitter current is conveyed to the collector at moderately high impedance. The input range 1.5V ≤ Vi ≤ 4.0V could be normalized to anything more convenient in the system with an additional op amp, one that might well ordinarily be in an upstream circuit. For the purpose of test, a signal generator provided the necessary offset voltage, mimicking the action of such a level shift. 

This current is the unipolar input to a TL circuit topology composed with Q2-Q5; Q1 is not used, and has no effect on the output. The diode-connected transistors Q4 and Q5 convert the input current into a logarithmic voltage. Each transistor responds to the current with a ΔVbe, and because they are in series, the voltages add. Because the transistors are nominally matched, the series voltage addition is equivalent of multiplication of the current magnitude X by itself, or X². This TL topology is actually a one-quadrant squarer and divider, where the current U through the Q3 emitter sets the denominator for a relation X²÷U. To avoid a more complex circuit design, this current was approximated as Vbe(Q3)/604Ω. This does affect the functional accuracy, but only modestly so. In the original TL circuit, the U current is also an input, and that enables analog division. With a fixed X, a variable U in fact could be used to produce a one-quadrant reciprocal. In principle, a current mirror could be used in place of the 604Ω resistor to provide a U current input capability. That add-on to the topology though is just outside the comfortable use of one single transistor array such as the LM3046. This add-on though would enable a rather convenient reciprocal relation VCA, which could then be used in a sophisticated audio AGC or level-detection circuit that provides a normalized square-law output. For example, with a LPF providing implicit feedback as U into the X²÷U relation, a conventional RMS-DC convertor could be formed. 

Q3 otherwise acts to buffer the Vbe(Q4) + Vbe(Q5) logarithmic voltage only taking away from the input current ≈X/β, and offers a most-convenient emitter-follower level shifter down 1∙Vbe. This compatibly drives the input Vbe to readout transistor Q2. The Q2 transistor converts the added series Vbe voltage from Q4 and Q5 into an antilogarithmic current, which the current-to-voltage convertor op amp U1B outputs as the final Vo. This op amp has a minimum Voltage Zero Reference (VZR) of +2.5V, as set up by the ½∙5V resistor divider at the +input. This range also allows plenty of voltage compliance at the -input of U1B, for current flow into Q2 to generate an output voltage. The output range is then nominally 2.5V ≤ Vo ≤ 5.0V. As a result of my available stock of 1% resistors, the Vo(max) is acutally just a bit more than 4.90V. Adding a resistor to the 2.74kΩ 1% resistor, or by finding a slightly more optimum 1% value, the output range could be made more exactly to +5V fullscale. But this was deemed not so important for a waveform shaping application in the present context. The effect of the U current as a denominator can be seen relative to the input current X. With a range of 2.50V ≤ Vo ≤ 4.91V, the X²÷U maximum current ratio for X|max at 1.0mA computes out to ΔV/2.74kΩ = (4.91-2.50V)/2.74kΩ = 880μA. This suggests U|max = X|max² ÷ 880μA, which computes out to about 1.14mA. With a little more design effort, tweaks could be made to the 604Ω resistor so that U could be set to more like 1.00mA. That would allow the U1B current-to-voltage gain conversion resistor to be more like 2.49kΩ for the same ΔV=2.5V output. But the current arrangement in the present circuit design was convenient enough for my available on-hand 1% resistors.

Additional engineering notes and exemplary scope fotos follow next. In particular, a little bit of effort was neccessary to set an input ΔV range that facilitated convenient 0-1mA output current at high compliance into the TL transistor array. This was done so that other TL circuits having potentially larger Vbe stacks could be contemplated with the same current driver circuit made with U1A and a 2N5087 transistor.

Testing  and calibrating the VCCS separately, 1mA full-scale into 1kΩ test load. 1.5V ≤ Vi ≤ 4.0V.

Testing VCCS compliance, test load raised to 2.49kΩ, Vo|pp = 2.5V.

Load resistor raised to 3.74kΩ, oscilloscope cursor measurement of Vo|pp = 3.75V.

Using a load resistor of 4.32kΩ, noting that the voltage compliance of the VCCS is about 4V.  

Square Generator in action. 1.5V ≤ Vi ≤ 4.0V (yellow), 2.50 ≤ Vo ≤ 4.91V (cyan). Also examing the 5V - 4V feedback against the 1.00kΩ 1% current reference resistor (blue). The Vbe of readout transistor Q2 is seen and can clearly be seen as logarithmic (magenta). The input test ramp frequency was 100Hz.

Test ramp at 1kHz.

Test ramp at 10kHz, some distortion seen in Vbe of readout transistor (magenta). But little general effect on the squarer voltage output.

Changed input ramp to 1.8V ≤ Vi ≤ 4.0V (yellow), which choses less of the square-law transfer function, as seen as a smaller logarithmic range (cyan). Input frequency 10 kHz.

Triangle wave input at 1.8V ≤ Vi ≤ 4.0V (yellow), showing square-law output (cyan). Input frequency 10 kHz.

Sine wave input at 1.8V ≤ Vi ≤ 4.0V (yellow), with characteristic sine-squared output shape, albeit one-sided (cyan). Input frequency 10 kHz.


Comments