My project

More
29 May 2013 00:50 #34858 by willburrrr2003
Replied by willburrrr2003 on topic Re:My project
John,

I was on the IRC over the last few days, and talked with the guy who handles those docs. I gave him the links to the EMC references.

As for PROGRESS, I made lots of progress this weekend. I have upgraded my software from emc2 2.4.6 to linuxcnc 2.5.0 . The only Issue I had with the upgrade is an error with the NGCGUI routines, so I commented them out and went on. After the Software side of things was going, I set my lathe back up, wired it into it's control panel, the hooked the computer to the control panel. When I fired it up, I had my home switches swapped, a quick fix then on to testing. I tried moving bot Axis, then homing. Once that was proven, then I tried the spindle and it worked great ! I played with it for about half an hour, then shut it down for the night. My next step tonight I think is to try to get classicladder talking Modbus to my Idec PLC.

Regards,

Will

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

More
29 May 2013 01:50 - 29 May 2013 01:50 #34863 by BigJohnT
Replied by BigJohnT on topic Re:My project

John,

I was on the IRC over the last few days, and talked with the guy who handles those docs. I gave him the links to the EMC references.


That would be me :)

As for PROGRESS, I made lots of progress this weekend. I have upgraded my software from emc2 2.4.6 to linuxcnc 2.5.0 . The only Issue I had with the upgrade is an error with the NGCGUI routines, so I commented them out and went on. After the Software side of things was going, I set my lathe back up, wired it into it's control panel, the hooked the computer to the control panel. When I fired it up, I had my home switches swapped, a quick fix then on to testing. I tried moving bot Axis, then homing. Once that was proven, then I tried the spindle and it worked great ! I played with it for about half an hour, then shut it down for the night. My next step tonight I think is to try to get classicladder talking Modbus to my Idec PLC.

Regards,

Will


Did you read the last line in the upgrade instructions about ngcgui?

JT
Last edit: 29 May 2013 01:50 by BigJohnT.

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

More
29 May 2013 02:28 #34867 by willburrrr2003
Replied by willburrrr2003 on topic Re:My project
Yes John, and I removed the line for the USER COMMAND File....


Will

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

More
14 Jun 2013 22:18 #35628 by willburrrr2003
Replied by willburrrr2003 on topic Re:My project
After solving the NGCGUI issue about a week and a half ago, I focused on Modbus communications to my external PLC. I read and read and read, and as much as I tried....still got a Modbus communications fail every time I started my machine up. I figured out yesterday that I had one pin off in the serial cord I made to go between the PC serial port and the minidin port on the PLC. I corrected the issue, and was communicating withing about 5 mins of starting the system up. I was able to turn on and off all the relay outputs of my external PLC last night and I am very happy with the progress! Once I got to work I printed out all the addressing that I will be working with in the PLC. IDEC was nice enough to provide the register addressing in a neat spreadsheet for Modbus users.

More Progress to come!


Regards,

Will

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

More
25 Jun 2013 06:09 #36014 by willburrrr2003
Replied by willburrrr2003 on topic My project
My next step is to get spindle feedback running a PID loop to control the c-6 speed controller board that I installed last July. Below is my HAL File, can you guys let me know if you see any issues with the changes I am making. Thanks in advance for any help you all provide.

Regards,

Will

# willburrrr2003’s Hal file for CNC Mini-Lathe
# My config file for My Harbor Freight Mini-Lathe adding C6 speed board
# started with just 2-axis on my stepgen, and added the
# third one, with scaling feature for freq output
# I had to tweek my C6 adjustment pot, and my Scaling gain
# until my output voltage from the C6 was 4.35vdc
# (Which was the voltage measured across my speed
# pot) when I set speed (s1250) to max lathe speed
# and made sure that no speed settings above 1250 raised
# the C6 output voltage above the 4.35vdc, so I don’t
# fry my mini-lathe speed board.
# ADDING SPINDLE FEEDBACK, CHANGING FILE TO SUIT. Added second scale, to use for
# scaling of encoder feedback to rpms. Added PID driven by encoder feedback.
# I am setting the encoder as the PID feedback, LINUXcnc speed output scaled through scale.0 to drive PID command, the total of the command and the PID # out (sum2.0 ) to drive the stepgen module that creates my output freq to # the c-6 board.

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,0 ctrl_type=p,p,v
loadrt classicladder_rt numPhysInputs=15 numPhysOutputs=15 numS32in=10 numS32out=10 numFloatIn=10 numFloatOut=10

#load the scaling module to use on my spindle speed
loadrt scale count=2


#connect scale to servo clock thread
addf scale.0 servo-thread
addf scale.1 servo-thread


# Attach the encoder to the motion and the scale
net spindle_rev_count encoder.0.position => motion.spindle-revs
net spindle_index_enable encoder.0.index-enable <=> motion.spindle-index-enable
net encoder_raw_velocity encoder.0.velocity => scale.1.in

# Initialize the encoder (spindle)
loadrt encoder num_chan=1
addf encoder.update-counters base-thread
addf encoder.capture-position servo-thread
setp encoder.0.position-scale 1
setp encoder.0.counter-mode 1

# Initialize the PID
loadrt pid num_chan=1
addf pid.0.do-pid-calcs servo-thread
setp pid.0.Pgain 0
setp pid.0.Igain 1
setp pid.0.Dgain 1
setp pid.0.maxoutput 1250



# Initialize the sum2
loadrt sum2 count=1
addf sum2.0 servo-thread




# Attach the encoder to the parallel port pin CHANGE TO ACTUAL PINS ONCE DECIDED
# ENCODER INPUT TO PHASE A AND INDEX INPUT TO PHASE Z
net parport_xx_in parport.0.pin-xx-in => encoder.0.phase-A
net parport_xx_in parport.0.pin-xx-in => encoder.0.phase-Z

# Attach the pid to the scale, motion, and sum
net pid_feedback pid.0.feedback <= motion.spindle-speed-in <= scale.1.out
net pid_command pid.0.command <= scale.0.out => sum2.0.in0
net pid_output pid.0.output => sum2.0.in1

#setup for scaling signal from linuxcnc to stepgen so I could calibrate output
#freq

setp scale.0.in 0
setp scale.0.gain 0.92 #final setting after several tweaks to C6 and gain
setp scale.0.offset 0.0 #no offset needed


# (This is used to scale the encoder pulse to RPM)
# (In my case, i have 1 ppr so it is scaled by 60)

setp scale.1.gain 60


#setup for stepgen to drive spindle
setp stepgen.2.position-scale 1
setp stepgen.2.maxvel 1250 #max RPM for my HF minilathe

#set steplen so it gives max frequency of 25khz
#(servo-thread/(steplen+stepspace)=maxfreq output)
#so for me was 1000000/40000=25khz with 25khz full speed for the C6
setp stepgen.2.steplen 40000
setp stepgen.2.stepspace 0
setp stepgen.2.dirhold 20000
setp stepgen.2.dirsetup 20000
setp stepgen.2.maxaccel 200 #set max acceleration for spindle


#enable stepgen for spindle, when EMC calls for spindle on
net spindle-enable <= motion.spindle-on => stepgen.2.enable => pid.0.enable


#sends the speed request from EMC to scale module
net spindle-cmd motion.spindle-speed-out => scale.0.in



#sends scaled spindle speed to EMC and spindle stepgen for requested speed
net spindle-freq <= sum2.0.out => stepgen.2.velocity-cmd




#Sends frequency out to parallel port pin 1 and to EMC
net spindle-out <= stepgen.2.step => parport.0.pin-01-out
#when spindle turned on send on signal to parallel port pin 14, which
#I used to drive C6 relay board for on off control
net spindle-enable => parport.0.pin-14-out


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

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

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


net min-z <= parport.0.pin-10-in
net max-home-z <= parport.0.pin-11-in
net max-home-x <= parport.0.pin-12-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 max-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 max-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_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

# Load Classicladder with modbus master included (GUI must run for Modbus)
loadusr classicladder --modmaster custom.clp

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

More
25 Jun 2013 18:49 #36035 by andypugh
Replied by andypugh on topic My project

can you guys let me know if you see any issues with the changes I am making.


If the breakout takes a frequency for spindle speed control then I am a bit confused as to why you have calculated a special step length. You should be able to limit the frequency with the maxvel parameter alone, and setting the scale to suit.

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

More
26 Jun 2013 02:40 #36056 by willburrrr2003
Replied by willburrrr2003 on topic My project
Andy,
When I first set up my c6 speed controller board last July, it’s manual said it had a max freq input of 25khz. And when I looked up stepgen, I came across to formula to set stepgen’s max freq output. “servo-thread/(steplen+stepspace)=maxfreq output” So I took the known values of servo-thread, and max freq and used them to calculate the steplen of my stepgen module so that it would output no more than 25khz when it’s max velocity was commanded (1250 which is what I set the maxvel to be). I used scale.0 to finetune my output. Now when I command a speed of 1250, my c6 drives the voltage to my lathe speed control circuit right at 4.35vdc . a speed command of 625 drives the voltage right at 2.175vdc, etc… So going this route seemed to work great for what I was trying to accomplish.

Regards,

Will

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

More
26 Jun 2013 23:57 #36095 by willburrrr2003
Replied by willburrrr2003 on topic My project

can you guys let me know if you see any issues with the changes I am making.


If the breakout takes a frequency for spindle speed control then I am a bit confused as to why you have calculated a special step length. You should be able to limit the frequency with the maxvel parameter alone, and setting the scale to suit.


Andy, I though maxvel was in RPM's? If it is, then how do I limit my output frequency with it? It seems I went the long way I guess to get the desired response from my system lol. I am hoping I tied in the new settings to the working speed control right to get the whole system working now....I will find out soon as I find where I put the optical sensors and their custom mounting brackets that I could not find last night to mount...grrrr.....hate being absent minded sometimes hehe..


Regards,

Will

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

Time to create page: 0.096 seconds
Powered by Kunena Forum