Pimping the mini-lathe

More
6 years 2 months ago - 6 years 2 months ago #177625 by PCW
Replied by PCW on topic Pimping the mini-lathe
On a 7I96 the parallel expansion connector (P1) can have any available function on any pin
but the on board I/O like stepgen pins and isolated inputs have a fixed direction so can only
be used in their designed directions and may have other limitations like maximum speed.

For example the 7I96 stepgen outputs are driven by 5V buffer chips to get a full
5V signal that can drive 24 mA. This buffer only works as an output. Similarly
the isolated input pins can only function as inputs, and are speed limited by
the Optocouplers used for isolation to about 5KHz maximum input frequency.
Last edit: 6 years 2 months ago by PCW.
The following user(s) said Thank You: RotarySMP

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

More
6 years 2 months ago #177628 by Clive S
Replied by Clive S on topic Pimping the mini-lathe

RotarySMP wrote: Given that my lathe only uses a fraction of the 7i96's capacity (2 Stepgen, 1 ENC and 1 Pwmgen) at present, would it be possible to add a further encoder through mesaflash to read a jog wheel? I looked through the bit files, and see there is one that looks like it converts to six ENC (7i96_6enc_d.bit). What would I need to do to make a 1pwmgen+ 1 addition ENC bitfile?

Actually given that jogwheels are only 100 PPR, and the normal input pins are read at 1kHz, I can't hand jog at 10 RPS anyway, so there is probably no disadvantage of puttnig the jog wheel onto general I/O except that they need a few pins.

Bonus question, would it be possible to reconfigure both the two unused Stepgens to ENC? With two stepgens, 1 pwmgen, and 3 Enc (the existing one plus two more), I could add linear encoders to the two axis, and run the jog wheel off I/O. That would be awsome for a lathe.
Mark


This is what I have used on a mill using a 7i96 for jogging 3 axis
Code:
# change number of encoders here loadrt encoder num_chan=5 addf encoder.capture-position servo-thread addf encoder.update-counters servo-thread # MPG stuff here #### load ilowpass for mpg smoothing ### loadrt ilowpass names=ilowpass.mpgX,ilowpass.mpgY,ilowpass.mpgZ addf ilowpass.mpgX servo-thread addf ilowpass.mpgY servo-thread addf ilowpass.mpgZ servo-thread setp ilowpass.mpgX.scale 50 setp ilowpass.mpgX.gain 0.01 setp ilowpass.mpgY.scale 50 setp ilowpass.mpgY.gain 0.01 setp ilowpass.mpgZ.scale 50 setp ilowpass.mpgZ.gain .01 # for velocity mode (when you stop spinning the dial the axis stops) # must be set for each axis setp joint.0.jog-vel-mode 1 setp axis.x.jog-vel-mode 1 setp joint.1.jog-vel-mode 1 setp axis.y.jog-vel-mode 1 setp joint.2.jog-vel-mode 1 setp axis.z.jog-vel-mode 1 # "times 4 mode" one count per full quadrature cycle, instead of the usual one count per edge. # mpg jog wheels often have a full quadrature cycle per "click". 0 for off and 1 for on. setp encoder.0.x4-mode 0 setp encoder.1.x4-mode 0 setp encoder.2.x4-mode 0 #set axis to the required increment ( 0.01) net jog-inc-x joint.0.jog-scale axis.x.jog-scale sets jog-inc-x 0.0002 net jog-inc-y joint.1.jog-scale axis.y.jog-scale sets jog-inc-y 0.0002 net jog-inc-z joint.2.jog-scale axis.z.jog-scale sets jog-inc-z 0.0002 #set inputs to 7i96 #encoder X net mpg-xa encoder.0.phase-A <= hm2_7i96.0.gpio.000.in net mpg-xb encoder.0.phase-B <= hm2_7i96.0.gpio.001.in #encoder Y net mpg-ya encoder.1.phase-A <= hm2_7i96.0.gpio.002.in net mpg-yb encoder.1.phase-B <= hm2_7i96.0.gpio.003.in #encoder Z net mpg-za encoder.2.phase-A <= hm2_7i96.0.gpio.004.in net mpg-zb encoder.2.phase-B <= hm2_7i96.0.gpio.005.in # send mpg-encoder counts to required axis # x encoder net enc-counts-x encoder.0.counts net enc-counts-x ilowpass.mpgX.in net enc_out-x ilowpass.mpgX.out net enc_out-x axis.x.jog-counts net enc_out-x joint.0.jog-counts setp axis.x.jog-enable true setp joint.0.jog-enable true # Y encoder net enc-counts-y encoder.1.counts net enc-counts-y ilowpass.mpgY.in net enc_out-y ilowpass.mpgY.out net enc_out-y axis.y.jog-counts net enc_out-y joint.1.jog-counts setp axis.y.jog-enable true setp joint.1.jog-enable true # Z encoder net enc-counts-z encoder.2.counts net enc-counts-z ilowpass.mpgZ.in net enc_out-z ilowpass.mpgZ.out net enc_out-z axis.z.jog-counts net enc_out-z joint.2.jog-counts setp axis.z.jog-enable true setp joint.2.jog-enable true

If you want the hal file as well just shout
The following user(s) said Thank You: RotarySMP

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

More
6 years 2 months ago - 6 years 2 months ago #177632 by RotarySMP
Replied by RotarySMP on topic Pimping the mini-lathe
Thanks Clive, I just ordered a jog encoder. I'll be sure to use this section of your HAL.
Last edit: 6 years 2 months ago by RotarySMP.

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

More
6 years 2 months ago #177741 by RotarySMP
Replied by RotarySMP on topic Pimping the mini-lathe
Here is episode 26.


Motion at last!

By the way, does anyone have an aswer to a question I posted a couple of days go?
Just playing around, what is the syntax to use natural constants like Pi or "e" in gcode?
Code:
#<103>=[pi/e]
Mark
The following user(s) said Thank You: tommylight, Clive S

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

More
6 years 2 months ago #177777 by rodw
Replied by rodw on topic Pimping the mini-lathe
The RS274ngc document
tsapps.nist.gov/publication/get_pdf.cfm?pub_id=823374
indicates e exists as EXP but does not explain the usage
I think it will be EXP(n) or EXP[n]
as for pi, I think you would need to define it as a variable.
The following user(s) said Thank You: RotarySMP

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

More
6 years 2 months ago #177930 by RotarySMP
Replied by RotarySMP on topic Pimping the mini-lathe
I have two problems with the following connections

net spindle-enable <= spindle.0.on
net spindle-enable => hm2_7i96.0.ssr.00.out-00
net spindle-cw <= spindle.0.forward
net spindle-cw => hm2_7i96.0.ssr.00.out-01
net spindle-ccw <= spindle.0.reverse
net spindle-cww => hm2_7i96.0.ssr.00.out-02

When I push Gmoccapy spindle fwd button, both out-00 and out-01 go true. Spindle starts correctly.

When I push the rev rotation button, spindle enable out-00 goes high, but out-02 stay false. I can't see the error.

Second issue:
I am a bit lost with the spindle closed loop connection. I have the following generated by PNCConf

#*******************
# SPINDLE
#*******************

setp pid.s.Pgain [SPINDLE_0]P
setp pid.s.Igain [SPINDLE_0]I
setp pid.s.Dgain [SPINDLE_0]D
setp pid.s.bias [SPINDLE_0]BIAS
setp pid.s.FF0 [SPINDLE_0]FF0
setp pid.s.FF1 [SPINDLE_0]FF1
setp pid.s.FF2 [SPINDLE_0]FF2
setp pid.s.deadband [SPINDLE_0]DEADBAND
net ratio_select.out pid.s.maxoutput
setp pid.s.error-previous-target true

net spindle-index-enable <=> pid.s.index-enable
net spindle-enable => pid.s.enable
net spindle-vel-cmd-rpm-abs => pid.s.command
net spindle-vel-fb-rpm-abs => pid.s.feedback
net spindle-pid-out pid.s.output => scale.gear.in
net gear-ratio ratio_select.out-f => scale.gear.gain
setp ratio_select.in00 0.000405
setp ratio_select.in01 0.000175
net gear-select-a => ratio_select.sel0
net spindle-output <= scale.gear.out

# ---Encoder feedback signals/setup---

setp [HMOT](CARD0).encoder.00.counter-mode 0
setp [HMOT](CARD0).encoder.00.filter 1
setp [HMOT](CARD0).encoder.00.index-invert 0
setp [HMOT](CARD0).encoder.00.index-mask 0
setp [HMOT](CARD0).encoder.00.index-mask-invert 0
setp [HMOT](CARD0).encoder.00.scale [SPINDLE_0]ENCODER_SCALE

net spindle-revs <= [HMOT](CARD0).encoder.00.position
net spindle-vel-fb-rps <= [HMOT](CARD0).encoder.00.velocity
net spindle-index-enable <=> [HMOT](CARD0).encoder.00.index-enable

# ---setup spindle control signals---

net spindle-vel-cmd-rps <= spindle.0.speed-out-rps
net spindle-vel-cmd-rps-abs <= spindle.0.speed-out-rps-abs
net spindle-vel-cmd-rpm <= spindle.0.speed-out
net spindle-vel-cmd-rpm-abs <= spindle.0.speed-out-abs


I added
net spindle-vel-cmd-rpm-abs => hm2_7i96.0.pwmgen.00.value

but it does respond to a change in command S word.

Thanks for assistance.
Mark

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

Moderators: piasdom
Time to create page: 0.349 seconds
Powered by Kunena Forum