Analog square rooter

Status
Not open for further replies.
Hello again drpower,

Sorry, i didnt notice the link but now i see it and yes it leads to some interesting circuit stuff. I'd be happy to take a better look at this. They say it works with a wide input range, so that's a very good thing. I still dont know what your input range has to be however, so you may want to mention that.

Just for starters, a squaring circuit can be used to make a square rooter circuit by placing the squaring circuit in the feedback loop of an op amp. It's an old trick used with various functions to get the inverse function. The theory is something like this...

We have a function f(t) and we want F(t) ie the inverse function. By placing f(t) in the feedback loop the output has to be equal to the inverse function in order for the inputs (one f(t) and the other the users input) to become equal. That's because when the output is equal to the inverse function it goes through the feedback loop and then becomes equal to the input again. So the only way the circuit can work (if it is stable) is to output the inverse function. It works with other types of functions too, in short the circuit does:
input1=users input
input2=f(F(t))=input1 (because f(t) is in the feedback path)
So, output=F(t)


I can provide more on this a little later, and i'll look over the schematics you've posted and be back a little later with some more comments.

You should know that there has been more done with squaring (and thus square rooter) circuits done in the not too distant past that you may also want to look into, as well as ready made IC chips that do this function quite well (like 0.3 percent accuracy or around that). I still want to look over the circuits you've posted though.

Back a bit later today...
 
Last edited:
Hello again,


Ok i got that other circuit to work but i had to add a 160 ohm resistor in series with the first 1N4148 diode. That's probably because that original DAS1 diode is a specially made diode that has a wider square law operation range. I could not find a data sheet on the web however. In any case though, the 160 ohm resistor seems to work. Oh yeah, i changed that one 100k feedback to 1meg because that provides for a better comparison.

The other circuit with U7 in it is a more straight forward approach to log, 0.5x, antilog, as you noted. It requires a DC bias because the diode doesnt really do a natural log, it does a natural log times a constant (using an approximated diode model), and another scaling constant comes in so we dont have to operate the diode at ridiculous currents like 4 amps and 10 amps, and a constant related to the particular diode, so the bias makes up for three constants. The center section op amp also divides the signal by 2, which provides the division required for the square root. You'll have to double check that part of the circuit to make sure it doesnt oscillate with a gain that low.

Because that lower section of U7 only computes a constant from another constant, it can be replaced by a 0.6v DC voltage reference, which you may want to make adjustable from say 0.5v to 0.7v or so. We can come up with an adjustment strategy if required.

If you'd like to look into the math behind this we can do more of that too. It starts from the diode model equations.
 
Last edited:

Thanks as usual MrAl for all your inpus

To be honest I did not notice how such a circuit will do the inverse function by going to the path of the feedback loop and for whiles that it is equal to the input! It is strange to me. I can not see any logical point behind it!?

Regarding the ready made Chips, the only chip which I now is AD663. It is a bit expensive and uses +-15V as power supply to take the square root of a signal while my power supply can provide something between +-6V to +-7.5V.
Do you know any chip which works with such a volatge which I have?
I made a square rooter by AD633 based upon its datasheet but it did not work at all in the volatge which I have. So I gave it up. Yet a chip like AD633 seems to use the nonlinearity of a diode to provide the square rooting function so I am not sure how about its error percentage.
 

Ok MrAl, I just want to focus on the log-anti log circuit because O could get some result in practice and of course the simulations showed good results even for input voltages below 1 volts and I should add that the log-anti log circuit works just good with a supply volatge of +-7.5V. You may already notice that the squarer circuit needs a supply of +-15V.

Ok please come to improve the log- anti log circuit as possible as.
I should give you some info, I want to add DC offset to the input so that get the the WHOLE sine input wave at the output of the square rooter. I do not care of the output DC offset which will be square rooted at the output as √(V DC offset +Vac). I Noticed that It has no problem for me to have the said output as √(V DC offset +Vac), But I wonderfully found out that it has some benefits for me too!

The final input signal is the audio or speech. So yes I want to take the square root of an input audio plus the DC offset so the final out put of the square rooter would be in the forms of: √ (audio + DC offset).
I am happy with an square rooted output of less than 10Vp-p while the supply is +-7.5VDC.

Ok, Now regarding to the above sayings, do you have any idea how to trim the log- anti log circuit for the best results?

Of course I would like to see the math you are talking about.
in the next post I'll show you my idea of how to add some DC offset to the circuit to get your idea...
 
Last edited:
Hi again drpower,

One thing i almost forgot to mention is that with that lower U7 op amp section, if that is changed to a constant voltage you may loose some temperature compensation. That means the circuit may drift more with temperature. That's if they used that section to help temperature compensate that is.

Now on to the feedback system with the squaring circuit in the feedback...

See the attached diagram. First we'll look at this intuitively, then mathematically. Im saving the log anti log circuit theory for next time because this got quite large.



The upper circuit is a general feedback system. The input is applied at 'a' and the output
appears at 'x'. 'A' is the feedforward gain, 'f(x)' is the feedback function. f(x) takes
'x' as input and the output of f(x) appears at 'b'. The round circle is a subtractor,
which computes the difference a-b and the difference appears at 'e' so:
e=a-b

This gets amplified by the amplification factor 'A' and we get 'x':
x=A*e

Since x feeds f(x):
b=f(x)

That's the general system. When f(x) is a squaring circuit, then f(x) becomes:
f(x)=x^2

and we get the system shown on the bottom.

To view how this works intuitively, we start with all variables equal to zero.
This means a=0, b=0, e=0 and x=0. We'll start with a gain for A of 1000.

Now we apply an input at 'a' as some positive voltage, say 4 volts. This means
e jumps up to 4v because b is still zero. That 4v gets amplified to 4000v
(remember this is theory, in practice this would saturate) but x doesnt appear
as 4000v right away because there is also a small delay in A, so say we see
initially 1v at x (it ramps up as time goes on depending on the speed of the
op amp). That 1v now appears at the input of x^2 and so b becomes 1^2=1v.
Now we still have a equal to 4v but now b is equal to 1v, so e changes to
4-1=3v. Note that e lowered a little already. By this time, x becomes larger.
Say it went up to 1.1v in that time. Now the input of x^2 is 1.1v and so
b becomes 1.1^2=1.21v. Note now b is even larger than before.
Now the output at e is 4-1.21=2.79v and so it went down a little more.
x is still ramping up, so say now it became 1.2v. That means b becomes 1.44v,
and this process continues until the circuit reaches equilibrium, which is
when e*A=1.9995000625 approximately. That's not exactly the square root of 4,
but it is close. The reason it is not exact is because A is not infinite in
a real life op amp.
If we let A get larger, say 10000, we get a better result at the output:
1.999950000625v which is closer, and if we make A ten times larger (100000)
we get 1.99999500000625 which is even closer yet.
So we see that the larger we make the op amp gain A, the better result we get.
That's the basic way negative feedback systems work.


Now we'll calculate this system output using some math...

Following the signal flow shown by the arrows from left to right, we have:
e=a-b
x=A*e=A*(a-b)

and for the lower feedback section we have:
b=x^2

so inserting this last equation into the previous one for x we get:
x=A*(a-x^2)

We now expand this and get:
x=A*a-A*x^2

and collect terms on the left we get:
x-A*a+A*x^2=0

and this is just a quadratic in x so we solve that and get two possible solutions:
x1=-(sqrt(4*a*A^2+1)+1)/(2*A)
x2=(sqrt(4*a*A^2+1)-1)/(2*A)]

In terms of the op amp, A is the open loop gain typically very large, so the first
solution will be negative so the second solution is the correct solution here:
x=(sqrt(4*a*A^2+1)-1)/(2*A)

Since A is very large typically 100000 for most op amps, in theory we make this infinite,
so we take the limit of this last equation as A approaches +infinity and we get:
x=sqrt(a)

which is simply the square root of the input. Thus, we've managed to use a squaring
circuit to obtain the square root.


Next we can look at the diode equations and the theory behind the log antilog circuits.
 

Attachments

  • FB-01.gif
    8.1 KB · Views: 136
Last edited:

Thanks you very very much MrAl for your long and complete writing.

It makes sense somehow now.

Regarding to the feedback pic I can remember that we had a formula for it as:
T(s)= A(s)/(1+A(s)xf(x))
Where as you mentioned If the f(x) happens to be quadratic then we'll reach to the sqrt function of the function.

Ok today I just found a chip which takes the square root of the input too, It is AD538, I have no access to it so I want to stick to the LOG-ANTI LOG circuit.
Please kindly can you start the examination of the log-anti log too, and let me know how to trim it (of course if needed) so that get the best result out of it ??
Now from my before post you have some info regarding the input voltage, supply voltage the wave which I want to use as the input. I myself tried it practically with several DC input voltages and then with an AC 1Khz signal with several voltages and it works fine but needs a few trimming.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…