On Friday 23 August 2019 19:10:42 John Dammeyer wrote: > Progress report on the WIN-XP/MACH3 to LinuxCNC/7i92H conversion: > > With six steppers declared: > loadrt hm2_eth board_ip="192.168.1.121" config=" num_encoders=0 > num_pwmgens=0 num_stepgens=6" > > I have control of X,Y,Z and the rotary A. Additionally a step motor > instance is used as the charge pump on DB-25-17. And the last stepper > object is on the second parallel port creating the correct frequencies > to run the Bergerda 1.8kW AC Servo up to 3000 RPM. Still need to > create an adaptor board to change the TTL into RS422 before I can > actually turn the motor but that's a minor point. My Agilient > programmable waveform generator shows the motor responds nicely all > the way up to 3000 RPM. > > But not everyone has a slick AC Servo for a spindle nor a second > parallel port. A VFD like a GS-1 that I have on my South Bend Lathe > or a GS-2 that a friend has on his Bridgeport clone (run with MACH3) > doesn't take step and direction. Instead PWM and a PWM to 0-10V > signal converter is used. > > For some reason I can't convince the pncconf to create a PWM instance > with the 7i92H. Not sure why. The 7i92H is programmed with the > 7i92_C11Gx2D.pin configuration which puts a PWM out onto DB25-14. 14 > 1 IOPort PWM 0 PWM (Out) > And direction > 16 5 IOPort None > > So I can see I have to manually edit the hal file to have > num_pwmgens=1 > > But what to do next? > Unfortunately http://linuxcnc.org/docs/html/config/pncconf.html > doesn't help. At least nothing jumps out > > Instead this is my starting place. > http://linuxcnc.org/docs/html/man/man9/hostmot2.9.html#pwmgen > > Here's the hal file information for the stepper based spindle. > I need the PWM allocated to DB25-14 (pin 1 on Mesa board) and the > direction signal on DB25-16 (pin 5 on the message board) > > > # Step Gen signals/setup > The information needs to be replaced but the rest remains the same I > believe. Here's what I think I need with PWM scale declared in the > .ini file. > > # PWM Gen signals/setup > setp hm2_7i92.0.pwmgen.05.scale [SPINDLE_9]PWM_SCALE > setp hm2_7i92.0.pwmgen.05.output_type 1 > > net spindle-enable => hm2_7i92.0.pwmgen.00.enable > net spindle-vel-cmd-rps => hm2_7i92.0.pwmgen.00.value > net spindle-cw => hm2_7i92.0.gpio.005.out > > Am I missing anything? > > Specifically if the S3000 command is read in G-Code then that has to > be scaled by PWM Scale to be what? As in what should PWM Scale be if > the default PWM frequency is 20,000Hz. Should it be 6.666667 to scale > 3000 RPM to 20,000Hz? Or do we want to scale 3000 RPM down to a > percentage by multiplying by 0.0333333 > > Is it really that simple? > > Thanks > John > > > Here's the step gen spindle area. > #******************* > # SPINDLE S > #******************* > > setp pid.s.Pgain [SPINDLE_9]P > setp pid.s.Igain [SPINDLE_9]I > setp pid.s.Dgain [SPINDLE_9]D > setp pid.s.bias [SPINDLE_9]BIAS > setp pid.s.FF0 [SPINDLE_9]FF0 > setp pid.s.FF1 [SPINDLE_9]FF1 > setp pid.s.FF2 [SPINDLE_9]FF2 > setp pid.s.deadband [SPINDLE_9]DEADBAND > setp pid.s.maxoutput [SPINDLE_9]MAX_OUTPUT > setp pid.s.error-previous-target true > setp pid.s.maxerror .0005 > > net spindle-index-enable <=> pid.s.index-enable > net spindle-enable => pid.s.enable > net spindle-vel-cmd-rpm => pid.s.command > net spindle-vel-fb-rpm => pid.s.feedback > net spindle-output <= pid.s.output > > # Step Gen signals/setup > setp hm2_7i92.0.stepgen.05.dirsetup [SPINDLE_9]DIRSETUP > setp hm2_7i92.0.stepgen.05.dirhold [SPINDLE_9]DIRHOLD > setp hm2_7i92.0.stepgen.05.steplen [SPINDLE_9]STEPLEN > setp hm2_7i92.0.stepgen.05.stepspace [SPINDLE_9]STEPSPACE > setp hm2_7i92.0.stepgen.05.position-scale [SPINDLE_9]STEP_SCALE > setp hm2_7i92.0.stepgen.05.step_type 0 > setp hm2_7i92.0.stepgen.05.control-type 1 > setp hm2_7i92.0.stepgen.05.maxaccel > [SPINDLE_9]MAX_ACCELERATION setp hm2_7i92.0.stepgen.05.maxvel > [SPINDLE_9]MAX_VELOCITY > > # connection to the physical port. > net spindle-enable => hm2_7i92.0.stepgen.05.enable > net spindle-vel-cmd-rps => hm2_7i92.0.stepgen.05.velocity-cmd > net spindle-vel-fb-rps <= hm2_7i92.0.stepgen.05.velocity-fb > > # ---setup spindle control signals--- > net spindle-vel-cmd-rps <= motion.spindle-speed-out-rps > net spindle-vel-cmd-rps-abs <= motion.spindle-speed-out-rps-abs > net spindle-vel-cmd-rpm <= motion.spindle-speed-out > net spindle-vel-cmd-rpm-abs <= motion.spindle-speed-out-abs > net spindle-enable <= motion.spindle-on > net spindle-cw <= motion.spindle-forward > net spindle-ccw <= motion.spindle-reverse > net spindle-brake <= motion.spindle-brake > net spindle-revs => motion.spindle-revs > net spindle-at-speed => motion.spindle-at-speed > net spindle-vel-fb-rps => motion.spindle-speed-in > net spindle-index-enable <=> motion.spindle-index-enable > > # ---Setup spindle at speed signals--- > > sets spindle-at-speed true > > You are thinking in rpms. Think instead as average voltage assuming 10 volts will get you 3000 rpms. Then a 50% duty cycle PWM will average 5 volts, and should get you 1500 rpms. Feed that generated PWM to a mesa spinx1, complete it with a direction signal and you should be able to run a vfd over its useful range, in both directions.
Now, to cut threads, you must have an encoder on the spindle so that LCNC can know know where in the rotational cycle he spindle is. This is an ABZ (sometimes called ABI) type encoder where the signals A/B are half a cycle out of phase as the encoder can then determine which way its turning AND its position from the Z(index=0) from only one signal edge going by. If familiar with oscilloscope displays: __ __ __ _ __ __ __ =A __ __ __ _ __ __ __=B Optionally this encoder can also stabilize the spindle speed. But its not needed to make use of the G76 or G33.1 gcode commands to cut threads with a single tooth tool (see G76) or by synchronized drive of a tap in the tool holder/spindle so the tap is inserted into the hole at its TPI or TPmm, stopped, the spindle is reversed and the tap backed out of the hole at that same TPI or TPmm. This is called rigid tapping, see G33.1. BUT it also demands a crossfeed backlash only achievable with good ball screws. Or a complex hal setup to time the turn around and give the crossfeed screw drive time to make the backlash move before the spindle has rotated in reverse to start the extraction of the tap. Good ball screws are a much better investment as the .001" or so backlash takeup can be close enough to instant that it just works without programming in all the monkey motions with tricks in the .hal file. I will state that encoders with less than 1000 counts per turn aren't going to be ultimately usefull on a mill where its also stablilizing speed, but even a 240 count I am getting from hall effect sensors watching the bull gear on my old Sheldon 11x56 are usable. But they only tell lcnc which way and where they are every 1.5 degrees of rotation, they are not involved in the actual speed control here unless the spindle motor is a dc servo. VFD's are stiff enough not to need the feedback help, generally. I've some of both. I hope this helps. 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