Removing DC Offset

LesJones

Joined Jan 8, 2017
4,511
Can you post a schematic. It may be simpler to do the detection with reference to the positive rail than the negative rail. If the square wave has fast edges you could differentiate it with a small capacitor and a resistor to give you a string of positive and negative going spikes. You could use the positive spike to set a flipflop and invert the negative spike and use that to clear it. How close to zero does the frequency go ? (1 transition per hour ? 1 transition per century ?) If you give a full description of what you are trying to do there is more chance of having your problem solved. (Which may turn out to be a totally different approach.)

Edit. Yet another idea is to pass the signal through a low pass filter with a cut off of lower than the lowest frequency of the square wave (Assumming this is not really zero.) and use this a the reference voltage for the comparator.

Les.
 
Last edited:

Thread Starter

Gareth_71

Joined Dec 1, 2017
15
Here is one for the GURU's

So I built the circuit (DC Level shifter -1)from AnalogKid (thank you!) and all worked well, except that the scope on the + input showed the signal going to about -0.8v which is beyond the spec in the data sheet (-0.3v), so as this is coupled via a DC block, I thought I should try and remove the negative component on the signal before the + input by an active clamp, so I played about with a few circuits and ended up with this, which answers the original requirement. The question is WHY does it work? My sim shows it not working (although I do not have a great deal of faith in my sim).

???

ActiveClampSchematic.jpg
The output is as follows:

20180111-0001.jpg

The Blue is IN
The GREEN is at the -pin of the opAmp
The RED is OUT
 

Thread Starter

Gareth_71

Joined Dec 1, 2017
15
Hmmmn! Further to this, if I remove the GREEN probe, the output goes to 0v and stays there.

So I added a 1.2M resistor between -pin of OpAmp and Ground and it now works without the probe.

I do not know the inner workings of OpAmps enough to understand what is going on here. Will this circuit be stable long term?

I have tried many different voltages and frequencies and it all works great.
 

Thread Starter

Gareth_71

Joined Dec 1, 2017
15
Thank you Albert, I most certainly will.

But first I would like to explore the circuit I posted above because all testing shows it working...

Just waiting for an OpAmp expert to tell me what is going on...?
 

AlbertHall

Joined Jun 4, 2014
12,625
Thank you Albert, I most certainly will.

But first I would like to explore the circuit I posted above because all testing shows it working...

Just waiting for an OpAmp expert to tell me what is going on...?
Have you tried it with a 1Hz input? I think you will get a series of spikes not a square wave which your frequency counter may double count.

The circuit in post #44 will produce a square wave output however low the frequency gets.
 

Thread Starter

Gareth_71

Joined Dec 1, 2017
15
Have you tried it with a 1Hz input? I think you will get a series of spikes not a square wave which your frequency counter may double count.

The circuit in post #44 will produce a square wave output however low the frequency gets.
Hi Albert

It seems stable down to 0Hz but while I do not know what is going on, or why it works, it leaves me nervous to use this for the solution.
To that end I am building the circuit that you posted (#44). Many thanks.
 

AlbertHall

Joined Jun 4, 2014
12,625
Hi Albert

It seems stable down to 0Hz but while I do not know what is going on, or why it works, it leaves me nervous to use this for the solution.
To that end I am building the circuit that you posted (#44). Many thanks.
Note that the circuit as drawn uses an LT1017 but could use an LM393 which would probably be cheaper. I didn't have an LTspice model for the LM393.
 

MrAl

Joined Jun 17, 2014
13,708
I must have been unclear. My point is that the internal diode is shown as a conventional diode, not a Schottkey. As an internal structure, it doesn't have a part number associated with it. It is the *external* diodes in the applications schematics that have the part number.
Ok, so they are external. Then we have to ask who exactly drew that schematic because it's not very good. I'll elaborate.

Also, the internal diode is not a conventional ground (or Vee) clamp that is common in microcontrollers and CMOS logic. It is shown as an *over*voltage clamp. There is no undervoltage protection shown in the simplified schematic.
Simplified schematics are just that, simplified. If there is no internal diode then you cant have a maximum current spec of 50ma i dont think, but you can look into that if you like. For me, i just assume there is an internal diode and go with the 50ma max spec. That's the same as a uC chip but with many uC chips it's 20ma and some are less than that.

No, it doesn't. Working from memory, the open loop input impedance of a high gain bipolar differential pair is something like 250K. The stated "input resistance" of an LM741 is 6 Meg, and 500K for the LM301 worst case. The input resistance of the LM393 is not stated, but its bias current is 250 nA, almost identical to the other two opamps. For a capacitor to deliver a large surge current there must be a low impedance on both ends, and the IC pin does not present a low impedance to the external source.
The open loop Z is not in question here when there is a fault current, it then becomes the question of what is clamping. If there was no diode, then with 250K input impedance they grant you the right to apply 12500 volts to the input pin before the chip blows up.

As for the capacitor dumping a large current spike into an *external* clamp diode, note that the cap value is 0.1 uF. The total energy at 12 V is only 7.2 microjoules. I think a 100 mA continuous / 500 mA surge part can handle it.
ak
So i guess you are saying that with 0v across it and a 12v pulse that the cap will charge up before any damage to the external diode? I guess i can live with that, as long as it happens only once in a while. The frequency will start to become relevant if gets too high though.

So in conclusion i still dont see any good reason why you would not use a series resistor. I used the transistor current measuring circuit to illustrate what happened in the past.

I would change my mind ONLY if you could tell me the quantitative current flow INTO the pin with your solution for a fault current. I would probably be willing to accept two digit accuracy. Note with the series resistor we have NO problem doing this, so match that result and i'll be convinced for sure.
A would also be willing to accept the external diode addition WITH the series resistor in series with the pin, not the diode.

A second look the schematic, i see they are using 100pf and 1000pf caps not 0.1uf (which is 100000pf a hundred times higher). They are probably relying on the ESR of the caps to limit current at least with the 100pf and maybe the output Z to limit for the 1000pf cap in addition to the ESR.
 
Last edited:

MrAl

Joined Jun 17, 2014
13,708
I am humbled by your replies, thank you!

A bit more about the application:

The signal is a square wave going from (if the supply voltage is say 12v) 11.5v to 12v.
The supply voltage comes from a 12v battery and the circuit operates during charge and discharge hence the supply varies from about 11v to about 14.5v. So the supply voltage changes slowly over time.

Frequency is from 0 to about 10Khz max.

Many, many thanks for your input.

Hi,

That helps, but unfortunately frequency does not go down to 0Hz so a better spec on that would be good.

If you spec 1Hz for example, that means the coupling cap has to be larger than if you spec say 100Hz. So this spec is just as important as the high end spec of 10kHz.
If it really does go down to 0Hz (or maybe 0.001Hz for example) which is really DC, then a DC coupled circuit will have to be used which changes everything.
 

AlbertHall

Joined Jun 4, 2014
12,625
If it really does go down to 0Hz (or maybe 0.001Hz for example) which is really DC, then a DC coupled circuit will have to be used which changes everything.
Nope. It is still a square wave which still has edges. You just use the edges nor the level tops/bottoms of the signal. That is what the circuit in post #44 does.
 

MrAl

Joined Jun 17, 2014
13,708
Nope. It is still a square wave which still has edges. You just use the edges nor the level tops/bottoms of the signal. That is what the circuit in post #44 does.
Hi,

In a perfect world everything works.

As you say, 'Nope". But really it depends on the speed of the op amp or comparator too. For example a 1pf cap will only shoot a very short pulse into the comparator with a 0.001Hz square wave, but a 1uf cap will work better, but with a 100Hz wave we can go much lower than 1uf.

In the practical world other things come into play. Another consideration is the rise/fall slopes.
It also depends on what the following circuit can actually detect. You want to force it to detect a 1 ps pulse sometimes?

IF we know the entire frequency range we can specify the cap value and other components much better. That's all i am saying. At some point it makes it better to use DC coupling which is more stable anyway. That's how amplifiers progressed over the years in general too when bias stablization techniques got better.
 

Thread Starter

Gareth_71

Joined Dec 1, 2017
15
Hi

Still no joy! It turns out the signal has noise on it and is causing me no end of grief. Just about to give up!
I have attached a picture of the scope output.
Red is signal IN (on this particular machine the signal is closer to ground than other machines but still same amplitude).
Green is the signal after the input DC black capacitor and it has gone through a voltage follower so the scope probe does not interfere with the signal.
Blue is output from comparator.
 

Attachments

Janis59

Joined Aug 21, 2017
1,894
What are the expectations on the power? Should it be microamperes, miliamperes or amperes?
In the first case, no doubt the unipolar op-amp where one input channel is set to trimmer for voltage ramping.
In the second case, probably, the best way is the floating LED lamp, ie optocoupler. Third case the wiser be using the existing signal, just summing to it another floating ground DC power source (let call it "Ukrainian method" as it is existing in each their designs a multiple places in.)
If they need a voltages +1000, +500 and +480, they will build a 1000V power supply, will float on it an another of 500V PS being deducted, and last voltage they shall deduct the floating 20V from the resting 500V. So called "normal people" would construct such in vice versa, adding one 500 to on another 500, or in best case producing three independent PS. Thatswhy it is so irritating sometimes to repair their machinery like `Sumy electron microscope factory` laid devices. But the method itself works faultless, and in Your case it is absolutely appropriate.
 

Thread Starter

Gareth_71

Joined Dec 1, 2017
15
Hi Janis

I am sure your reply is really clever, but with respect to analog electronics I am not - I cannot understand your reply at all.

To answer the first sentence, current draw is irrelevant (within reason, say < 100mA)

Gareth
 
Top