CMOS buffer hysteresis?

Aug 20, 2004 2 Replies

Hi all--



I'm building a drivetrain for an autonomous robot, and I bought a photointerrupter to use as part of a homebrew shaft encoder. With tweaking of the circuit, the photo interrupter outputs about .5V when the encoder disk is black, and about 4.6V when the encoder disk is white. These vales are probably OK for talking to my HC11, but I figured that to "do it right" meant using a CMOS buffer. (The exact part I bought is here:

formatting link
,4050.pdf).



I used the output of my circuit to send signals to an input compare pin on my MCU. The problem is that the CMOS buffer's output apparently oscillates rapidly, and so when the optical encoder moves forward one segment, my MCU gets dozens or hundreds of input pulses.



Without a scope I can't tell exactly what's happening, but AFAIK buffers usually have about a .5V hysteresis, true? So I guess what's happening is that the CMOS buffer is oscillating between 0 and +5V very rapidly. So my question is, how on earth should I smooth out the input signal to my MCU? The pulses I'm interested in will be at least a few MS long (the optical encoding disk has 16 segments, and the motor's output is about



120RPM). The MCU is 2Mhz, but its juggling a bunch of other tasks and there's no FPU, so I can't do the smoothing in software--unless there's a real efficient way I don't know about. (Ie. I'm familiar with FIR and IIR but they seem to be too expensive for my application).

Thanks for any hints--I don't even know the terms for which I should google



Mark


|\/| /| |2 |< mehaase(at)sas(dot)upenn(dot)edu

Try adding an RC filter to the output of the photo interrupter and change the HC4049 for something like a Schmitt Inverter (eg like an 74HC14 but perhaps there is one with the same pin out as the 4049?).

The easiest way out of the mess is to dump the 4049 and use a comparator with some hysteresis, like this: +5v>-----+-------------+----------+ | | | | | [2K] | | | [100K] +--|--[100k]--+ | | | | OPTO>----|---[10K]--+-|+\ | | | >--------+---->OUT TO HC11 +------------|-/ | | [100K] | | | GND>-----+-------------+--------------->GND You could use something like half of an LM393, and if you do, make sure you connect the inputs and outputs of the unused comparator to ground.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required