Remove DC bias from a square wave

ericgibbs

Joined Jan 29, 2010
21,442
hi ep,
If you had posted the datasheet yesterday, as requested, we could have seen you did not need a pulse level sensing circuit, but just a simple On/Off > High/Low comparator, it would have saved us time and effort.

E
 

Thread Starter

electrophile

Joined Aug 30, 2013
167
hi ep,
If you had posted the datasheet yesterday, as requested, we could have seen you did not need a pulse level sensing circuit, but just a simple On/Off > High/Low comparator, it would have saved us time and effort.

E
My apologies but I think I was quite clear in the title desc as well as the main text. Thanks for the assist though. Your designs did help.
 

ericgibbs

Joined Jan 29, 2010
21,442
hi ep,
Looking at some of the other members solutions, your description to them was also ambiguous.
So lets move on.

You say a fixed frequency of approx 2Hz, what parameter are you measuring with that quadrature device.?

E


BTW: The LM339 is an open collector output , so a pull up resistor to 3.3v is required, either the MCU internal or an external resistor.
 

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.
I bought a few more A1221 hall sensors and tried out your design. It works however I had to tweak down the RC values by a lot. R is 150k and C is 2.2uf. Also I misinterpreted the frequency. The no load RPM is 27rpm. This gives a frequency of 0.45Hz. The time between two pulses would be 1.1s now. Assuming a factor of 100, values of R = 2.2M and C = 10uf should have worked. However with these values it takes a few rotations of the motor before the square wave output on the opamp output shows. The values that seem to be working have an RC value of 0.33. I’m trying to understand why this is working.
 
Last edited:

Ian0

Joined Aug 7, 2020
13,132
It will take a while for the capacitors to charge up to the average level.
If it needs to start straight away, connect all the - inputs together and use the circuit with the 24k/56k resistors.
 

dupaweza

Joined Dec 10, 2020
5
Do you use Allegro's A1221? So the application from your first post is a little strange. Probably the original device has some particular requirements. Can you modify it as below? It would work with no extra components.
hall.jpg
My previous schematic should also operate with the circuit from your appnote (or needs to increase Zener voltage to 5.1V)
 

Deleted member 115935

Joined Dec 31, 1969
0
What are you trying to do with the sensor values ?

are you doing anything with the amplitude information ?

From what I can see of the data sheet on the phone, it looks like a speed / presence sensor.
hence my question about are you interested in the amplitude ?
 

ericgibbs

Joined Jan 29, 2010
21,442
hi A,
The TS does not want pulse level sensing, just conversion from +4V to 0v and +7.5V to +3.3v.
As per my earlier post.
E
hi ep,
If you had posted the datasheet yesterday, as requested, we could have seen you did not need a pulse level sensing circuit, but just a simple On/Off > High/Low comparator, it would have saved us time and effort.
E
 

Thread Starter

electrophile

Joined Aug 30, 2013
167
Do you use Allegro's A1221? So the application from your first post is a little strange. Probably the original device has some particular requirements. Can you modify it as below? It would work with no extra components.
View attachment 225087
My previous schematic should also operate with the circuit from your appnote (or needs to increase Zener voltage to 5.1V)
That’s the thing. The output pin of the sensor is not brought out (weirdly) by the motor. If that was the case then it would be very easy.
 

Thread Starter

electrophile

Joined Aug 30, 2013
167
hi A,
The TS does not want pulse level sensing, just conversion from +4V to 0v and +7.5V to +3.3v.
As per my earlier post.
E
hi ep,
If you had posted the datasheet yesterday, as requested, we could have seen you did not need a pulse level sensing circuit, but just a simple On/Off > High/Low comparator, it would have saved us time and effort.
E
Correct!
 

Thread Starter

electrophile

Joined Aug 30, 2013
167
It’s a presence
What are you trying to do with the sensor values ?

are you doing anything with the amplitude information ?

From what I can see of the data sheet on the phone, it looks like a speed / presence sensor.
hence my question about are you interested in the amplitude ?
Yes, I’ll be using it to detect position.
 

Deleted member 115935

Joined Dec 31, 1969
0
so as the object gets near / far, is it the amplitude that changes ?
 

Ian0

Joined Aug 7, 2020
13,132
If your 8V is regulated, then no need for the zener or the TL431, a resistor will be perfectly OK as I said back in post #37
 

Thread Starter

electrophile

Joined Aug 30, 2013
167
so as the object gets near / far, is it the amplitude that changes ?
No. I think these are inside the motor and as the N and S poles come near it, it latches to either low (~5.2V) or high (~7V). The hall effect sensors used are the latching kind. The idea was to convert this voltage level to something that can be interfaced directly with an MCU. This would have been really simple if the hall sensors output pin was broken out but it is not.
 

Ian0

Joined Aug 7, 2020
13,132
Since I have only one supply onboard, which is 12V, I was thinking of deriving the 8V and 5.6V using precision resistor dividers. However, this might be a better solution.
8V is your power supply for the sensors, it has to supply 12mA per sensor - a resistive divider won't cope with the change in current. I'd suggest a LP2951, which is about the most accurate voltage regulator available.
I don't quite see why it is so precious about the supply voltage (8.0V +/- 0.02V) - seems absurdly accurate for the application.
 

Attachments

Top