Welcome! Log In Create A New Profile

Advanced

Quadrature Decoding

Posted by Annirak 
Quadrature Decoding
January 23, 2009 12:24PM
I spent some time last night thinking about quadrature decoding. I worked out a circuit which does it using two D flipflops, 3 XOR gates, two Schmitt trigger NOR's, and a quad two-input multiplexer.

This gives a clock pulse on every transition, using different pins for up pulses and down pulses. Is this something which is useful for RepRap?

The part count (5 ICs)is a little ridiculous, which is why I would implement something like this in a PLD. Either an SPLD (20V8, 22V10) or a CPLD (XC9500XL) would work. For the $1.07, that it costs, I'd go for the XC9536XL which provides the option of adding more logic. I think it should even be possible to program the CPLD through JTAG using the SPI port of the controller.

Should I write the code and/or post schematics, or is this something we don't even need?
Re: Quadrature Decoding
January 23, 2009 01:31PM
I use quadrature output from the magnetic rotary encoder board to control my extruder, and I just wire it directly to two pins on my Arduino.

Of course, it's already a pretty clean signal, as it's produced by a micro in the first place. The Schmitt triggers in your setup might be useful for cleaning up opto outputs on a home built optical wheel, but I haven't tried that yet. I did use the guts from an opto-mechanical mouse wheel encoder originally, but it wasn't very sound mechanically (too much CAPA involved), so I switched to the magnetic encoder.

Right now the code I'm using is interrupt driven on the quadrature side, so a noisy signal could slow things down, but I don't think I'm seeing that yet. I didn't write the code though, so I probably don't know as much about it as I think I do; is there an advantage to doing the decoding with hardware? Either way it's two pins on the micro, which was my main concern.

Wade
Re: Quadrature Decoding
January 23, 2009 01:32PM
It's only about 20 lines of C, including debouncing, so a hardware solution is only necessary if you have a very fast shaft, or lots of them.


[www.hydraraptor.blogspot.com]
Re: Quadrature Decoding
January 23, 2009 01:55PM
Thanks, nophead. That's all I needed to know. I'll let that one drop and focus on something more useful to occupy myself.
Re: Quadrature Decoding
January 31, 2009 06:53AM
Annirak

I am interested in your design. This is part of a subject I have been working on very slowly as a back ground task (in my head) for a while. The foreground being mostly retraining and getting a functioning Darwin built

I agree with the sentiment that as an item for what we currently have (Darwin)it would have perhaps limted value.

As a potential component for where we might go to next though I think it has great relevance.

There are some of us who are putting some design effort/thought into alternative actuator models for potential future machinery.

The hardware quadrature input would be of great importance/relevance to a hardware solution for an entirely digital mostly hardware servo controller.

Something that would be eminently suited to CPLD based development. Perhaps with a SPI interface...........

I am happy to talk about this further if you would like to.

Cheers

aka47


Necessity hopefully becomes the absentee parent of successfully invented children.
Re: Quadrature Decoding
January 31, 2009 11:48AM
Hi Andy,
This is the core of it. Actually connecting it to a counter, etc. isn't so bad. The CPLD code, likewise, would be pretty easy to handle.

Let me know what you think!

Brendan
Sorry, only registered users may post in this forum.

Click here to login