M
Mark Haase
Guest
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:
http://rocky.digikey.com/WebLib/Texas%20Instruments/Web%20data/CD74HC4049
,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
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:
http://rocky.digikey.com/WebLib/Texas%20Instruments/Web%20data/CD74HC4049
,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
Mark
--
|\/| /| |2 |<
mehaase(at)sas(dot)upenn(dot)edu