5i25+7i76 Spindle and Encoder Setup

More
13 years 1 month ago #39344 by Bad_German
Hi, I've been stuck on this for a wile and cannot get the lathe spindle and encoder working correctly.

1. The spindle analogue output (0-10V) works with Sxxx M3 command but not with a M4, CCW.
The enable and direction optocoupler outputs work, I just don't get any analogue output on SPINDLE OUT pin with an M4 command.

2. I have no feedback from the encoder, it is a 360ppr + index, non-quadrature encoder which I don't know how to setup.
PNCConf has already set "setp hm2_5i25.0.encoder.00.counter-mode 1", and I can't figure out what to change, to show the speed in the PYVCP.
In halscope "spindle-vel-fb" is also always zero.

Can you please point me in the right direction, to fix these 2 problems?

My Setup:
meas 5i25+7i76
Linuxcnc 2.5.3
Spindle Control: 0-10V, direction, enable
Encoder: 5V 360ppr (channel A) + index.


Hall:
Code:
# Generated by PNCconf at Sun Sep 29 12:26:37 2013 # If you make changes to this file, they will be # overwritten when you run PNCconf again loadrt trivkins loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES loadrt probe_parport loadrt hostmot2 loadrt hm2_pci config=" num_encoders=1 num_pwmgens=0 num_3pwmgens=0 num_stepgens=2 sserial_port_0=00xxxxxx " setp hm2_5i25.0.watchdog.timeout_ns 10000000 loadrt hal_parport cfg="0x0378 out" loadrt pid names=pid.s loadrt abs names=abs.spindle loadrt lowpass names=lowpass.spindle loadrt scale names=scale.spindle addf parport.0.read servo-thread addf parport.0.write servo-thread addf hm2_5i25.0.read servo-thread addf motion-command-handler servo-thread addf motion-controller servo-thread addf pid.s.do-pid-calcs servo-thread addf abs.spindle servo-thread addf scale.spindle servo-thread addf lowpass.spindle servo-thread addf hm2_5i25.0.write servo-thread addf hm2_5i25.0.pet_watchdog servo-thread # external output signals # --- MACHINE-IS-ENABLED --- net machine-is-enabled parport.0.pin-01-out # --- COOLANT-FLOOD --- net coolant-flood parport.0.pin-09-out # external input signals # --- MIN-X --- net min-x <= hm2_5i25.0.7i76.0.0.input-00-not # --- MIN-Z --- net min-z <= hm2_5i25.0.7i76.0.0.input-01-not # --- MAX-HOME-X --- net max-home-x <= hm2_5i25.0.7i76.0.0.input-02-not # --- MAX-HOME-Z --- net max-home-z <= hm2_5i25.0.7i76.0.0.input-03-not # --- ESTOP-EXT --- net estop-ext <= parport.0.pin-15-in-not #******************* # AXIS X #******************* # Step Gen signals/setup setp hm2_5i25.0.stepgen.00.dirsetup [AXIS_0]DIRSETUP setp hm2_5i25.0.stepgen.00.dirhold [AXIS_0]DIRHOLD setp hm2_5i25.0.stepgen.00.steplen [AXIS_0]STEPLEN setp hm2_5i25.0.stepgen.00.stepspace [AXIS_0]STEPSPACE setp hm2_5i25.0.stepgen.00.position-scale [AXIS_0]STEP_SCALE setp hm2_5i25.0.stepgen.00.step_type 0 setp hm2_5i25.0.stepgen.00.control-type 0 setp hm2_5i25.0.stepgen.00.maxaccel 62.5 setp hm2_5i25.0.stepgen.00.maxvel 16.7 net x-pos-fb axis.0.motor-pos-fb <= hm2_5i25.0.stepgen.00.position-fb net x-pos-cmd axis.0.motor-pos-cmd => hm2_5i25.0.stepgen.00.position-cmd net x-enable axis.0.amp-enable-out => hm2_5i25.0.stepgen.00.enable # ---setup home / limit switch signals--- net max-home-x => axis.0.home-sw-in net min-x => axis.0.neg-lim-sw-in net max-home-x => axis.0.pos-lim-sw-in #******************* # AXIS Z #******************* # Step Gen signals/setup setp hm2_5i25.0.stepgen.01.dirsetup [AXIS_2]DIRSETUP setp hm2_5i25.0.stepgen.01.dirhold [AXIS_2]DIRHOLD setp hm2_5i25.0.stepgen.01.steplen [AXIS_2]STEPLEN setp hm2_5i25.0.stepgen.01.stepspace [AXIS_2]STEPSPACE setp hm2_5i25.0.stepgen.01.position-scale [AXIS_2]STEP_SCALE setp hm2_5i25.0.stepgen.01.step_type 0 setp hm2_5i25.0.stepgen.01.control-type 0 setp hm2_5i25.0.stepgen.01.maxaccel 62.5 setp hm2_5i25.0.stepgen.01.maxvel 16.7 net z-pos-fb axis.2.motor-pos-fb <= hm2_5i25.0.stepgen.01.position-fb net z-pos-cmd axis.2.motor-pos-cmd => hm2_5i25.0.stepgen.01.position-cmd net z-enable axis.2.amp-enable-out => hm2_5i25.0.stepgen.01.enable # ---setup home / limit switch signals--- net max-home-z => axis.2.home-sw-in net min-z => axis.2.neg-lim-sw-in net max-home-z => axis.2.pos-lim-sw-in #******************* # SPINDLE S #******************* # ---digital potentionmeter output signals/setup--- setp hm2_5i25.0.7i76.0.0.spinout-minlim [SPINDLE_9]OUTPUT_MIN_LIMIT setp hm2_5i25.0.7i76.0.0.spinout-maxlim [SPINDLE_9]OUTPUT_MAX_LIMIT setp hm2_5i25.0.7i76.0.0.spinout-scalemax [SPINDLE_9]OUTPUT_SCALE net spindle-vel-cmd => hm2_5i25.0.7i76.0.0.spinout net machine-is-enabled => hm2_5i25.0.7i76.0.0.spinena net spindle-ccw => hm2_5i25.0.7i76.0.0.spindir # ---Encoder feedback signals/setup--- setp hm2_5i25.0.encoder.00.counter-mode 1 setp hm2_5i25.0.encoder.00.filter 1 setp hm2_5i25.0.encoder.00.index-invert 0 setp hm2_5i25.0.encoder.00.index-mask 0 setp hm2_5i25.0.encoder.00.index-mask-invert 0 setp hm2_5i25.0.encoder.00.scale [SPINDLE_9]ENCODER_SCALE net spindle-revs <= hm2_5i25.0.encoder.00.position net spindle-vel-fb <= hm2_5i25.0.encoder.00.velocity net spindle-index-enable <=> hm2_5i25.0.encoder.00.index-enable # ---setup spindle control signals--- net spindle-vel-cmd-rps <= motion.spindle-speed-out-rps net spindle-vel-cmd <= motion.spindle-speed-out net spindle-on <= 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 => motion.spindle-speed-in net spindle-index-enable <=> motion.spindle-index-enable # ---Setup spindle at speed signals--- sets spindle-at-speed true # Use ACTUAL spindle velocity from spindle encoder # spindle-velocity bounces around so we filter it with lowpass # spindle-velocity is signed so we use absolute component to remove sign # ACTUAL velocity is in RPS not RPM so we scale it. setp scale.spindle.gain 60 setp lowpass.spindle.gain 1.000000 net spindle-vel-fb => lowpass.spindle.in net spindle-fb-filtered-rps lowpass.spindle.out => abs.spindle.in net spindle-fb-filtered-abs-rps abs.spindle.out => scale.spindle.in net spindle-fb-filtered-abs-rpm scale.spindle.out #****************************** # connect miscellaneous signals #****************************** # ---HALUI signals--- net joint-select-a halui.joint.0.select net x-is-homed halui.joint.0.is-homed net jog-x-pos halui.jog.0.plus net jog-x-neg halui.jog.0.minus net jog-x-analog halui.jog.0.analog net joint-select-c halui.joint.2.select net z-is-homed halui.joint.2.is-homed net jog-z-pos halui.jog.2.plus net jog-z-neg halui.jog.2.minus net jog-z-analog halui.jog.2.analog net jog-selected-pos halui.jog.selected.plus net jog-selected-neg halui.jog.selected.minus net spindle-manual-cw halui.spindle.forward net spindle-manual-ccw halui.spindle.reverse net spindle-manual-stop halui.spindle.stop net machine-is-on halui.machine.is-on net jog-speed halui.jog-speed net MDI-mode halui.mode.is-mdi # ---coolant signals--- net coolant-mist <= iocontrol.0.coolant-mist net coolant-flood <= iocontrol.0.coolant-flood # ---probe signal--- net probe-in => motion.probe-input # ---motion control signals--- net in-position <= motion.in-position net machine-is-enabled <= motion.motion-enabled # ---digital in / out signals--- # ---estop signals--- net estop-out <= iocontrol.0.user-enable-out net estop-ext => iocontrol.0.emc-enable-in # ---toolchange signals for custom tool changer--- net tool-number <= iocontrol.0.tool-prep-number net tool-change-request <= iocontrol.0.tool-change net tool-change-confirmed => iocontrol.0.tool-changed net tool-prepare-request <= iocontrol.0.tool-prepare net tool-prepare-confirmed => iocontrol.0.tool-prepared

Ini:
Code:
# Generated by PNCconf at Sun Sep 29 12:26:37 2013 # If you make changes to this file, they will be # overwritten when you run PNCconf again [EMC] MACHINE = EMCO-Turn120 DEBUG = 0 [DISPLAY] DISPLAY = axis POSITION_OFFSET = RELATIVE POSITION_FEEDBACK = ACTUAL MAX_FEED_OVERRIDE = 2.000000 MAX_SPINDLE_OVERRIDE = 1.000000 MIN_SPINDLE_OVERRIDE = 0.500000 INTRO_GRAPHIC = linuxcnc.gif INTRO_TIME = 5 PROGRAM_PREFIX = /home/stephan/linuxcnc/nc_files PYVCP = pyvcp-panel.xml INCREMENTS = 5mm 1mm .5mm .1mm .05mm .01mm .005mm LATHE = 1 POSITION_OFFSET = RELATIVE POSITION_FEEDBACK = ACTUAL DEFAULT_LINEAR_VELOCITY = 10.000000 MAX_LINEAR_VELOCITY = 13.333333 MIN_LINEAR_VELOCITY = 0.010000 DEFAULT_ANGULAR_VELOCITY = 0.250000 MAX_ANGULAR_VELOCITY = 1.000000 MIN_ANGULAR_VELOCITY = 0.010000 EDITOR = gedit GEOMETRY = xz [FILTER] PROGRAM_EXTENSION = .png,.gif,.jpg Greyscale Depth Image PROGRAM_EXTENSION = .py Python Script png = image-to-gcode gif = image-to-gcode jpg = image-to-gcode py = python [TASK] TASK = milltask CYCLE_TIME = 0.010 [RS274NGC] PARAMETER_FILE = linuxcnc.var [EMCMOT] EMCMOT = motmod COMM_TIMEOUT = 1.0 COMM_WAIT = 0.010 SERVO_PERIOD = 1000000 [HOSTMOT2] # **** This is for info only **** # DRIVER0=hm2_pci # BOARD0=5i25 [HAL] HALUI = halui HALFILE = EMCO-Turn120.hal HALFILE = custom.hal POSTGUI_HALFILE = postgui_call_list.hal SHUTDOWN = shutdown.hal [HALUI] [TRAJ] AXES = 3 COORDINATES = X Z LINEAR_UNITS = mm ANGULAR_UNITS = degree CYCLE_TIME = 0.010 DEFAULT_VELOCITY = 1.33 MAX_LINEAR_VELOCITY = 13.33 NO_FORCE_HOMING = 1 [EMCIO] EMCIO = io CYCLE_TIME = 0.100 TOOL_TABLE = tool.tbl #******************** # Axis X #******************** [AXIS_0] TYPE = LINEAR HOME = 0.0 FERROR = 0.005 MIN_FERROR = 0.0005 MAX_VELOCITY = 13.3333333333 MAX_ACCELERATION = 50.0 # these are in nanoseconds DIRSETUP = 5000 DIRHOLD = 5000 STEPLEN = 2500 STEPSPACE = 2500 STEP_SCALE = -1280.0 MIN_LIMIT = -0.2 MAX_LIMIT = 50.0 HOME_OFFSET = 0.000000 HOME_SEARCH_VEL = -6.666667 HOME_LATCH_VEL = 3.333333 HOME_FINAL_VEL = 0.333333 HOME_USE_INDEX = NO HOME_IGNORE_LIMITS = YES HOME_SEQUENCE = 1 #******************** # Axis Z #******************** [AXIS_2] TYPE = LINEAR HOME = 0.0 FERROR = 0.005 MIN_FERROR = 0.0005 MAX_VELOCITY = 13.3333333333 MAX_ACCELERATION = 50.0 # these are in nanoseconds DIRSETUP = 5000 DIRHOLD = 5000 STEPLEN = 2500 STEPSPACE = 2500 STEP_SCALE = -1280.0 MIN_LIMIT = -134.0 MAX_LIMIT = 0.2 HOME_OFFSET = 0.000000 HOME_SEARCH_VEL = 6.666667 HOME_LATCH_VEL = -3.333333 HOME_FINAL_VEL = 0.333333 HOME_USE_INDEX = NO HOME_IGNORE_LIMITS = YES HOME_SEQUENCE = 0 #******************** # Spindle #******************** [SPINDLE_9] ENCODER_SCALE = 1440.0 OUTPUT_SCALE = 2000.0 OUTPUT_MIN_LIMIT = 0.0 OUTPUT_MAX_LIMIT = 2000.0

Please Log in to join the conversation.

More
13 years 1 month ago #39346 by cmorley
I see you have set:
min output limit of the spindle to 0
max limit to 2000
ans scale to 2000

That means you can have a range of 0 to 2000.
Notice how there is no negative range - negative is reverse rotation.

set min limit to -2000

oh wait you can't have negative voltage...so don't change it
I think you need to add an abs component to make sure the voltage is always positive.

you would need to change:
loadrt abs names=abs.spindle
to:
loadrt abs names=abs.spindle,abs,spindle_output

add line
addf abs.spindle_output servo-thread
after line
addf abs.spindle servo-thread

it needs to go between:
net spindle-vel-cmd => hm2_5i25.0.7i76.0.0.spinout
so change it to:
net spindle-vel-cmd => abs.spindle_output.in
net spindle-vel-cmd-abs abs.spindle_output => hm2_5i25.0.7i76.0.0.spinout

I've not tested this but that should do it.
looking at the encoder part ....

Chris M

Please Log in to join the conversation.

More
13 years 1 month ago #39348 by cmorley
I don't see anything obviously wrong with the encoder HAL file.
Please check wiring, if the encoder is producing signals and that you are connected to encoder 0

Chris M

Please Log in to join the conversation.

More
13 years 1 month ago #39349 by PCW
Also for the encoder to work in count mode you must connect the encoder output
to the 'A' input on the 7I76 and jumper the 7I76 encoder input for TTL type signals

Its probably arguable that motion should have both a signed spindle
velocity pin (as it does now) and a unsigned spindle speed pin
(since it already has the direction signals) To avoid the common
requirement of the absolute component here.

Please Log in to join the conversation.

More
13 years 1 month ago #39367 by Bad_German
Thanks for the help guy's, you're awesome,
both parts are working now.

fixed two typos, just for future reference...
Code:
Replace: loadrt abs names=abs.spindle with: loadrt abs names=abs.spindle,abs.spindle_output add: addf abs.spindle_output servo-thread replace: net spindle-vel-cmd => hm2_5i25.0.7i76.0.0.spinout with: net spindle-vel-cmd => abs.spindle_output.in net spindle-vel-cmd-abs abs.spindle_output.out => hm2_5i25.0.7i76.0.0.spinout

Please Log in to join the conversation.

More
13 years 1 month ago #39369 by cmorley

PCW wrote: Also for the encoder to work in count mode you must connect the encoder output
to the 'A' input on the 7I76 and jumper the 7I76 encoder input for TTL type signals

Its probably arguable that motion should have both a signed spindle
velocity pin (as it does now) and a unsigned spindle speed pin
(since it already has the direction signals) To avoid the common
requirement of the absolute component here.


Yes I agree - working on a patch now.
It would be nice if hostmot has encoder/resolver velocity as an absolute as well.
its common to filter and absolute it for spindle readout display...

Chris M

Please Log in to join the conversation.

More
12 years 10 months ago #41625 by Mr_Mayhem
Hi Chris,

Linuxcnc 2.5.0, live cd installed on hd running on older dell. I have the same Meas cards, the 5i25 with the 7i76 daughter card, as above. I have been trying for several days to get Pncconf to configure my spindle via variable voltage output from 7i76 TB4. I want to use the analog 10v variable voltage output on 7i76 TB4 to vary the voltage to my spindle VFD in the usual manner. I don't think I have a problem with the physical connections. My issue is errors in Pncconf.

I do NOT have an encoder for the spindle, it is a chinese 1500 watt water cooled spindle controlled by VFD, simple er11 collett.

For testing I have a digital voltmeter hooked up to the output pin TB4 Pin 2 on the actual 7i76 card, with 13 volts to pin 3 and common to pin 1. So I should see the meter change in relation to commands, but no results with this so far.

My main question has become, can I do this spindle control config in Pncconf (I get errors on "Apply") or do I have to type in the settings manually? Should I simply copy the spindle and abs related lines from the above example?

It would be nice to see Pncconf work the way it should for my no-encoder spindle setup, without resorting to the hal file editing. If I need to manually edit, no problem, but hey, this is a very nice piece of software with a minor issue that can be fixed. I will put in the time and test any fixes you need for this hardware setup.

So far, my attempts in Pncconf pops errors when I get to the final step and hit "Apply". Maybe I am doing it all wrong. To activate the spindle output, I was using the "5i25 firmware: 7i76x1", Tab "Smart Serial 0", sub-tab "7i76 Mode 9 I/O Card", and set the first drop-down item function to "Spindle Output". I click "Foward" to the end and click "Apply" and the error below pops. I do see a Spindle screen and maybe my settings there are screwy, but I have gotten the error for various settings there.

The error says
" PNCconf encountered an error. The following information may be useful in troubleshooting:
Traceback (most recent call last):
File "/usr/bin/pncconf", line 8104, in on_complete_finish
self.data.save()
File "/usr/bin/pncconf", line 3337, in save
self.write_inifile(base)
File "/usr/bin/pncconf", line 1557, in write_inifile
self.write_one_axis(file,9,"s","null",all_homes)
File "/usr/bin/pncconf" line 1618, in write_one_axis
If "analog" in pwmpinname or potoutput:
TypeError: argument type 'NoneType' is not iterable

That's it.

Thanks in advance, Chris. That Pncconf is one complex app. Let me know what can be done, and if you need me to test a fix, no problem. I am not a linux guru, but I can follow directions. If I fix this manually, is the code above appropriate for my no-encoder spindle control, or if not what do I need to change or add? Generally, I want 10 volts to make the spindle do top speed of 24,000 RPM, and zero volts to be zero rpm, with tweaking to follow of course to match reality better.

Thanks in Advance. I am impressed with Linuxcnc and Pncconf, and I am willing to help test new fixes for the 5i25 / 7i76 boards.

Please Log in to join the conversation.

More
12 years 10 months ago #41631 by cmorley
Hey Mr_Mayhem

I see you said you are using 2.5.0 from the live CD. Did you update to 2.5.3?

I tried setting the spindle with no encoder and I get no error. (2.5.3)
What I am saying is I think this is fixed on the newer version.

It is unfortunate that we don't upgrade the image on the CD.

Thanks for the informative bug report and if there are still problems please let me know.
Also as it sounds you are new to using Pncconf , any other suggestions are welcome.

Chris M

Please Log in to join the conversation.

More
12 years 10 months ago #41637 by Mr_Mayhem
Thanks, I did the upgrade from Linuxcnc 2.5.0 to 2.5.3, walked through pncconf settings to add the spindle on the TB4 output subtab, and it now works. With this new version of Linuxcnc, The 3rd subtab under smart serial 0 tab is now labeled "7i76 Analog Output TB4", whereas under 2.5.0 it did not use the word Analog or mention TB anything.

I had a little challenge to get updated because my box is offline.
For benefit of others, what follows is the procedure I followed to update Linuxcnc 2.5.0 (as installed from live cd) to the latest 2.5.3 version.

I went here, the official home of the binaries I suppose:
buildbot.linuxcnc.org/dists/lucid/v2.5_branch-rt/binary-i386/

and downloaded the very last file on that list, which was
linuxcnc_2.5.3.78.g5901d68_i386.deb

there are also debs containing updated doc files.
like
linuxcnc-doc-en_2.5.3.78.g5901d68_all.deb

Good idea to grab that too.
Copy to usb dongle memory device.
paste into the home directory on the target Linuxcnc computer.

and install the update simply by right-clicking the deb file and left clicking "Open with GDebi Package Manager" and installing from there. I got confused because some of the debs were document files, and I was like why did it not update after seeing the same version number. But the real update deb worked fine. This was
linuxcnc_2.5.3.78.g5901d68_i386.deb
for me, but make sure you grab the most recent one appropriate for your system.
After running the installs for the app and the docs, reboot I suppose and check the version numbers. Just run Axis and examine the splash screen at the beginning or click help/about to see the version number.

There is my first lame docmentation attempt for Linuxcnc.

Thanks Chris for your help.

Please Log in to join the conversation.

More
11 years 9 months ago #55210 by PCW
The 7I76 potentiometer circuit draws approximately 8 mA. If this is too much of a load for the controller,
external 10 or 12VDC must be supplied. This power source needs to be isolated when used with low cost speed controllers
A 12VDC wall adapter is a possible source.

To set the 7I76 I/O section into mode 2 you change the sserial_port_0=000xxx
token in the hal file to sserial_port_0=200xxx

Please Log in to join the conversation.

Time to create page: 0.063 seconds
Powered by Kunena Forum