Hal index pulse and syncronized motion setup

More
15 Dec 2013 08:59 - 15 Dec 2013 19:55 #41612 by Davenc
I just got my Probotix pc box and am trying to get it setup in preparation for the cncfusion mini lathe kit. I successfully integrated a joypad after spending hours only to find out the new joypad was bad. Anyway after trying for hours to get the RPM meter up using the pyvcp panel and the hal file I'm coming up empty. No matter what I try I still can't get the RPM meter to display any kind out output.

I used stepconf to setup the spindle index pulse along with a 100ppr encoder with quad output so I'm using phase z on pin 10, phase a on pin 11 and phase b on pin 12. I've tested the output of the C4 index pulse card using halmeter and it's working find just having trouble getting it to the display. I'm enclosing my files. I tried numerous examples without success, most of the samples don't have hardware pins using all 3 phases but I'm planning on using all three. I know I'm overlooking something simple but can't see the trees despite the forest. I want to be able to thread accurately hence the 100ppr encoder with quad output. I don't have the 100 ppr encoder wiring in yet but the index pulse is wired and I'm using a slotted index wheel to manually trigger the C4 index pulse card.
# Generated by stepconf at Sat Dec 14 13:05:19 2013
# If you make changes to this file, they will be
# overwritten when you run stepconf again

[EMC]
MACHINE = my-lathe
DEBUG = 0

[DISPLAY]
DISPLAY = axis
EDITOR = gedit
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
MAX_FEED_OVERRIDE = 1.2
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 5
PROGRAM_PREFIX = /home/probotix/linuxcnc/nc_files
INCREMENTS = .1in .05in .01in .005in .001in .0005in .0001in
PYVCP = custompanel.xml
LATHE = 1

[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
BASE_PERIOD = 83333
SERVO_PERIOD = 1000000

[HAL]
HALUI = halui
HALFILE = my-lathe.hal
HALFILE = custom.hal
POSTGUI_HALFILE = custom_postgui.hal

[HALUI]
# add halui MDI commands here (max 64) 

[TRAJ]
AXES = 3
COORDINATES = X Z
LINEAR_UNITS = inch
ANGULAR_UNITS = degree
CYCLE_TIME = 0.010
DEFAULT_VELOCITY = 0.15
MAX_LINEAR_VELOCITY = 1.50

[EMCIO]
EMCIO = io
CYCLE_TIME = 0.100
TOOL_TABLE = tool.tbl

[AXIS_0]
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 0.5
MAX_ACCELERATION = 30.0
STEPGEN_MAXACCEL = 37.5
SCALE = 8000.0
FERROR = 0.05
MIN_FERROR = 0.01
MIN_LIMIT = -0.01
MAX_LIMIT = 8.0
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = 0.050000
HOME_LATCH_VEL = 0.050000
HOME_SEQUENCE = 1

[AXIS_2]
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 1.42500570002
MAX_ACCELERATION = 60.0
STEPGEN_MAXACCEL = 75.0
SCALE = 8000.0
FERROR = 0.05
MIN_FERROR = 0.01
MIN_LIMIT = -10.0
MAX_LIMIT = 0.01
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = 0.050000
HOME_LATCH_VEL = 0.050000
HOME_SEQUENCE = 0


# Generated by stepconf at Sat Dec 14 13:05:19 2013
# If you make changes to this file, they will be
# overwritten when you run stepconf again
loadrt trivkins
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
loadrt probe_parport
loadrt hal_parport cfg="0x378 out  "
setp parport.0.reset-time 5000
loadrt stepgen step_type=0,0
loadrt encoder num_chan=1

addf parport.0.read base-thread
addf stepgen.make-pulses base-thread
addf encoder.update-counters base-thread
addf parport.0.write base-thread
addf parport.0.reset base-thread

addf stepgen.capture-position servo-thread
addf encoder.capture-position servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf stepgen.update-freq servo-thread
net spindle-cmd <= motion.spindle-speed-out

setp encoder.0.position-scale 400.000000
net spindle-position encoder.0.position => motion.spindle-revs
net spindle-velocity encoder.0.velocity => motion.spindle-speed-in
net spindle-index-enable encoder.0.index-enable <=> motion.spindle-index-enable
net spindle-phase-a encoder.0.phase-A
net spindle-phase-b encoder.0.phase-B
net spindle-index encoder.0.phase-Z

net xstep => parport.0.pin-02-out
setp parport.0.pin-02-out-reset 1
net xdir => parport.0.pin-03-out
net zstep => parport.0.pin-06-out
setp parport.0.pin-06-out-reset 1
net zdir => parport.0.pin-07-out


net spindle-index <= parport.0.pin-10-in 
net spindle-phase-a <= parport.0.pin-11-in
net spindle-phase-b <= parport.0.pin-12-in
net home-x <= parport.0.pin-13-in
net home-z <= parport.0.pin-15-in


setp stepgen.0.position-scale [AXIS_0]SCALE
setp stepgen.0.steplen 1
setp stepgen.0.stepspace 0
setp stepgen.0.dirhold 35000
setp stepgen.0.dirsetup 35000
setp stepgen.0.maxaccel [AXIS_0]STEPGEN_MAXACCEL
net xpos-cmd axis.0.motor-pos-cmd => stepgen.0.position-cmd
net xpos-fb stepgen.0.position-fb => axis.0.motor-pos-fb
net xstep <= stepgen.0.step
net xdir <= stepgen.0.dir
net xenable axis.0.amp-enable-out => stepgen.0.enable
net home-x => axis.0.home-sw-in

setp stepgen.1.position-scale [AXIS_2]SCALE
setp stepgen.1.steplen 1
setp stepgen.1.stepspace 0
setp stepgen.1.dirhold 35000
setp stepgen.1.dirsetup 35000
setp stepgen.1.maxaccel [AXIS_2]STEPGEN_MAXACCEL
net zpos-cmd axis.2.motor-pos-cmd => stepgen.1.position-cmd
net zpos-fb stepgen.1.position-fb => axis.2.motor-pos-fb
net zstep <= stepgen.1.step
net zdir <= stepgen.1.dir
net zenable axis.2.amp-enable-out => stepgen.1.enable
net home-z => axis.2.home-sw-in

net estop-out <= iocontrol.0.user-enable-out
net estop-out => iocontrol.0.emc-enable-in

loadusr -W hal_input -KRAL Dual

loadusr -W hal_manualtoolchange
net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change
net tool-changed iocontrol.0.tool-changed <= hal_manualtoolchange.changed
net tool-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number
net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared

# Include your customized HAL commands here
# The commands in this file are run after the AXIS GUI (including PyVCP panel) starts

loadrt or2 count=2
 loadrt mux4 count=1
 loadrt and2 count=4
 loadrt not count=2
 loadrt scale count=1
 loadrt abs count=1
 loadrt lowpass count=1

 addf or2.0 servo-thread
 addf or2.1 servo-thread
 addf mux4.0 servo-thread
 addf and2.0 servo-thread
 addf and2.1 servo-thread
 addf and2.2 servo-thread
 addf and2.3 servo-thread
 addf not.0 servo-thread
 addf not.1 servo-thread
 addf scale.0 servo-thread
 addf abs.0 servo-thread
 addf lowpass.0 servo-thread

 # set the jog speed for the joypad 
 # this one must be 0 to prevent motion unless a button is pressed
 setp mux4.0.in0 0 
 setp mux4.0.in1 .25
 setp mux4.0.in2 10
 setp mux4.0.in3 50

 # the following does the magic of setting the jog speeds
 net remote-speed-slow or2.0.in0 input.0.btn-joystick
 net remote-speed-medium or2.1.in0 input.0.btn-thumb
 net remote-speed-fast or2.0.in1 or2.1.in1 input.0.btn-thumb2

 net joy-speed-1 mux4.0.sel0 <= or2.0.out
 net joy-speed-2 mux4.0.sel1 <= or2.1.out
 net joy-speed-final halui.jog-speed <= mux4.0.out


 net joy-x-jog halui.jog.0.analog <= input.0.abs-y-position 
 net joy-z-jog halui.jog.2.analog <= input.0.abs-z-position 

#sets button5 to toggle machine on & off
  net machine-is-on halui.machine.is-on => and2.0.in0
  net machine-is-on halui.machine.is-on => not.0.in
  net not-machine-is-on not.0.out => and2.1.in0
  net button5 input.0.btn-top2 => and2.0.in1
  net button5 input.0.btn-top2 => and2.1.in1
  net machineOff and2.0.out => halui.machine.off
  net machineOn and2.1.out => halui.machine.on


 #sets button7 to toggle estop on & off
  net estop-is-on halui.estop.is-activated => and2.2.in0
  net estop-is-on halui.estop.is-activated => not.1.in
  net not-estop-is-on not.1.out => and2.3.in0 
  net button7 input.0.btn-base => and2.2.in1
  net button7 input.0.btn-base => and2.3.in1
  net estopOff and2.2.out => halui.estop.reset
  net estopOn and2.3.out => halui.estop.activate 

setp lowpass.0.gain 0.01
###############################################
# Display spindle speed in pyvcp bar
###############################################
setp scale.0.gain 60.0 #convert velocity per sec into rpm
net spindle-velocity => lowpass.0.in
net filtered-spindle-velocity <= lowpass.0.out => abs.0.in
net absolute-spindle-velocity <= abs.0.out => scale.0.in
net scaled-spindle-velocity <= scale.0.out  => pyvcp.spindle-speed
 
# Include your customized HAL commands here
# The commands in this file are run after the AXIS GUI (including PyVCP panel) starts


<?xml version='1.0' encoding='UTF-8'?>
<pyvcp>
<label>
        <text>"Spindle speed:"</text>
    </label>
    <bar>
        <halpin>"spindle-speed"</halpin>
        <max_>5000</max_>
    </bar>
</pyvcp>
Last edit: 15 Dec 2013 19:55 by BigJohnT. Reason: add code tags

Please Log in or Create an account to join the conversation.

More
15 Dec 2013 19:57 #41622 by BigJohnT
Have you looked in the Spindle Synchronized Motion section of the manual?

linuxcnc.org/docs/html/examples/spindle....d_spindle_feedback_a

JT

Please Log in or Create an account to join the conversation.

More
15 Dec 2013 20:34 #41623 by Davenc

Have you looked in the Spindle Synchronized Motion section of the manual?

linuxcnc.org/docs/html/examples/spindle....d_spindle_feedback_a

JT


Only about 30 times over the last 4 weeks, I keep hoping to find the missing piece but I don't. Not trying to be a smart ass really. The problem with the example and all the rest of them is they don't show the setup for using a quadrature output so I'm relying on what stepconfig created to be accurate. Even the documentation on stepconfig doesn't go into the quadrature setup, all the examples don't use phase B. For now though I'd just like to see the RPM meter move when I trigger the index pulse. I'm not sure if I have to have the hardware for phase A and phase B hooked up in order to get an output to the pyvcp panel gauge. I'm assuming the spindle index pulse phase Z will run independently of the other two phases.

Please Log in or Create an account to join the conversation.

More
16 Dec 2013 03:06 #41630 by BigJohnT
Open up the Show Hal Configuration window and in the watch window start backwards from pyvcp.spindle-speed and add the pins. Then run your spindle and see where it is broken. It appears you have both A and B connected in your hal file. I don't see anything that sticks out.

JT

Please Log in or Create an account to join the conversation.

More
16 Dec 2013 06:40 #41634 by Davenc
I figured it out. The only pin that had activity was the spindle-index pin so I figured it had to be something associated with the breakout board so I took a guess and removed the jumper on the breakout board that places pullup resistors on the pins coming in and low and behold it worked.

Please Log in or Create an account to join the conversation.

More
24 Dec 2013 07:52 #41964 by Davenc
I lied, I didn't figure it out all I did was get activity on the pyvcp speed display but it's not working correctly. Here is what I'm seeing using the Hal scope.

Hal scope show a 1V signal coming out of pin 10 of the parport and I see the same on spindle-index. Also the spindle-index pulse varies consistently with the variable speed change on my mini lathe so I don't suspect anything is wrong there. The faster the motor turns the more spindle-index pulses I get.

I start loosing it on the spindle-velocity pin and on halscope you can see that the signal is intermittent. The slower the motor runs the more pulses I see on halscope and the pyvcp speed display follows the spindle-velocity output. If I can get the spindle-velocity consistent I think it will fix my problem. One thing I noticed was the amplitude of the spindle velocity pin is at TTL levels. I think the 1V signal is the problem but I don't know how to compensate for it or for that matter if it can be compensated for. I'm using the probotix isolated breakout board, isolated being the key word here. probotix.com/breakout_boards/pbx-rf_isolated_breakout_board/. My concern is the isolated breakout board isn't able to supply the voltage level to get the spindle velocity signal consistent.

What's my next step here guys?

Thanks,
Dave

Please Log in or Create an account to join the conversation.

More
26 Dec 2013 22:01 #42031 by Davenc
The problem was a hal issue and me not using the phase A and phase B and trying to get the index pulse to work. I didn't have the hardware connected for the phase A and B signals ans that turned out to be the problem. I went back to square one and created a separate stepconfig for just using phaze Z index pulse as an RPM meter and finally got an output but it wasn't very stable. I had to change the scale weight from 60 to 13.2 to get an accurate reading. I also had to change the lowpass setting to .001 or the display jumped around to much.

Now that I have both encoder signals hooked up the RPM display is very stable. I want to try an air thread operation to see it work. Now I just need CNCfusion to actually ship my lathe kit sometime before the year ends. I ordered the kit on Nov 18th with a confirmed email from them stating it would be 2 weeks till it shipped. It is now 35 days and difficult to get a response from them when I request information. It takes anywhere from 3 to 5 days to get an email response for a simple question like when is my kit shipping. I'm not happy at all about this.

Please Log in or Create an account to join the conversation.

More
28 Dec 2013 07:07 #42082 by andypugh

Hal scope show a 1V signal coming out of pin 10 of the parport


Halscope only shows logic 0 or logic 1, it can't measure voltage.

Please Log in or Create an account to join the conversation.

Time to create page: 0.093 seconds
Powered by Kunena Forum