Demodulator IC substitute

Thread Starter

cmartinez

Joined Jan 17, 2007
8,252
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.
That's a very interesting proposition... I suck at analog electronics, but I'm an expert MCU programmer :cool: and know how to keep things in perfect sync.
But wouldn't the ADC have to accept both positive and negative voltages at it's input? Or wouldn't the ± square wave have to be rectified before reaching the ADC?
 

Tesla23

Joined May 10, 2009
542
That's a very interesting proposition... I suck at analog electronics, but I'm an expert MCU programmer :cool: and know how to keep things in perfect sync.
But wouldn't the ADC have to accept both positive and negative voltages at it's input? Or wouldn't the ± square wave have to be rectified before reaching the ADC?
Simply drive the REF pin of the AD8221 to shift the signal to be always positive. Set the gain to keep it within the range of the ADC.
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,252
Simply drive the REF pin of the AD8221 to shift the signal to be always positive. Set the gain to keep it within the range of the ADC.
All the circuit examples I see in the datasheet connect REF to ground. Are you suggesting that I just connect REF to +Vs? Or should I connect REF to +Vs when input is positive and switch to -Vs when input is negative?
I think it's pretty clear to us that I do not know how the REF thingy works at all...
 

Tesla23

Joined May 10, 2009
542
All the circuit examples I see in the datasheet connect REF to ground. Are you suggesting that I just connect REF to +Vs? Or should I connect REF to +Vs when input is positive and switch to -Vs when input is negative?
I think it's pretty clear to us that I do not know how the REF thingy works at all...
Read the datasheet!
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,252
Read the datasheet!
Just did.... and stared at it... until I think something clicked...

Please correct me if I'm wrong, but what the REF pin does is add (or subtract) an offset to the output?

If so, I'd just have to add a circuit like the following one:

Capture.JPG

This circuit uses an opamp configured as a voltage follower so that it can be a low impedance source to the REF pin. Then what I'd do is add a trimpot to the opamp's non-inverting input connected as a voltage divider, that way I'd be able to adjust the desired output offset.... am I right?
 

crutschow

Joined Mar 14, 2008
34,412
You can also couple the signal through a capacitor into two equal value resistors in series between V+ and ground.
That will offset the voltage to be 1/2 of V+.
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,252
You can also couple the signal through a capacitor into two equal value resistors in series between V+ and ground.
That will offset the voltage to be 1/2 of V+.
You mean like this?

Capture.JPG

With the "Out" connected to the non-inverting input of the voltage follower opamp?
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,252
Not quite.
The "Out" is the "In" and the correct "Out" to the op amp input (or A/D input) is the junction of R1 and R2.
:confused::eek:
I think I get it now... that way the voltage divider will consume almost zero current since the opamp's input has a very high impedance.

Capture.JPG
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,252
Ok... summing things up, this is the way I understand things now.

  • I intend to use a 1.5mv/V load cell.
  • The load cell will be excited using a ±5V square wave at 420Hz.
  • That means that the load cell's output at maximum load will also be a 420Hz square wave, but with a maximum amplitude of ±7.5mV.
  • If my ADC accepts an input range of 0 to 5V, then I have to set the Instrumentation amplifier's gain at 333. That way I get a square wave output with a maximum amplitude of ±2.5V.
  • Then I add a +2.5V signal (using the voltage divider in series with a cap feeding the voltage follower op-amp, as suggested by @crutschow) to the reference pin of the instrumentation amplifier, so as to offset the output signal by that much. That way in the end I obtain the desired 0 to 5V signal range.
  • I add a schottky diode and 100 ohm resistor from the InstAmp's output to my 5V source feeding the ADC to protect its input from over voltage, and another diode and resistor from the InstAmp's output (inverting the diode's polarity) to ground, to protect it from negative voltages.
  • Lastly, I add a whole bunch of code to generate the square wave and sync the ADC's conversions on the upper and lower parts accordingly, using the method suggested by @Tesla23
In the end, the signal coming out of the InstAmp and into the ADC, as the load goes from zero to maximum on the load cell, is going to look like this:

Capture.JPG

Is my reasoning correct?
 

crutschow

Joined Mar 14, 2008
34,412
:confused::eek:
I think I get it now... that way the voltage divider will consume almost zero current since the opamp's input has a very high impedance.

Sorry, still not right. o_O
That circuit won't shift the DC level since the capacitor blocks the DC source from doing anything.

Go back to your circuit in Post #49 and reread my Post #50.

Input from your bridge signal source is the terminal labeled "Out".

The Output to the op amp or A/D is the junction of the two resistors, which is sitting at 2.5V.

Make sense?
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,252
:mad::(

Crutschow, thank you for your infinite patience...

This is what I understand so far:

Capture.JPG

To what node in the circuit are you referring that I should connect C1 to?
 

crutschow

Joined Mar 14, 2008
34,412
Okay, I see the problem. :)
We are talking about two different approaches to the same end.
My circuit is placed at the instrumentation amplifier output and is in place of the offset bias applied to the output zero reference by U2.
If you apply the bias as you show with U2, and R1 and R2, then you don't need the capacitor or anything else connected.
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,252
Okay, I see the problem. :)
We are talking about two different approaches to the same end.
My circuit is placed at the instrumentation amplifier output and is in place of the offset bias applied to the output zero reference by U2.
If you apply the bias as you show with U2, and R1 and R2, then you don't need the capacitor or anything else connected.
I'm relieved... I thought that my IQ was shrinking here... :confused:

:confused:
I think I'll build the thing now. I'll let you know how it went... thanks again!
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,252
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)
@crutschow, is this what you meant I could use to protect the ADC's input from over and under voltage being output by the instrumentation amplifier?

Capture.JPG
 
Top