- Wheel Encoder
- Posted by Nav2u on March 27th, 2006
Hey Guys,
I have made a wheel encoder (to sense the wheel position) which gives
me a logic level output, the encoder detects the holes in a wheel and
generates a pulse every time a hole is detected. There are 6 holes in
the wheel thus 6 pulses = 1 rotation. I need to use these pulses to
determine the distance covered by the wheel, one very easy way to
implement this would be to just interrupt on every rising edge and
increment a variable by one every 6 interrupts. Are there other ways i
can do this....using a PIC16F877
Suggestion will be highly appreciated
Nav
- Posted by Robert Scott on March 27th, 2006
On 27 Mar 2006 04:51:53 -0800, "Nav2u" <navdeep2u@gmail.com> wrote:
If you are sure that your detector has no bounce (oscillations near a
transition) then the method that you described is a simple and adequate method.
But if noise is a factor, then you will have to consider either time-domain
filtering or the use of multiple detectors to generate quadrature signals that
can be decoded noise-free.
Robert Scott
Ypsilanti, Michigan
- Posted by larwe on March 27th, 2006
Nav2u wrote:
Do you REALLY mean it generates a pulse once and only once every time a
hole transits into the sensor, or do you REALLY mean that the output is
x when the sensor - a light gate, I guess - is interrupted, and ~x when
the sensor is not interrupted?
I suspect the latter, in which case you need to consider what happens
in boundary conditions (e.g. if the wheel stops with half a hole inside
the sensor).
- Posted by Jim Granville on March 27th, 2006
Nav2u wrote:
You should look to add a second optical sensor path, so you can do
full quadrature counting.
That allows you to go backwards, subtracting counts, and also the
quadrature state engines are more edge-uncertainty tolerant.
This also doubles the resolution for a given number of holes,
and if you make the holes slots (not so simple..), then you can count
also on both slot edges 
-jg
- Posted by Robert Scott on March 27th, 2006
On 27 Mar 2006 15:56:14 -0800, "Nav2u" <navdeep2u@gmail.com> wrote:
It is only a waste if you need to be doing something else with your processor
and this counting task is preventing it. I would not use a pre-scaler because
that precludes the intelligent use of software time-domain filtering, should
that become necessary. I hope your detector circuit has some hysteresis.
You mention capture mode. That may not be appropriate for this application, at
least not all by itself. You have to ask yourself what would happen if the
wheel slowed down so much that Timer 1 wrapped around between one sensor pulse
and the next.
Robert Scott
Real-Time Specialties
Robert Scott
Ypsilanti, Michigan
- Posted by Nav2u on March 27th, 2006
Thankyou 4 ur input guys....please see the following link
(http://navdeep2u.googlepages.com/wheel.jpg). My circuit is basically
an IR LED and an IR Phototransistor placed next to each other. The
Phototransistor basiclly turns on as soon as the reflected IR light
falls on the gate. Accuracy is not of much importance at the
moment...all i need to do is have some sort of feedback system.
What are my options if i were to use a PIC....If i interrupt on every
pulse i will waste a lot of processor time....Is there a way to
interrupt every 6 pulses?....page 59
(http://ww1.microchip.com/downloads/e...doc/30292c.pdf) of data
sheet talks abt capture mode operating at every 4 pulses, could this be
an option???
Thanks in advance