On Wednesday 06 May 2020 04:41:17 John Dammeyer wrote:

> 1000 PPR encoder turning 300 RPS (18000 RPM) will produce 300,000 Hz
> output.  At 10000 RPM it's 167 RPS or 167Khz.
>
> I've been reading through the LinuxCNC source code for the last hour
> or two.  If one was just using a parallel port and not sophisticated
> external hardware the hal_parport.c code looks like it reads the input
> at the base_period rate; say 25kHz => 40 uS.
>
> If you figure a standard mill running max 3000 RPM (50 RPS) then a you
> probably need to look at the spindle encoder at least twice per
> encoder period.  At 25kHz we're seeing a ParPort task run time of 40
> uS.  So I'd guess the max pulse size from the spindle encoder has to
> be at least 80 uS.
>
> The spindle at 50 RPS uses up 20mS.  Divide that by the 80uS implies
> the largest usable encoder is 250 lines.
>
> Have I got that right?  I've not found the spindle support code yet. 
> Only the HAL install code.
>
> John

Neither have I John. But I've made it a rule of thumb in my builds, that 
the instant I thought of a spindle encoder, my thoughts just assumed 
that it would be read by external hardware if for no other reason but to 
remove that 1 kilohertz servo sample rate with its propensity for 
missing the higher speed events, from the equation.  I have given base 
thread rates down to 27 u-secs on the D-525-MW boards and simply did not 
get the desired results on either machine until I put a 5i25 Superport 
in the pci slot.  With a 50 megacycle sample clock, it doesn't miss a 
lick.

Low counts from the encoder finally got the best of me on the G0704 so 
although I was proud of the disk and photo-interrupter with 268 slots 
I'd made for it, I bought a 1000 line differential output omron encoder 
from fleabay for a $21 bill, made and installed an extension shaft to 
drive it on the rear of the motor and installed it there, but left the 
index signal from the spindle intact.  Wrote some hal code to measure 
the counts, and put tally switches on the gearshift knob to tell hal 
which gear it was in.

That 1000 line encoder had to have a pair of $2.00 rs485 transceivers 
wired as rx only to make a single ended ttl signal out of it that was 
actually rail to rail.  Worked up to about 300 rpms and found the opto's 
in the sainsmart bob were way too slow, so I bypassed them, works great. 
Where before, the 268 count encoders quantization noise was banging on 
the motor hard enough it sounded like every bearing in the head was 
square and well on its way out, now it runs dead silent up until when 
rigid tapping with a 5/16 or bigger tap that works the motor too hard 
and I hear the iron in the motor squeak as the 17 amp current limit 
setting in the pwm-servo amplifier kicks in.

That 704's head gears are plastic, and I've no clue why I haven't 
stripped them doing rigid tapping with it, but I haven't yet.  That 
spindle, originally a 2250 rpm fwd, 1100 reverse, now with Jon's 
pwm-servo driver and a shop made psu good for 125 volts and a 20 amp 
surge, now turns 3000 revs in either direction. The effective encoder 
count/scale changes with the gear shift of coarse but that just more hal 
modules to fix.

The scale in high gear is a bit over 7000 counts per spindle rev, and is 
a bit over 14,000 in low gear.  So at 1500 revs in low gear, its about 
14150 counts per rev, so (1500 * 14150)/60=353750 cps into that 5i25 
cards A/B inputs, and hasn't missed a lick yet. My optical disk for an 
index came loose and ate the opticals up so there is now an ats667 
reading a screw glued to the side of the drawbar cap for an index 
generator. 

Since the gears are plastic and not molded for easy gear shifting, I took 
advantage of the tally switches and swapped the mux2 that changes the 
scale for a mux4, and did a setp for about 15 revs at the motor to the 
unused inputs, so when between gears its turning slowly and the gear 
shift is without the drama of grabbing the spindle and manually 
re-engaging the gears by hand.  And the control response is fast enough 
I can change gears while its running wide open.

I have since run out of i/o on that machine, so that 5i25 is now driving 
a 7i76D on P3, but the machine runs the same.

And I am still convinced the bare parport is a bad idea. But its a piece 
of cake for the 5i25.
>
> > -----Original Message-----
> > From: andrew beck [mailto:andrewbeck0...@gmail.com]
> > Sent: May-06-20 12:31 AM
> > To: Enhanced Machine Controller (EMC)
> > Subject: Re: [Emc-users] Fluctuating RPM using CUI ATM 10 encoder
> >
> > John while we are on this subject got a quick question.  Just want
> > to check my maths.
> >
> > My encoder card on vfd max count rate is 300Khz.  Max rpm is
> > 10000rpm
> >
> > So a 1000 ppr encoder should give me 18000 rpm at 300khz.  I just
> > need 10000 rpm so that should be well within spec
> >
> > Regards
> >
> > Andrew
> >
> > On Wed, May 6, 2020, 6:45 PM John Dammeyer <jo...@autoartisans.com> 
wrote:
> > > > -----Original Message-----
> > > > From: Nicklas Karlsson [mailto:nicklas.karlsso...@gmail.com]
> > > > Sent: May-05-20 9:13 PM
> > > > To: Enhanced Machine Controller (EMC)
> > > > Subject: Re: [Emc-users] Fluctuating RPM using CUI ATM 10
> > > > encoder
> > > >
> > > > > Do you have a dual trace 'scope?  Spin the spindle and look at
> > > > > the
> > >
> > > input
> > >
> > > > > and output of the opto-isolator.  See if there really is a
> > > > > lag.   If
> > >
> > > you
> > >
> > > > > have a new scope would you have it capture the screen and post
> > > > > it.
> > >
> > >  I'm
> > >
> > > > > really skeptical that those isolators are THAT bad.
> > > > >
> > > > > Here is the datasheet for the opto.
> > > > > https://www.mouser.com/datasheet/2/143/EL817-G-26528.pdf
> > > > > They claim an 18 uS rise and fall time.    A 1KHz square wave
> > > > > will
> > >
> > > have a
> > >
> > > > > 1000 uS period and a 500 uS pulse width at 2 KHz the pulse
> > > > > width is
> > >
> > > still
> > >
> > > > > more than 10X the raise time of the opto.    But maybe the
> > > > > opto is a
> > >
> > > fake
> > >
> > > > > counterfeit part with very poor performance.
> > > >
> > > > Opto couplers are rather slow. With a high resolution encoder
> > > > frequency
> > >
> > > could be maybe up to a few hundred kHz,
> > >
> > > > 2000*period/revolution*3600rpm=120000period/second=120kHz,
> > > > 200PPR will
> > >
> > > be 12kHz at 3600rpm, 1/(2*18�s) = about 27778Hz =
> > >
> > > > about a little bit below 28kHz if mad no misstake.
> > >
> > > I think your math is out.  Most of the hi res encoders are running
> > > 2500 lines per rev.  Many are less.    But we're only looking at
> > > one encoder channel and that works out to twice the number of
> > > edges but the actual frequency is still lines per rev per second.
> > >
> > > So how many revs per second is that?    You have to divide RPM by
> > > 60 to get revs per second so 3600 RPM is 60 RPS.
> > >
> > > Now you have 60 * 2500 Hz = 150kHz.  Still way too high for that
> > > opto-isolator.
> > >
> > > Now if you do like Sam did for his hex milling you update the
> > > encoder. But initially he was milling with about 60 teeth and
> > > Linux is more than fine for that when power tapping etc.  So 60 *
> > > 60 is 3600 Hz and the opto would be fine for that.    Even 200
> > > lines at 60 rps  (3600 RPM) is 12,000 hz.
> > >
> > > Don't understand how you got 27778Hz
> > >
> > > John
> > >

Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
Genes Web page <http://geneslinuxbox.net:6309/gene>


_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to