On Tuesday 17 December 2013 18:55:04 John Alexander Stewart did opine:
> Hello all;
>
> 2014 sees me finishing up my lathe conversion to CNC. (Emco Compact-8).
>
> I'm a bit "confused" about spindle sensors, and I do see a few different
> designs.
>
> Question - if you had to do it again, what would YOU do for a modern
> spindle encoder?
>
> (trying to learn from those who have gone before me, wish me luck!)
>
> PS - I'm tempted to just go for the CNC4PC Index Pulse Card, but maybe
> there are better alternatives out there.
>
> Thanks;
> John A. Stewart.
John: You need finer grained control than an index generator will ever
allow if you ever intend to use the G33.1 or G76 thread cutting on the
lathe, and once I had that working, I don't know why I ever considered not
doing it. How big is the back end of the enco spindle? It can't be a
whole lot bigger than any of the 7x models. I have the code to carve a 50
slot, 200 'edge' wheel with index to fit my 7x, and it wouldn't take long
to edit to change the size of the center spindle hole a wee bit to make it
fit the enco. That encoder's pix is at the
lathe-stf/lathe-pix/Spindle-encoder-final.JPG
link off my web page in the sig. I can dig up the code that carved that
wheel, and the pcb above it, with the caveat that the pots you see in that
pix, which fine tune the britness of the led's in the interruptors, are an
after the make fix, smoothing the noise in the encoders velocity output
considerably, if you would like to follow that path.
Along that same vein, I love CNC4PC's C1G interface, but do not recommend
CNC4PC's C41 spindle controller, its too slow, some non-linear, and needs
mods to make it faster, lots faster when you are using LCNC to control the
spindle speed in real time. Had I any clue to the rocks in the path to
make that work well, I would have just bought a PMDX-106 in the first
place. I have one of those on my toy milling machine but not under servo
control, just open loop, which works great, but of course I can't do rigid
tapping very handily with that.
I don't know if the listserver will pass the gcode for the encoder wheel or
not, but its attached. 10.4K.
Cheers, Gene
--
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>
Blend until smooth.
A pen in the hand of this president is far more
dangerous than 200 million guns in the hands of
law-abiding citizens.
( spindle-encoder.ngc )
( by Lawrence Glaister VE7IT )
( Sept 15 2007 )
( lerman - thankyou for named variables and owords.... very cool )
( Cut from arborite stock with 0.049" endmill. )
( This encoder ring mounts on the lathe spindle drive pulley. )
( Ring encoder provides A,B,Z phases using 3 H21TLB slot sensors. )
( The H21TLB sensor use 5v and can directly drive parallel port pins. )
( The sensor apeture is 0.035", so I used double that for the slot length )
( to allow for some runout on mounting the ring. )
( The main constraint is that the main track opto has to be able to physically )
( read the inner track... reaching over the outer index track )
( To preview what it will look like, set _endmill_dia = 0.0 below. )
( With a high speed spindle you may be able to cut to depth in 1 pass. )
( Edited to make a much smaller wheel with fewer slots by Gene Heskett )
(======================================================================)
(============================= Subroutines ============================)
( cuts a circle at request diameter around x,y to requested depth )
o100 sub
(Subroutine to do a circle)
( P1=X center P2=Y center P3-diameter P4=depth P5=feedrate )
g0 z#<_safe_Z>
g0 x[#1-[#3* 0.5]] y#2
g0 z#4
g2 F[#5/1.5] x[#1-[#3/2]] y#2 i[#3/2] j0
g0 z#<_safe_Z>
o100 endsub
(======================================================================)
(=================== Define Constants/Variables =======================)
#<_restartZ> = -0.0210
#<_endmill_dia> = 0.03125 ( endmill diameter )
#<_endmill_rad> = [#<_endmill_dia> * 0.50] ( endmill radius )
#<_duty_cycle> = .30 ( adjust for 50% at output )
#<_safe_Z> = 0.050 ( safe Z height )
#<_zstart> = 0.0015 (run down to there fast, then ramp into slot)
#<_feedrate> = 2.7 ( cutting feedrate )
S2500 (spindle speed)
( define characteristics of encoder and index tracks )
#<_main_track_dia> = 2.2765 ( diameter of main signal track )
#<_index_track_dia> = [#<_main_track_dia> - 0.155] ( diameter of index track )
( May 30, 14:14 GH fix this to compensate for bit radii, needs 1.044 ID hole )
#<_inside_cutout> = [1.0500 - #<_endmill_dia>] ( diameter of interior cutout = inside of pulley)
#<_outside_cutout> = 2.431 ( diameter of exterior cutout ~= enough space for tracks)
(#<_encoder_cycles> = 39) ( number of slots to cut * 4 == 156 edges or about 2.30769230769 degree resolution)
#<_encoder_cycles> = 50
#<_slotlen> = 0.100 ( finished slot length for 1 encoder element ~= sensor aperture + runout )
( define 3 params for the mounting arrangement )
#<_mount_circle> = 1.650 ( mounting bolt circle diameter )
#<_mount_holes> = 6 ( number of holes to mill for mounting bolts )
#<_mount_hdia> = 0.130 ( sloppy #6 or a #8 bolt )
#<_PI> = 3.14159265359 (more decimal places can't hurt GH)
#<_encoder_theta>=[360.0/#<_encoder_cycles>] ( angular step around circle )
(======================================================================)
(========================= Start of Main Code =========================)
G20 G90 G49 G54
G64 P.02
g00z#<_safe_Z>
G0 X0 Y0
M06 T9 ( 0.0400 drill )
G54 (tedautoz will put in G55, cancel it )
m0(DEBUG,spindle_encoder.ngc: #<_encoder_cycles> cycle disk uses #<_endmill_dia> dia endmill, material top,center at 0,0,0 ... unpause[S] when ready)
M03 (start spindle)
( ==========show outer circle on display if not a restart========== )
o101 if [#<_restartZ> gt -0.001 ]
o100 call [0.0] [0.0] [#<_outside_cutout>+#<_endmill_rad>] [#<_safe_Z>] [50.0]
o101 endif
(=====================================================================)
(=======================cut the main encoder slots====================)
( compute angular size of cutter at cutting extremes )
#<_inner_dia> = [#<_main_track_dia> - #<_slotlen> + #<_endmill_rad>]
#<_outer_dia> = [#<_main_track_dia> + #<_slotlen> - #<_endmill_rad>]
#<_icutter_deg> = [[#<_endmill_rad>*360.0/[#<_inner_dia>*#<_PI>]] + 0.995000] ( make global! )
#<_ocutter_deg> = [[#<_endmill_rad>*360.0/[#<_outer_dia>*#<_PI>]] + 0.995000] ( ditto )
#<_icutter_bakup> = #<_icutter_deg> ( save for restoration inside the loop )
#<_ocutter_bakup> = #<_ocutter_deg> ( ditto )
( split in half, we'll cut both sides of the slot )
#<_slot_deg> = [#<_encoder_theta>*#<_duty_cycle> ]
(debug, slot width is #<_slot_deg>)
#<_slots> = #<_encoder_cycles> ( counter for cutting this many slots )
( check to see if we can machine mounting holes )
o7 if [ #<_mount_hdia> LE #<_endmill_dia> ]
(print,Unable to machine mounting holes as #<_endmill_dia> endmill is too big to cut #<_mount_hdia> dia holes )
(DEBUG,Unable to machine mounting holes as #<_endmill_dia> endmill is too big to cut #<_mount_hdia> dia holes )
m2
o7 endif
( setup for main loop depth repeats )
#<_ztmp> = 0.000
o102 if [#<_restartZ> lt 0.000]
#<_ztmp> = #<_restartZ>
o102 endif
#<_zend> = -0.034
#<_zinc> = [#<_zend> / 31.000] ( should give < 2.5 thou )
( main loop to cut encoder slots around disk )
o300 while [#<_ztmp> gt #<_zend>]
#<_angle> = 360
#<_ztmp> = [#<_ztmp> + #<_zinc>]
#<_slots> = #<_encoder_cycles>
( main loop to cut encoder slots )
o10 do
#<_centerx> = [#<_main_track_dia> * 0.50 * cos[#<_angle>]] ( x center of slot )
#<_centery> = [#<_main_track_dia> * 0.50 * sin[#<_angle>]] ( y center of slot )
g0 z#<_safe_Z>
g0 x[#<_centerx>] y[#<_centery>]
( do a cut to the final depth at the cw inner corner of the slot )
#<myangle> = [#<_angle> - [#<_slot_deg> * #<_duty_cycle>] + [#<_icutter_deg> * #<_duty_cycle>]]
(debug, myangle for descent to depth is now #<myangle>)
#<myx> = [#<_inner_dia> * 0.50 * cos[#<myangle>]]
#<myy> = [#<_inner_dia> * 0.50 * sin[#<myangle>]]
( goto old depth )
g0 z[#<_ztmp> - #<_zinc>]
( cut to new depth at CW inside corner )
g1 x[#<myx>] y[#<myy>] z[#<_ztmp>] f[#<_feedrate>] ( decend to cut depth )
( calculate new angle for CCW end of inside slot )
#<myangle> = [#<_angle> + [#<_slot_deg> * #<_duty_cycle>] - [#<_icutter_deg> * #<_duty_cycle>]]
(debug, myangle for inside, CCW end of slot is now #<myangle>)
#<myx> = [#<_inner_dia> * 0.50 * cos[#<myangle>]]
#<myy> = [#<_inner_dia> * 0.50 * sin[#<myangle>]]
#<myr> = SQRT[#<myx>*#<myx> + #<myy>*#<myy>]
( calculate worthless corner curve for inside end of slot )
g3 x[#<myx>] y[#<myy>] r[#<myr>] f[#<_feedrate>] ( cut inside edge of slot )
#<myangle> = [#<_angle> + [#<_slot_deg>*#<_duty_cycle>] - [#<_ocutter_deg>*#<_duty_cycle>]]
(debug, CCW end of inside slot is now #<myangle>)
#<myx> = [#<_outer_dia> * 0.50 * cos[#<myangle>]]
#<myy> = [#<_outer_dia> * 0.50 * sin[#<myangle>]]
g1 x[#<myx>] y[#<myy>] ( cut ccw edge of slot )
#<myangle> = [#<_angle> - [#<_slot_deg>*#<_duty_cycle>] + [#<_ocutter_deg>*#<_duty_cycle>]]
(debug, myangle for outside end of slot is now #<myangle>)
#<myx> = [#<_outer_dia> * 0.50 * cos[#<myangle>]]
#<myy> = [#<_outer_dia> * 0.50 * sin[#<myangle>]]
#<myr> = SQRT[#<myx>*#<myx> + #<myy>*#<myy>]
g2 x[#<myx>] y[#<myy>] r[#<myr>] ( cut outer edge of slot )
#<myangle> = [#<_angle> - [#<_slot_deg>*#<_duty_cycle>] + [#<_icutter_deg>*#<_duty_cycle>]]
(debug, myangle for run back to inner end of slot is now #<myangle>)
#<myx> = [#<_inner_dia> * 0.50 * cos[#<myangle>]]
#<myy> = [#<_inner_dia> * 0.50 * sin[#<myangle>]]
g1 x[#<myx>] y[#<myy>] ( cut back to inner cw point of slot )
g0 z#<_safe_Z>
#<_slots> = [#<_slots> -1]
#<_angle> = [#<_angle> - #<_encoder_theta>]
o10 while [#<_slots> GT 0]
( cutout index hole)
( compute angular size of cutter at cutting extremes )
#<_inner_dia> = [#<_index_track_dia> - #<_slotlen> + #<_endmill_rad>]
#<_outer_dia> = [#<_index_track_dia> + #<_slotlen> - #<_endmill_rad>]
#<_angle> = 0 ( s/b but make sure starting angle to cut )
#<_centerx> = [#<_index_track_dia> * 0.50 * cos[#<_angle>]] ( x center of slot )
#<_centery> = [#<_index_track_dia> * 0.50 * sin[#<_angle>]] ( y center of slot )
g0 z#<_safe_Z>
g0 x[#<_centerx>] y[#<_centery>] (good cut)
( do a cut to the final depth at the cw inner corner of the slot )
#<_myangle> = -0.04
#<myx> = [#<_inner_dia> * 0.50 * cos[#<_myangle>]]
#<myy> = [#<_inner_dia> * 0.50 * sin[#<_myangle>]]
g0 z[#<_ztmp> - #<_zinc>] (good cut)
g1 x[#<myx>] y[#<myy>] z[#<_ztmp>] f[#<_feedrate>] ( decend to cut depth at CW inside corner )
( GOOD CUT to CW inside corner )
#<_myangle> = 0.04
#<myx> = [#<_inner_dia> * 0.5 * cos[#<_myangle>]]
#<myy> = [#<_inner_dia> * 0.5 * sin[#<_myangle>]]
g1 x[#<myx>] y[#<myy>] f[#<_feedrate>] ( cut inside end of slot to CCW of inside corner )
(GOOD CUT to CCW inside corner)
#<_myangle> = 0.04
#<myx> = [#<_outer_dia> * 0.5 * cos[#<_myangle>]]
#<myy> = [#<_outer_dia> * 0.5 * sin[#<_myangle>]]
g1 x[#<myx>] y[#<myy>] ( cut ccw edge of slot to outside end )
( GOOD CUT to outside CCW corner )
#<_myangle> = -0.04
( T'was wrong angle, not the global one above )
#<myx> = [#<_outer_dia> * 0.5 * cos[#<_myangle>]]
#<myy> = [#<_outer_dia> * 0.5 * sin[#<_myangle>]]
g1 x[#<myx>] y[#<myy>] ( cut outer end of slot )
#<myx> = [#<_inner_dia> * 0.5 * cos[#<_myangle>]]
#<myy> = [#<_inner_dia> * 0.5 * sin[#<_myangle>]]
g1 x[#<myx>] y[#<myy>] ( cut back to inner cw point of slot )
g0 z#<_safe_Z>
( mill some mounting bolt holes )
#<_holes> = #<_mount_holes>
#<myangle> = 0 ( note, this is NOT global )
o20 do
#<myx> = [#<_mount_circle> * 0.5 * cos[#<myangle>]]
#<myy> = [#<_mount_circle> * 0.5 * sin[#<myangle>]]
( X ) ( Y ) ( Diameter ) ( Depth ) ( Feed )
o100 call [#<myx>] [#<myy>] [#<_mount_hdia>-#<_endmill_dia>] [#<_ztmp>] [#<_feedrate>] ( one mounting hole )
#<myangle> = [#<myangle> + [ 360.0 / #<_mount_holes>] ]
#<_holes> = [#<_holes> -1]
o20 while [ #<_holes> GT 0 ]
( cutout encoder ring interior )
( X ) ( Y ) ( Diameter ) ( Depth ) ( Feed )
o100 call [0.0] [0.0] [#<_inside_cutout>] [#<_ztmp>] [#<_feedrate>] ( interior cutout )
( restore screwed up stuff for next pass!)
#<_inner_dia> = [#<_main_track_dia> - #<_slotlen> + #<_endmill_rad>]
#<_outer_dia> = [#<_main_track_dia> + #<_slotlen> - #<_endmill_rad>]
o300 endwhile
(reset for outer ring cutout )
#<_ztmp> = 0.00
o400 while [#<_ztmp> gt #<_zend>]
#<_ztmp> = [#<_ztmp> + #<_zinc>]
o100 call [0.0] [0.0] [#<_outside_cutout> + #<_endmill_rad>] [#<_ztmp>] [#<_feedrate>] ( exterior cutout )
o400 endwhile
G49 ( cancel g43.1 TLO that tedautoz.ngc installs )
M5
M2
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users