Demodulator IC substitute

crutschow

Joined Mar 14, 2008
38,503
Verrrrrrrryyyy interrrrrresting.... That means that I can replicate any linear function that I want with this thing... like y = mx + c ... and some others, as I can tell from the datasheet. I can think of several other uses for this chip already.
Thanks!
It actually does non-linear functions like multiplying, dividing, and squaring.
Also useful for a gain control element, such as in an AGC amp.
 
Last edited:

Thread Starter

cmartinez

Joined Jan 17, 2007
8,759
I added a simulation, in case you missed it.
Thanks for the sim!
But the actual product needs to be rectified then? and then filtered with the 3 RC filters in series as in my original post to obtain a linear output proportional to the cell's load?
 

crutschow

Joined Mar 14, 2008
38,503
Thanks for the sim!
But the actual product needs to be rectified then? and then filtered with the 3 RC filters in series as in my original post to obtain a linear output proportional to the cell's load?
No.
Take another look at the output. It is all positive, with an average value of 1/2 the pk-pk value.
It just needs to be filtered as I did with a single-stage RC filter to get DC.

Remember that multiplying two sinewaves together of the same frequency and phase gives all positive values (negative times negative is still positive).
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,759
No.
Take another look at the output. It is all positive, with an average value of 1/2 the pk-pk value.
It just needs to be filtered as I did with a single-stage RC filter to get DC.

Remember that multiplying two sinewaves together of the same frequency and phase gives all positive values (negative times negative is still positive).
Good explanation... I'll start experimenting with your model and see for myself then... thanks!
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,759
So I played around with the thing, as I promised... and it seems to be wanting to work... except that a serious error is reported after 35ms... check it out.
BTW, I changed the inputs as ±5V and ±1V, is that an issue?
 

Attachments

crutschow

Joined Mar 14, 2008
38,503
So I played around with the thing, as I promised... and it seems to be wanting to work... except that a serious error is reported after 35ms... check it out.
BTW, I changed the inputs as ±5V and ±1V, is that an issue?
You can't willy-nilly change voltages arbitrarily and expect things to work.
If you look at the data sheet (gasp) you will see that it's rated with ±15V but it will operate some below that.
Figure 6 shows operation for different supply voltages and goes no lower than ±8V so it likely will not work properly with the ±5V you used in your simulation.
And as you can also see from that graph, the maximum input has to always stay several volts below the supply.

I'm more than happy to help you with your design but please thoroughly read the data sheet so you understand the characteristics and limitation of the device. Otherwise you are likely to be shooting blanks in your efforts. :rolleyes:
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,759
...please thoroughly read the data sheet so you understand the characteristics and limitation of the device. Otherwise you are likely to be shooting blanks in your efforts. :rolleyes:
You're right, sorry about that... I've been trying to work too fast, that's the thing. I did read the datasheets, but in a disorderly way and in a rush, skipping through probably important parts. The reason I tried to use ±5V is that I can easily generate that voltage filtered and regulated. Whereas ±15V I can only get from a switching (filthy) power supply.
Also, the AD630 can work at ±5V, and I had assumed (yeah, I know... assumption is the mother of all screw-ups) that the AD633 had the same capability as well.
Let me read and play some more, and I'll get back here if I'm still stuck. Thanks!
 

crutschow

Joined Mar 14, 2008
38,503
.......................
The reason I tried to use ±5V is that I can easily generate that voltage filtered and regulated. Whereas ±15V I can only get from a switching (filthy) power supply.
...............................
Just buy a couple of 12v or 15V wall-worts for power.
The AD633 will operate fine at 12V but the inputs can be no more than about 8V peak.

The AD633 simulation model has known problems giving errors in convergence/time-step.
Sometimes loosening the simulation limits by a factor of 10, or changing the Integration Method to Gear in the Tools/Control Panel/Spice window can help.
Also using square-waves rather than sine-waves at the inputs is more likely to cause problems.
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,759
Also using square-waves rather than sine-waves at the inputs is more likely to cause problems.
Thanks, I already figured that much... through trial and error...
And I'm glad you're telling me that the ±15V power supply is no big deal if it's of the switching type, I was kind of worried about noise. I'm going to use this to power things up.
 

crutschow

Joined Mar 14, 2008
38,503
.......................
And I'm glad you're telling me that the ±15V power supply is no big deal if it's of the switching type, I was kind of worried about noise. I'm going to use this to power things up.
The noise problem mostly depends upon how much sensitivity you need from the bridge (smallest imbalance).
If you know that then you can make a rough estimate of how much power supply noise you can tolerate.
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,759
Last question, would using 2.2uF tantalum caps and 4.7K resistors as filters at the circuit's output instead of the suggested ones make much of a difference?

Capture.JPG
 

crutschow

Joined Mar 14, 2008
38,503
Last question, would using 2.2uF tantalum caps and 4.7K resistors as filters at the circuit's output instead of the suggested ones make much of a difference?
That's less then a 4% difference in the RC time-constant so there would be no significant difference in the observed output settling time or noise.
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,759
That's less then a 4% difference in the RC time-constant so there would be no significant difference in the observed output settling time or noise.
Thanks... you've just told me a whole lot of things with that observation of yours...

Now, please correct me if I'm wrong:

The RC constant that you are referring to is also know as the greek letter "tau": Tau.png

The relation of this to frequency is given by:
RC.png

Therefore, when R=4,990 Ω and C=0.000002F, then Fc = 15.947Hz

What I don't fully grasp at this moment, is the behavior of three such filters in series... my very wild guess here is that you simply multiply the last result by three. So the previous three RC arrangement works at 47.842 Hz

I plan to excite the cell at a frequency of 420Hz, which is a multiple of 60. I chose that value to sync it with mains and minimize noise induced by that source.

Wouldn't it be better if I used an RC constant such that Fc = 20Hz for the previous filter circuit? (3 x 20 = 60)
If that were the case, then I should aim for a value of RC = 1/(2*pi*20) = 0.00795774715459476678844418816863

Assuming that I'll be using 2.2µF caps for this purpose, then R should be equal to 3,978.87 Ω

Am I more or less right? Or is my reasoning waaaaaaaaaayyyyyy wrong?
 

crutschow

Joined Mar 14, 2008
38,503
You are on the right track, but the effective resistance of each stage is affected by the adjacent stages (the resistances appear in parallel) so the RC value is not a simple calculation as you have done.
That being said, the three RC values do act like three RC filters in series.

The is no reason to have the filter rolloff an integral value of the excitation frequency. You select the filter rolloff frequency based upon the response time and ripple voltage you can tolerate.

Because of the complexity of the calculation it's easiest to determine the filter response by Spice simulation such as shown below. As you can see the -3dB point is about 3Hz.

3 Stage RC Filter.gif
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,759
There is no reason to have the filter rolloff an integral value of the excitation frequency. You select the filter rolloff frequency based upon the response time and ripple voltage you can tolerate.
I knew my reasoning was too easy to be true... but I'm glad you told me I wasn't too much off course.

So what would you recommend as RC values for what I have in mind? As I said before, I'll be exciting the cell using a 420 Hz AC signal. And I'd like to minimize noise induced by mains. I'll be feeding the output signal of this circuit to a 16-bit ADC, averaging at least 256 values (maybe lots more) before reporting a value on screen. This is the chip I'll be using (and I've already used on previous designs)

Should I just stick to the values in the original circuit? Or maybe I should just build the thing already and see what happens?

Another question, I'll be adjusting the AD8221's gain to make sure that the AD630AR never delivers more than 5V at the output. To that end I'll also be placing a 5.1V zener in series with a 1K resistor to ground at the OpAmp's output to protect the ADC's input from over voltage. Is this a good practice? Would the zener affect accuracy? Or is there a better way to accomplish this?
 
Last edited:

crutschow

Joined Mar 14, 2008
38,503
I should have previously noted that the response for three RC values in series would add as you suggested if you put an op amp buffer between each stage for isolation. But note that, since each stage has a -3dB response at the break frequency, the total rolloff for the three filters in series would be -9dB at the RC corner frequency.

For a 5Vdc signal and 16-bit resolution the minimum signal resolved is 5V/65536 = 76μV.
To keep the ripple below that you want the filter response to be down at least 76μV/10Vac = -102dB at 420Hz
(10Vac signal for 5V average DC level).
The filter I simulated has a rolloff of -85db @ 420Hz, so we need a little more attenuation.
If you average 256 signal samples, the noise is theoretically reduced by √256 = 16 times for another 24dB reduction. This gives a total rolloff at 420 Hz of -109dB, for a 7dB margin, which should be adequate for your system.

A common way to limit the signal amplitude is to use a series resistor and a standard or Schottky diode to the V+ supply (cathode to supply).
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,759
crutschow, I'm trying to replicate your circuit, but I do not understand what you did with the voltage source. Is it a sinewave? of what amplitude and frequency? Also, how can I generate the Freq Vs DB and phase just like you did?
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,759
Also, what would happen if I were to add a fourth RC stage to the filter? Would it dramatically affect response time? Would it be overkill?
 

crutschow

Joined Mar 14, 2008
38,503
crutschow, I'm trying to replicate your circuit, but I do not understand what you did with the voltage source. Is it a sinewave? of what amplitude and frequency? Also, how can I generate the Freq Vs DB and phase just like you did?

Also, what would happen if I were to add a fourth RC stage to the filter? Would it dramatically affect response time? Would it be overkill?
I did an AC Analysis, not a Transient Analysis.
I set the voltage source to 1Vac (which is a sinewave and the only waveform allowed in AC Analysis).
The frequency sweep is determined by the limits you set in the AC Analysis window.
The AC analysis automatically does the Bode plot I showed.

Adding another RC state would increase the attenuation to about -113dB @ 420Hz.
Only you can determine whether that is overkill for your requirements. ;)
 

Tesla23

Joined May 10, 2009
560
As I said before, I'll be exciting the cell using a 420 Hz AC signal. And I'd like to minimize noise induced by mains. I'll be feeding the output signal of this circuit to a 16-bit ADC, averaging at least 256 values (maybe lots more) before reporting a value on screen. This is the chip I'll be using (and I've already used on previous designs)
Have you considered the possibility of scrapping the hardware synchronous detector and doing it in software? This may not be possible, but the implementation would be pretty trivial if you could arrange your ADC to sample at a multiple of the 420Hz, e.g. say 8 samples/cycle. The demodulation would simply mean changing your averaging to add 4 samples, then subtract the next 4, add the next 4 and so on. There are many refinements to this to reduce harmonic responses, but this simple basic technique would work pretty well. If you always calculate over a whole number of cycles (average over 8N), then there is a perfect null at 420Hz and you don't need the RC filters etc.. As you are averaging over many samples you would increase your resolution past 16 bits (as at present), but with no offsets to worry about.

The one thing that may be tricky is ensuring the phasing of the +/- is correct.
 
Top