Remove DC bias from a square wave

ericgibbs

Joined Jan 29, 2010
18,841
hi ep,
If I have understood your spec correctly.
This will give 0v thru 3.3v for a 6.2V thru 7.5v with a 4v Offset.

I have used a rising ramp voltage as at test input
E

Added:
A Step function input sim. 6.2v to 7.5v
 

Attachments

Last edited:

DickCappels

Joined Aug 21, 2008
10,169
@ScottWang 's suggestion in post #10 doesn't even need a power supply if the frequency response doesn't need to go to DC and the offset doesn't need to settle instantly.

1607612806791.png1607612806791.png

Just make R x C several times the pulse interval.
 

Thread Starter

electrophile

Joined Aug 30, 2013
167
@ScottWang 's suggestion in post #10 doesn't even need a power supply if the frequency response doesn't need to go to DC and the offset doesn't need to settle instantly.

View attachment 224554View attachment 224554

Just make R x C several times the pulse interval.
It does need to settle quickly because the motor this is integrated with will keep changing directions. The system cannot wait till the wave settles down to start reading it. Here is what I simulated in LTSpice and it takes close to 4 seconds to settle down.

Screenshot 2020-12-10 at 21.01.43.png
 

Thread Starter

electrophile

Joined Aug 30, 2013
167
hi ep,
If I have understood your spec correctly.
This will give 0v thru 3.3v for a 6.2V thru 7.5v with a 4v Offset.

I have used a rising ramp voltage as at test input
E

Added:
A Step function input sim. 6.2v to 7.5v
Thanks but thats a lot of components for 1 channel of the hall sensor. There are 8 such channels and the BOM count will be too high.
 

ericgibbs

Joined Jan 29, 2010
18,841
hi ep,
Looking at the spread of the Hall parameters in your first post indicates that one fixed OPA design will not cover the range.
You say 8 off Hall devices are going to be used, you will require some form of adjustment within each amp.

Post the datasheet.
E
 

Thread Starter

electrophile

Joined Aug 30, 2013
167
My circuit is self adjusting. 8 channels =2xLM339, 8 x C, 8 x R. 18 components total.
Right you are! Just verifying how I calculated the R and C values. The frequency is about 2.2Hz. Hence the time between two pulses is (1/2.2)/2 = 227m. Assuming the RC constant is x100 this value and C is 10uF, R = 22.7/10u = 2.2M.

Screen Shot 2020-12-11 at 10.56.13.png
 

ericgibbs

Joined Jan 29, 2010
18,841
hi ep,
If I am reading that d/s correctly, it is a quadrature output Hall device, so why do you need to measure the amplitude of the pulses.??
A simple level shifting circuit as suggested by others is all you need.

When testing have you added the recommended 340Ω before connecting the 8V supply.?

E
Clip from your d/s
 

Attachments

Last edited:

Ian0

Joined Aug 7, 2020
9,803
Right you are! Just verifying how I calculated the R and C values. The frequency is about 2.2Hz. Hence the time between two pulses is (1/2.2)/2 = 227m. Assuming the RC constant is x100 this value and C is 10uF, R = 22.7/10u = 2.2M.

View attachment 224601
I can do better still. Connect all the inverting inputs of the LM339 together, with 24k to 8V and 56k to 0V. That biases it at 5.6V midway between the maximum low voltage and the minimum high voltage.
Connect the sensors to the non-inverting inputs. Now down to 4 components for 8 inputs.
 
Last edited:

Thread Starter

electrophile

Joined Aug 30, 2013
167
hi ep,
If I am reading that d/s correctly, it is a quadrature output Hall device, so why do you need to measure the amplitude of the pulses.??
A simple level shifting circuit as suggested by others is all you need.

When testing have you added the recommended 340Ω before connecting the 8V supply.?

E
Clip from your d/s
Yes a simple level shifter is all I wanted. I wanted that signal to move between 0-3.3v so that it can be directly interfaces with the MCU.
 

Thread Starter

electrophile

Joined Aug 30, 2013
167
I can do better still. Connect all the inverting inputs of the LM339 together, with 24k to 8V and 56k to 0V. That biases it at 5.6V midway between the maximum low voltage and the minimum high voltage.
Connect the sensors to the non-inverting inputs. Now down to 4 components for 8 inputs.
Yes that should be possible but the MCU needs 2 inputs from the hall sensors as quadrature inputs. There are 4 motors each with one pair of hall sensors. Can you please let me know if my calculations on the R and C values are correct?
 
Top