Electronics > Beginners

Converting a messy square wave to digital?

(1/3) > >>

ryanmills:
Sensor: E2B-S08KN04-WP-C2 2M
Datasheet: http://www.ia.omron.com/data_pdf/cat/e2b_d116-e1_1_6_csm1012652.pdf

New to EE and I'm diving into new waters and could use some advice. I have an inductive proximity sensor i'm using to measure RPM's on a shaft. It's an NC NPN output. I need to run that output into a Pi or Feather GPIO with 5v or 3.3v logic. I will likely be running the output at 12 volts. My first thought was running it into an ADC but that input range only leaves a hand full of choices. And the ADC is probably overkill for a simple square wave. I could just use the output to drive a 2nd NPN or FET to switch to 5 volt but I'm not sure about smoothing the wave (and finding one that can switch at 100hz?). Looking at output square wave on the scope there is a bounce on the rise and a long fall time (captures attached). My idea now is a FET into a comparator but I'm not sure that solves the bounce.

Is the ADC the more correct choice or is there a more standard way to take that sloppy square wave and turn it into something cleaner that will place nicer with a GPIO?

T3sl4co1l:
Hysteresis comparator. :-+  LM311 for single, say.

Tim

GerryR:
Did you have a load on the output of the prox sensor?  If not put one on it and that will clean it up quite a bit.  Look at that output voltage / current capability of the sensor, and load it accordingly.  Also,  the comparator as mentioned above will square it up nicely, or a Schmitt trigger inverter / buffer  made from discrete components will do so, as well.

Zero999:
Two Schmitt trigger inverters in series will make a non-inverting Schmitt trigger buffer. A common IC which contains six inverting buffers is the 74HC14.
https://assets.nexperia.com/documents/data-sheet/74HC_HCT14.pdf

If you want to save space/cost, it comes in triple and dual surface mount packages: the 74HC3G14 and 74HC2G14
https://assets.nexperia.com/documents/data-sheet/74HC_HCT3G14.pdf
https://assets.nexperia.com/documents/data-sheet/74HC_HCT2G14.pdf

ryanmills:

--- Quote from: GerryR on December 10, 2019, 09:16:26 pm ---Did you have a load on the output of the prox sensor?  If not put one on it and that will clean it up quite a bit.  Look at that output voltage / current capability of the sensor, and load it accordingly.  Also,  the comparator as mentioned above will square it up nicely, or a Schmitt trigger inverter / buffer  made from discrete components will do so, as well.

--- End quote ---

I just threw a 1k to test, did not think about it effecting the output. When you want to drive into something like LM311 is there a more correct way to add the load?

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod