Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Analog square rooter

Status
Not open for further replies.

dr.power

Member
Hi guys,

I wanna make a square rooter circuit so that take the square root of a sine wave, The idea is to add some DC-OFFSET to the sine wave so that I have a Completely positive sine wave.
I decided to use op-amps for doing so. I want to take the log of the input signal then multiply the result by a factor of 1/2 and final take the anti log of it. The result would be the square rooting of the input.

Please take a look at the below square rooter circuit and give me your idea.
The main problem which I am dealing with is that I am not sure adding some DC offset to the input and finally removing it by a capacitor at the output will give me the proper signal?

Thanks a lot:eek:
 

Attachments

  • 33.PNG
    33.PNG
    22 KB · Views: 292
I wanna make a square rooter circuit so that take the square root of a sine wave, The idea is to add some DC-OFFSET to the sine wave so that I have a Completely positive sine wave.

This sounds highly bizarre? - if you want to DC shift a sinewave then there are many much simpler ways (and probably none more complicated and less effective).

Just use a single opamp to shift the sinewave to positive only.
 
Ok here's the result in The Proteus Software, where the input signal is -2Vdc (you can see it in yellow), you can see the output which is 1.4Vdc in red. Good result, but I am not sure what is the best way to add the DC-Offset for A SINE INPUT? And I am not sure If the result would be ok by adding a dc-offset or not?
Suppose I add say 4V dc offset while the input signal is Vmsinwt, can you please let me know what would be the output result? I am not sure if I'll get √4 + √Vmsinwt or ill get
√(4+ Vmsinwt) at the output? I should try it by Proteus after I find the best way to add DC offset to the input.
 

Attachments

  • 77.PNG
    77.PNG
    111.9 KB · Views: 255
This sounds highly bizarre? - if you want to DC shift a sinewave then there are many much simpler ways (and probably none more complicated and less effective).

Just use a single opamp to shift the sinewave to positive only.

Thanks for your input Nigel,

Actually the Dc offset which I want to add is not what you have seen in the first pic as "Voffset". Actually the circuit itself needs a DC offset for the center op-amp which multiples the LOGed signal by a factor of 0.5 (I do not why it needs an offset but in the second pic in my second post you can see how I added the said offset for the center op-amp which is what I have seen in the original circuit).
 
Doctor Power,

I wanna make a square rooter circuit so that take the square root of a sine wave, The idea is to add some DC-OFFSET to the sine wave so that I have a Completely positive sine wave.

You don't have to add any DC offset. The √(sin(t)) is a completely positive function.

Ratch
 
Doctor Power,



You don't have to add any DC offset. The √(sin(t)) is a completely positive function.

Ratch

Opps!
Actually the input signal is not √(sin(t)), it is Vm sinwt, The function square rooting is done by the op-amps-diodes, Giving a normal sine wave will cause the negative portions of the the sine wave to be removed...
 
Ratchit,
Here's the result while we do not use any input dc offset.
The input signal is Vm=-2v and the input frequency is 1kHz:
 

Attachments

  • 88.PNG
    88.PNG
    113.3 KB · Views: 224
Doc Power,

Interesting. What is the simulator?

Ratch

The software is "Proteus 7.6" which simulates the analog-digital circuits and of course Microcontrollers. It has a nice and simple to working PCB designer with auto rooting and auto placing too.
 
Doc Power,

OK, I $aw what they wanted for the full ver$ion. Did you do your simulation with the stunted "free" version?

Ratch
 
Doc Power,

OK, I $aw what they wanted for the full ver$ion. Did you do your simulation with the stunted "free" version?

Ratch

I just use the full version. I never used the free version And have no idea about it.
Where did you go fro the price list?

Any idea regarding my question please? How to add a dc offset to the AC signal so that the AC signal does not be affected by the DC offset? I do not want the domin of the Ac signal to be reduced due to DC offset volatge.
By the way no one knows if the circuit takes: √dc-offset + √Vac
or it takes: √(dc-offset + Vac)?
I noticed if the circuit takes the later then the output will not be a correct square rooted signal, Are you agreed with me regarding to that?

Thanks
 
Doc Power,

I just use the full version. I never used the free version And have no idea about it.
Where did you go fro the price list?

**broken link removed**

Did the company you work for buy the software?

Any idea regarding my question please? How to add a dc offset to the AC signal so that the AC signal does not be affected by the DC offset? I do not want the domin of the Ac signal to be reduced due to DC offset volatge.

I would run the sin through the √ process, then pipe both the signal and the offset into the two ports of an adder. The output of the adder should be the √(signal) plus the pure offset. **broken link removed**

By the way no one knows if the circuit takes: √dc-offset + √Vac or it takes: √(dc-offset + Vac)?
I noticed if the circuit takes the later then the output will not be a correct square rooted signal, Are you agreed with me regarding to that?

Correct, you do not want the sum of the DC and the signal getting sqrt'ed. The signal only should be sqrt'ed. The method I suggested above should do that.

Ratch
 
Last edited:
Doc Power,



**broken link removed**

Did the company you work for buy the software?

No. A friend of mine has the software and I use his PC...

I would run the sin through the √ process, then pipe both the signal and the offset into the two ports of an adder. The output of the adder should be the √(signal) plus the pure offset. **broken link removed**

That;s right. But do you know that by doing so we'll get an output in form of
(dc-offset + Vac) at the output of the summing op-amps? Then transferring the said signal to the square rooter circuit will give us an output as :
√(dc-offset + Vac).

Correct, you do not want the sum of the DC and the signal getting sqrt'ed. The signal only should be sqrt'ed. The method I suggested above should do that.

How do you think that your method is doing so? I don't think so.

Please any idea how so I take the square root of a sine wave yet letting the negative section to be squared rooted too? You guys know that it is not possible to take the square root of a negative wave form. The only solution which I reach to was to add some DC offset to the input so that the whole dine wave which I want take its square root becomes positive, But it seems that the output would be √(dc-offset + Vac), And I do not know how to trim it so that I get the correct square rooted signal.
First I thought that i'll get √(dc-offset) + √(Vac) at the output of the square rooter which it meant that I'll get the proper square rooted AC signal plus an offset which could be simply removed by a capacitor, but as I said soon I noticed that I'll get the √(dc-offset + Vac) signal at the output of the square rooter which I do not know how to treat with it?

Please help:eek:

Thanks
 
Hello drpower,

What is it you are trying to do, ie what are you trying to generate?

I ask because you state that you want to add some DC offset to a sine wave yet you dont have to take the square root of it to do that. There are much easier techniques. So i ask that question because of that.

If you want a completely positive wave, you wouldnt take the square root, you would take the square, or simpler yet take the absolute value. There are simple ways to take the absolution value and squaring is harder to do.

Or is it that you need to take the square root of a sine wave plus a DC offset?
If you do want to take the square root of a sine wave by taking the square root of a sine plus DC, you dont get the square root of a sine wave anymore anyway, you get the square root of something like A*sin(wt)+k, which is totally different.
 
Last edited:
Hello drpower,

What is it you are trying to do, ie what are you trying to generate?

I ask because you state that you want to add some DC offset to a sine wave yet you dont have to take the square root of it to do that. There are much easier techniques. So i ask that question because of that.

If you want a completely positive wave, you wouldnt take the square root, you would take the square, or simpler yet take the absolute value. There are simple ways to take the absolution value and squaring is harder to do.

Or is it that you need to take the square root of a sine wave plus a DC offset?

Thanks MrAl for your input.

Actuallly I do not know if you noticed why I need to add DC offset to the input or not?
A sine wave in form of Vm sinwt has 2 portion, a positive portion and a negative one. My interst is taking the square root of a sine wave i.e Vm sinwt, The problem here is that we are not able to take the square root of a negative signal (Plaese take a look at my post #7 and the picture I attached in the said post). The only way I could think of was to add as much as DC offset so that I UP SHIFT the said sine wave to have a compltetly positive sine wave. Then taking the square root of it would be simple because there would not be any negative portion (you now notice that I had to add dc offset to do so otherwise I did not need to it). Now I think by adding a dc offset in the putput to the sine wave the output signal would not be a proper squuer rooted signal because by adding dc offset I'll get this signal at the output of the square rooter: √(dc-offset + Vac).
Before I thought I'll get this one at the output: √dc-offset + √Vac , Which is dealable as a sine wave square rooter (makes sense? in the laster formula the Dc offset is sperate than the square rooeted Vac and so acts as a seperate offset at the output and does not affect the square rooed Vac), Any way I was wrong and the output is in form √(dc-offset + Vac) if I add a dc offset to the sine signal in the input. Now I do not know what to do so that take the square root of a sine wave yet letting the whole portions of it to be square rooted and being present at the output.
Hope it makes sense.
 
Hello again drpower,

Yes i think that makes sense, and explains what you are trying to do a little bit better.

It seems that you want to take the square root of sin(wt) and you found that since that wave goes both plus and minus that you run into trouble when it goes negative because a simple square rooter circuit can not deal with the negative input. So first try is to add a DC offset to the original signal sin(wt) but then you end up with sqrt(sin(wt)+k) instead of sqrt(sin(wt))+sqrt(k), so you need another approach.

The next idea is to take the absolute value of the sin(wt) and then take the square root of it. That way you have a completely positive output and it really is the square root of |sin(wt)|. So first you run sin(wt) through an absolute value circuit, then run it to the square root circuit.
If you need the output to go negative when sin(wt) goes negative then we'd need a little bit more to detect when the input goes negative, or build the circuit a little differently to handle the two cases plus and minus independently and then add them back together. I think you want all positive though if i understand you correctly.

So you know what an absolute value circuit looks like?
BTW, im not sure if you mentioned this yet, but what is the input frequency range going to have to be?
 
Last edited:
Hello again drpower,

Yes i think that makes sense, and explains what you are trying to do a little bit better.

It seems that you want to take the square root of sin(wt) and you found that since that wave goes both plus and minus that you run into trouble when it goes negative because a simple square rooter circuit can not deal with the negative input. So first try is to add a DC offset to the original signal sin(wt) but then you end up with sqrt(sin(wt)+k) instead of sqrt(sin(wt))+sqrt(k), so you need another approach.

The next idea is to take the absolute value of the sin(wt) and then take the square root of it. That way you have a completely positive output and it really is the square root of |sin(wt)|. So first you run sin(wt) through an absolute value circuit, then run it to the square root circuit.
If you need the output to go negative when sin(wt) goes negative then we'd need a little bit more to detect when the input goes negative, or build the circuit a little differently to handle the two cases plus and minus independently and then add them back together. I think you want all positive though if i understand you correctly.

So you know what an absolute value circuit looks like?
BTW, im not sure if you mentioned this yet, but what is the input frequency range going to have to be?

Thanks MrAl for your help:eek:,

Yea, So you got it.
I already was thinking of taking the absolute value by a full bridge rectifier, But I ended up with a trouble of recovering the negative portion of the sine wave at the output.

Ok For now I give up for an approach to solve the problem I dealt with And focus on the square rooter circuit itself. I simulated a square rooter circuit which seems to be much better than my original one in previous posts of this thread. the below pic is the one which I talk about. It works just fine as a square rooter in simulator but I do not know why it does not work when I made it practically?
Any idea plz?

Here's the link for the said circuit which I simulated...:
https://docs.google.com/viewer?a=v&...PuIJtE&sig=AHIEtbQlwo8V3P6DpSs3yeJ6lyfwMoEvXQ
 

Attachments

  • 122.PNG
    122.PNG
    40.1 KB · Views: 189
  • 1231.PNG
    1231.PNG
    116.9 KB · Views: 194
Last edited:
Hi again,


An absolute value circuit is not exactly just a full wave rectifier bridge made of only diodes, it's a op amp circuit that is a little more accurate for low level signals. A bridge rectifier has diode drops which impairs its ability to function accurately with signals that are comparable to the diode drops. The op amp equivalent circuit is better in that it can rectify lower level signals much more accurately.

Are you saying that you need to have the output go negative when the input goes negative? In that case you also need a circuit to detect the negative portion of the input and switch the output so that it goes negative too (after taking the absolute value and square root).

I'll take a look at your circuit and see what i can find out. What are the two adjustments doing for you?
Also, what range input are you looking for?

That circuit looks a little strange. Did you check it for numerical accuracy?
Basic tests:
When you input 0.25v, did you get 0.5v out?
When you input 1v, did you get 1v out?
When you input 4v, did you get 2v out?
When you input 9v, did you get 3v out?

I ask because certain parts of the circuit look very unorthodox (R2 for example).
They make pretty good multiplier chips these days i think so you may be better off with a design based on a multiplier chip.
You can also consider using a micro controller chip with built in AD converter and DA output.
 
Last edited:
Hi again,


An absolute value circuit is not exactly just a full wave rectifier bridge made of only diodes, it's a op amp circuit that is a little more accurate for low level signals. A bridge rectifier has diode drops which impairs its ability to function accurately with signals that are comparable to the diode drops. The op amp equivalent circuit is better in that it can rectify lower level signals much more accurately.

Are you saying that you need to have the output go negative when the input goes negative? In that case you also need a circuit to detect the negative portion of the input and switch the output so that it goes negative too (after taking the absolute value and square root).

I'll take a look at your circuit and see what i can find out. What are the two adjustments doing for you?
Also, what range input are you looking for?

That circuit looks a little strange. Did you check it for numerical accuracy?
Basic tests:
When you input 0.25v, did you get 0.5v out?
When you input 1v, did you get 1v out?
When you input 4v, did you get 2v out?
When you input 9v, did you get 3v out?

I ask because certain parts of the circuit look very unorthodox (R2 for example).
They make pretty good multiplier chips these days i think so you may be better off with a design based on a multiplier chip.
You can also consider using a micro controller chip with built in AD converter and DA output.

Thank you very much MrAl,

To the second circuit I agreed that It is a bit strange (the Link of my above Post explains how it works But I am not able to understand it..).
I tried the circuit for voltages of one and bigger than 1 in the simulator, and it actually works. The link says that the first stage is a squarer but i don't know how they take the square root by a squarer circuit!
As I told I made the above circuit practically but It did not work in practice!!

Now I want to back to the first circuit and make it practically to see the results.
One question which I have is that I do not now what is the functioning of "U7: D" here in the circuit (Plz take a look at the below pic)?
The disner says that it acts to give an offset to the circuit and to normalize the signal. I can not understand why they need it and why they used such a circuitry to generate an offset? Why they put a diode in the feedback loop of U7: D to generate a DC offset? Why they do not use a normal voltage divider?! (the explanations regarding the circuit are here:
https://docs.google.com/viewer?a=v&...qHUkjw&sig=AHIEtbR-h2_IX6byp-m6pXdFE1zgXr91zQ ( pLz take a look at "D.2.2" and "D.4")).
I want to remove he D7: D somehow and use its op-amp in the output so that give the input a 180 degrees phase shift so that I could give positive signals to the input (if you tak a look at the below pic you'll notice that it accepts the just negative inputs not positive ones).

MrAl can you give me a view of D7:d stage please?

thanks

Edited...
Ok here's the results of this circuit in practice while the input peak is almost 2V:
So the original circuit using 4 op-amps as "log -> x0.5 -> antilog" works in practice.
I have to perform some trims on it to get the best results.
Any idea plz?
 

Attachments

  • 666.PNG
    666.PNG
    114.5 KB · Views: 183
  • a1.PNG
    a1.PNG
    80.9 KB · Views: 189
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top