I am working with an inductive proximity sensor. In the ideal condition, it gives 5V as a high signal when metal is sensed and gives 0 as a low signal when metal is not in proximity. But due to electrical noise low signal is not exactly at 0. It contains noise which makes low voltage level around 0.9V. I want to make this 0.9V to exact 0V so that my microcontroller can perfectly detect 0 or 1. I have tried RC low pass filter but still noise level is the same. Any other method to remove noise from the signal?
-
\$\begingroup\$ Could you include a simple schematic of the RC low pass filter you tried? \$\endgroup\$– LundinCommented Jun 4, 2020 at 10:17
-
\$\begingroup\$ What is the "generic" type of signal from the sensor itself? Is it either 0V or 5V or, is it analog (that is, it can take any value between 0 and 5V)? I mean, from the principle of its output. Have you checked the signal with an oscilloscope, or just measured by a multimeter? \$\endgroup\$– Eric BestCommented Jun 9, 2020 at 12:36
2 Answers
(Things in italics are easy to look up)
The low pass filter is not what you want, you want to compare your voltage to some threshold (e.g. 2.5 V) and decide whether it's high or low.
A comparator does that.
Your low-pass filter is still a very good idea, because it still removes noise, and especially at the point where the signal crosses the threshold voltage, you don't want it "jumping" around, but go as smooth as possible.
In fact, wouldn't it be nicest if your sensor detect "ON" when the voltage was low before, but then crosses the say, 4 V boundary (in a rising edge), and "OFF" if was high before and then crosses the 1 V boundary (in a falling edge)? That way, the thing is even more immune to toggling around.
We call that kind of mechanism a Schmitt trigger.
-
1\$\begingroup\$ +1 Agree with everything but maybe (nitpick) instead of comparator, you should call it a buffer. Those are readily available with Schmitt trigger inputs. A comparator gives the impression of having 2 inputs when what the OP really wants it to clean up a single signal. \$\endgroup\$– Big6Commented Jun 3, 2020 at 14:50
-
2\$\begingroup\$ no, the device "output a positive voltage above a threshold, zero below" is a comparator, not a buffer. A buffer is generally more or less a device that increases drive strength. But yes, when one deals with digital signals, "buffer" is meant to apply to the "quantized" levels, and yes, the easiest way to get somewhere here is using a digital gate or buffer with Schmitt trigger inputs! \$\endgroup\$ Commented Jun 3, 2020 at 15:18
An inductive proximity switch would, in any case, have an inbuilt Schmitt trigger.
Your problem of noise on the common line would be solved by grounding the negative of the power supply.