quadrature encoders
JTC
Posts: 60
To anyone. I am new to the propeller and am trying to decide if it is the chip I want to use.
Has anyone used a quadrature encoder to read the feedback from a servo motor ?
The encoder is a 250cpr and will be used as a Z axis CNC plasma table.
What kind of speeds will the propeller chip read ?
Thank You
Jim
Has anyone used a quadrature encoder to read the feedback from a servo motor ?
The encoder is a 250cpr and will be used as a Z axis CNC plasma table.
What kind of speeds will the propeller chip read ?
Thank You
Jim
Comments
·
Jeff Martin has worked out a very nice object that will support up to 16 rotary encoders.· I have attached the file, and derived·some·of the·formulas
from the document that allows you to calculate the number of 'clock cycles' and maximum RPM the encoder·can operate.
·
Total Cycles = 144 + 50*(Number of Encoders-1)
·
RPM of Highest Resolution Encoder = XINFreq * PLLMultiplier / Total Cycles / 2 / MaxEncPulsesPerRevolution * 60
·
·
Example 1: Using a 4 MHz crystal, 8x internal multiplier, 16 encoders where the highest resolution encoders is·250 pulses per revolution:
·········· Max RPM = 4,000,000 * 8 / 894 / 2 /·250 * 60 = 4,295 RPM
Example 2: Using same example above, but with only 2 encoders of·250 pulses per revolution:
·········· Max RPM = 4,000,000 * 8 / 194 / 2 /·250 * 60 = 19,793 RPM
·
Example 3: Same as Example 1 above except a 5MHz crystal is used with a PLL value of x16·:
·········· Max RPM = 5,000,000 *·16 / 894 / 2 /·250 * 60 = 10,738 RPM
Example 4: Same as Example·2 above except a 5MHz crystal is used with a PLL value of x16 :
·········· Max RPM = 5,000,000 *·16 / 194 / 2 /·250 * 60 =·49,484 RPM
·
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 11/22/2006 6:25:22 PM GMT
I guess I need to invest in the propeller development kit .
Thanks
Thanks for your help.
Jim
If a separate cog counts each axis, i.e. X, Y, Z...why the increasing overhead for software as cogs (encoders) are added?· Can't each cog dump the results into shared memory independent of the others?
I am new to Propeller.· Board is on order.· Fascinating chip!·
Richard in Michigan.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Richard in Michigan
I have built my first 3-axis timber router and having a ball with it, a friend used a similiar machine to rout a PCB for a Prop development board, I have just finished getting it setup, ran the obligatory flashing LED program's today.
The intention is to use a Prop for the brains of my next machine, with the features I mentioned, and maybe a nice LCD display to Woo onlookers...
Cheers.
Russell.
·
The stepper motor idea is a good one. I had thought something similar but didn't feel I am up to the programming that needs to be done. It is coming... just need to spend a bit more time expermiting with it.
I do have my first product about 90% done and·my customer is pleased with the results so far.
I·use a 5 inch color video monitor instead of the LCD. I bought the LCD but it is so easy to use video I used it. You can get a game video flat screen at Marlin P. Jones online for about $50.00 makes programming more enjoyable for sure.
Jim
I have used a variation of the QuadratureEncoder routine up to it's limit.
A 4096 ppr encoder will clobber it, but 250 ppr on a single cog is not an issue.
I have a single Cog reading Position, velocity and acceleration on 4 axises
and with 4096 ppr encoders, the cog is asking for more to do.
This chip is fantastic:
http://forums.parallax.com/forums/default.aspx?f=25&m=181024
Scott
Is the sky the limit, or is 30k rpm at 4096 counts per revolution (2.048 MHz) beyond necessary? Just how much is needed to put things well in the black for an advanced project of yours? And for how many concurrent channels, ideally?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chip Gracey
Parallax, Inc.
Hope you and fam are all well.
A typical small/medium size PLC has 2 to 4 high speed encoder inputs.
Normally the first 4 or 8 inputs are dedicated to high speed pulse counting in either single
or quadrature input mode..( A + B phase + optional Zero marker for cntr reset )
Typical input frqs are in the 100KHZ for most small/medium type plcs's .
Special input cards that cost megabucks will count around the 1-2MHZ not aware of all
the ins and out of all the brands .. sure somebody can add to my details.
Once you start looking at Motion Controllers ..ie feedback for positioning loops for feedback..
pule rates are a little higher .. some controllers can capture up to 10MHZ easily ( dedicated hardwarre)
with associated loop update times of 50 to 100 micro_secs typcially etc etc... (PID loops for positioning)
Cheers
Ronald Nollet Australia
than the current chip has.
An external decoder IC might be necessary if we start using rail mounted
Heidenhain encoders.
Scott
I haven't got to the ASM part of the Prop yet, but assuming that assembler is around 100 times faster, it should be able to do 1 MHz edge rate. Perhaps someone could put together an ASM piece of code to test it? Or wait a week until I have done it myself.
See my post "Code Decodes Encoder" for a description and a piece of Spin code.
Post Edited (TChapman) : 3/27/2007 9:03:43 PM GMT
It is written for the incremental encoder type. And can handle lots of them.
The term Grey Coded is being used in the functional description and that is what misled me. Gray Code is usually reserved for absolute encoders having the typical "straddling" pattern and usually something like eight - twenty tracks that are read in parallel.
The term Grey Coded is correct, though, (what else did you expect frpm Prop guys?) in the sense that only one bit position changes at a time.
The technique used is xoring to detect edges and then checking bits to see if it is a forward or backwards movement. The usual and/or chain is avoided - which is very good.
My version does it a little different. I shift "old pattern" left twice and add "new pattern" to get a number ranging from $0 to $F. I then use the number to look up the increment in a table containing 0 (no movement), +1 (fwd) and -1 (bwd) to add to the ctr. It will be very interesting to compare speeds between the two versions. But, as I said, I have to get warm using assembler before I can do that. Anyone else?
Actually because I needed speed it made more sense for the encoder code to be inline with my assembly, in those cases you can probably do better than the object anyway because you don't have to deal with hub ram.
Are you wondering about encoder read mode for the counters in Prop MkII Chip?
Graham
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chip Gracey
Parallax, Inc.
I am trying to get a working code in asm, but I need some experience with the Prop asm before i can do it effieciently. I guess that you could do it in a few minutes - please show us.
Regarding what is needed in terms of resolution and speed, there's a lot of exageration. I do a lot of paper machine drive work. The accuracy needed there is nowadays around 0.005 % in the speed loop. That can be achieved with a 500 PPR encoder (although the standard seems to be 1024 PPR nowadays) and some smart coding using reciprocal measurement over a limited time. Usually between 1 and 5 milliseconds. Motors seldom run faster than 2000 RPM in such applications.
On the other hand, a machine-tool servo may need a 4096 PPR encoder, or better. Motors reach up to 10 kRPM, so I think that is where you need to be. If using a linear encoder with 1 microns resolution and a maximum speed around 1 m/s you arrive at 4 000 000 edges/second. That would be a possibility, I think, with the 4xOLD+New technique. Boy, do I want to test it in the Prop!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Jeff Martin
· Sr. Software Engineer
· Parallax, Inc.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Richard in Michigan
I actually needed some neat and fast encoder reading action so here it is attached using your idea and Chip's single long lookup table. Its just some raw code to be included into a proper object and it just does the one encoder however it works fine.
Graham
here's the main part of the code, short and sweet huh!
Jim
I've got this code reading an encoder then dividing down the pulse stream to send to a stepper motor, all so I can convert a HP printer into a Zcorp 3D printer without doing an entire printer's firmware. The propeller monitors the encoder and when it sees the high frequency of a paper feed it goes into sync mode, its lind of spooky.
Graham
You could also use it to make 3D lenticular prints... I have a whole bunch of film!!!
Propeller holograms anyone?
Talk to Graham[noparse]:)[/noparse]
Rich
It took me some time to understand what you did to my algorithm. It was the sign part that I had to think about. Neat!
Now, how fast can it go? Anyone tested already? I have been too busy to do any real work with the Prop for a long, long time. But I will surely set up a test as soon as I get the time for it.
I have one little problem, still: The lookyup long seems to be backwards. I always have bit # 0 to the right (LSB). Does it really work when you reverse it?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
BUT at the moment it does not write the data to main memory or anything so that would add a bit more delay.
Graham
·· Have you done a speed test on you code.
Just wondering ?
Jim
Graham
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔