Remove DC bias from a square wave

Thread Starter

electrophile

Joined Aug 30, 2013
167
I have a square wave output from a hall effect sensor that is DC-shifted by about 4V. If I understand the image below correctly, the output of the hall sensor is a square wave between 4V and 7.5V, and that the output is DC-shifted by 4V. Is this interpretation correct? If yes, how do I remove this DC shift? The square wave is as shown below. Would a simple cap at the output work? I need to interface the signal to an MCU and it needs to be between 0-3.3V. I simulated the design shown here but it does not seem to work in my case.

Screenshot 2020-12-06 at 20.14.25.png
 

ericgibbs

Joined Jan 29, 2010
18,845
hi ep,
I read the datasheet the same as you.
For a 0v to 1.2V output you need a OPA level shifter, with Gain to give 0V to 3.3V
Which type of OPA do you have on the bench.?
E
 

Thread Starter

electrophile

Joined Aug 30, 2013
167
I have an LM339, MCP6004, an LMV324, and LT1215. Only the LT1215 is a through-hole package so that would be easy to prototype with if it works.
 

ericgibbs

Joined Jan 29, 2010
18,845
hi,
OK,
Can you measure the actual voltage that comes from your Hall device, as you can see the spread is wide according to the d/s
See image.
BTW: Note the 'tight' supply voltage required, 8V +/- 0.2%
E
 

Attachments

ericgibbs

Joined Jan 29, 2010
18,845
hi,
The MCP6004 is a rail to rail OPA, but the maximum Vsupply is 5V, do you have a 5V supply.?
The LM324 is OK with a 8V supply and can Vout down to approx 25mV.
The LM339 is a comparator
The LT1215 looks OK.

Have you measured the Vout range of your Hall device.?
E
 

Thread Starter

electrophile

Joined Aug 30, 2013
167
hi,
The MCP6004 is a rail to rail OPA, but the maximum Vsupply is 5V, do you have a 5V supply.?
The LM324 is OK with a 8V supply and can Vout down to approx 25mV.
The LM339 is a comparator
The LT1215 looks OK.

Have you measured the Vout range of your Hall device.?
E
Hi, yes I did. The 'low' value is 4.1V and the 'high' value is 7.5V. I noticed the tight supply voltage but I'm wondering why. I forgot to attach the other part of the spec sheet but it seems to be using Allegro's A1221 sensor which is rated up to 24V. Also, yes I do have a 5V supply.
 

ericgibbs

Joined Jan 29, 2010
18,845
hi ep,
You said 4V to 7.5V pulse level, are you doing a frequency count or a level detection of a pulse between 4V and 7.5v.???

E
 

ScottWang

Joined Aug 23, 2012
7,398
To try a simple method first and that is to using a CR integral circuit, the C is used to cutoff the DC voltage.

RC values will affecting the input frequency, choosing the properly RC values to pass the input frequency and stop the DC voltage, if you get sucess then you can also add the other components like bjt or op amp.
 

MrChips

Joined Oct 2, 2009
30,795
Try placing the series resistor RP on the GND side of the circuit.
You should get a signal from 1.2V to 3.4V. Signal will be inverted.
0.5V min - 4.0V max

Also experiment with lower Vcc and different RP values.
 

dupaweza

Joined Dec 10, 2020
5
Just try.
The second transistor is not necessary if you don't care that the signal would be 180 deg. out of phase (inverted). The the output from the collector of the first stage then.
 

Thread Starter

electrophile

Joined Aug 30, 2013
167
To try a simple method first and that is to using a CR integral circuit, the C is used to cutoff the DC voltage.

RC values will affecting the input frequency, choosing the properly RC values to pass the input frequency and stop the DC voltage, if you get sucess then you can also add the other components like bjt or op amp.
You mean with a capacitor at the output to block DC and a resistor after that to ground? Yeah I did simulate this with LTSpice but got weird results. The frequency is about 2.2Hz. If I assume the R to be 10k I get a cap value of 10u. I’ll post the result soon.
 

ericgibbs

Joined Jan 29, 2010
18,845
hi ep,
I read your original post in that way,
ie: you wanted to detect the voltage level of a square wave at a fixed frequency.

The square wave has fixed offset of 4v to 5v and its maximum amplitude can be 6.2v to 7.5v

So you want a Vout of 0V thru 3.3V for the above, is that correct.???

E
 

Ian0

Joined Aug 7, 2020
9,803
I like @dupaweza ’s circuit, but if you have a continuous squarewave output, the this would also work.
The device is a comparator. if you are interefacing to 3.3V or 5V logic use an open collector (or drain) comparator such as LM339/LM393. If it’s a microcontroller, it may already have a pull-up resistor.
Choose R and C for a time constant about 10 times the slowest time between two pulses.
 

Attachments

Thread Starter

electrophile

Joined Aug 30, 2013
167
hi ep,
I read your original post in that way,
ie: you wanted to detect the voltage level of a square wave at a fixed frequency.

The square wave has fixed offset of 4v to 5v and its maximum amplitude can be 6.2v to 7.5v

So you want a Vout of 0V thru 3.3V for the above, is that correct.???

E
Yes that’s correct. The frequency is fixed at about 2.2Hz.
 

Thread Starter

electrophile

Joined Aug 30, 2013
167
I like @dupaweza ’s circuit, but if you have a continuous squarewave output, the this would also work.
The device is a comparator. if you are interefacing to 3.3V or 5V logic use an open collector (or drain) comparator such as LM339/LM393. If it’s a microcontroller, it may already have a pull-up resistor.
Choose R and C for a time constant about 10 times the slowest time between two pulses.
Ok I do have a LM339 but in SMD form. let me try though.
 
Top