Encoders

More
12 Jul 2020 00:17 #174345 by JohnnyCNC
Replied by JohnnyCNC on topic Encoders
Don't know if this will help but these are the DMM settings I used. I am using the analog 0-10v control. My motor drives the spindle by toothed belt geared 1:1.8 that gives me a max speed of 5400 rpm.

This is some advice I got from DMM tech support.

For use as spindle motor, set Integration Gain to "1" and keep it at "1". Then increase Main Gain and Speed Gain until the motion is rigid and suitable. Keep Main Gain and Speed Gain at the same value.

Make sure to install a regenerative resistor on the drive to help absorb deceleration energy from the motor. Also install a transformer or AC line reactor on the AC power input to smooth and filter the power coming into the drive.


These are my DMM settings.


These are my ini settings:

[SPINDLE_0]
P = 2.0
I = 4.0
D = 0.0
FF0 = 1.08
FF1 = 0.0
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.0
OUTPUT_MIN_LIMIT = -5400.0
OUTPUT_MAX_LIMIT = 5400.0
OUTPUT_SCALE = -10800
ENCODER_SCALE = 4551.111111
Attachments:

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

More
12 Jul 2020 01:38 - 12 Jul 2020 01:38 #174350 by natholego11
Replied by natholego11 on topic Encoders
@Blazini:

As far as deceleration, that is the same parameters as acceleration. decrease the acceleration value and you will increase the deceleration time. Basically if it takes 2 seconds to accelerate from 0 to 3000rpms, then it will take 2 seconds to decelerate from 3000rpms to 0, assuming that the motor can physically handle both. You have to remember that you are commanding/reading the servo drive/motor, but the device you are concerned with controlling is the spindle itself which is driven at a 2.5:1 ratio. So you need to relax your accelerations in LinuxCNC and the DMM software a bit....and by the way, if I havent said it before, DMM's autotune is garbage you need to tune the gains yourself.


when I run the spindle i am getting a decent acceleration rate, IE ramps up like you would typically see. but when I command a stop or a reverse spindle command, I am getting something closer to a Brake command sent to the drive, which overloads the DYN4 and causes an alarm. not sure why it would not decel but would accel just fine and it doesnt seem to matter if I set the accel to 10 or to 100, its doing the same thing all the while the Accel is either faster or slower..... Is there something I have set wrong in the DMM software? on another note, I have not been using the autotune on their stuff, I have been manually tuning it.

TTL means single ended, if you are using encoder A/B+ but not A/B-, then yes, set the card jumpers to TTL. If you start losing counts.....well I told you you should use differential.


ill switch my TTL to differential where I can(IE the spindle since thats easy), the encoders I am going to use for all the axis are A/B/index+ and not differential, hopefully this wont cause too much of an issue, but we will see. not hard to upgrade those later if I need to, for now I just want the thing to work better than it was before.

what i havent been able to get to work is the PID control for the spindle. now I havent played with it much, but from the basic settings that you are seeing in the ini file the spindle seems to work fine. Now I will say the "spindle at speed" led isnt lighting up when I MDI an s1000 for example. so not sure what would be causing that. but do I need to tune the PID parameters for the spindle? if so whats the best way to do that? ive tried pulling up the halscope, but once the screen is up im not sure what I am doing there. I dont even know how to pick a pin to view while a command is given.

again I am pretty new to alot of this controls stuff and the EE side of things so forgive me for not necessarily knowing the difference between TTL and differential or PID controls etc...

Thanks for the help

@johnny
my DMM looks pretty similar, still tuning that with Stephen over there, I have been having issues with the DYN4 "over heat"ing and he sent me some updated parameters to verify that the motor is tuned right. so i have yet to try those.
but to followup on the statement above to blazini, how are you getting your PID parameters? what was the process you used to set those? and how much difference are you seeing by having that over the initial setting from the PNCconfig?

when I command say a S1000 m3, the spindle will spool up and run anywhere between (according to the encoder from the DYN4) 950 and 1100 or so, it bounces around alot, so not sure whats causing that? maybe the TTL vs differential input? I was thinking it was some kind of refresh rate that is set in linux, or maybe is pretty standard to see that. I can film it and post it here if anybody wants to see what I am talking about.
Last edit: 12 Jul 2020 01:38 by natholego11.

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

More
13 Jul 2020 10:06 #174491 by blazini36
Replied by blazini36 on topic Encoders
If your spindle is stopping immediately and throwing the drive into a fault, then your config isn't stopping the spindle correctly, it's disabling the stepgen,Try stopping it with the MDI command "M3 S0", if that doesn't fault your drive the config isn't right. My config wasn't setup right from pncconf for this, I'll have to look at what I did to fix it when I get time.

Spindle at speed will not work until you setup a "near" component for it. Last I used pncconf was several years ago but I know it didn't set this up back then. Search the forums.

JohnnyCNC is using a LinuxCNC PID but he is using analog control with the drive in velocity mode. You are using step/dir control in position mode. You should not be using a PID on the LCNC side at all or you're just gonna give yourself a headache.

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

More
13 Jul 2020 14:26 #174511 by natholego11
Replied by natholego11 on topic Encoders
thanks for the input, I wasnt sure if I needed PID on the spindle or not. but the stopping immediently is a problem, it is faulting the drive every time unless i slow it to like <200 RPM then command a stop.

im not opposed to doing everything at this point in the hal, I think i can manage so I probably wont touch the PNC config any more. but the spindle at speed is something I need to look into,

im more or less reserving the PID for the axis motors, but that is something I want to try and incorporate if possible. thats the next step once I get the decel problem figured out.

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

More
13 Jul 2020 14:44 #174514 by PCW
Replied by PCW on topic Encoders
You cannot have this statement in your hal file:

net spindle-enable => hm2_7i96.0.stepgen.03.enable

Because as Blazini36 mentioned, this stops the stepgen pulse stream instantly.

something like

machine-is-on => hm2_7i96.0.stepgen.03.enable

Should work, though you should have a additional way to enable the spindle
using a digital output

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

More
13 Jul 2020 23:02 #174540 by blazini36
Replied by blazini36 on topic Encoders

You cannot have this statement in your hal file:

net spindle-enable => hm2_7i96.0.stepgen.03.enable

Because as Blazini36 mentioned, this stops the stepgen pulse stream instantly.

something like

machine-is-on => hm2_7i96.0.stepgen.03.enable

Should work, though you should have a additional way to enable the spindle
using a digital output


That's it, the "spindle-enable" signal as pncconf attaches to "motion.spindle-on" and that is confusing, it got me too. It should be "spindle-is-on" or something.

The DMM drives use sinking inputs/outputs, so you're in good shape with the 7i96 to outputs if you want to enable the drive with them as they are independent. The inputs are all based on the input common, so if you want to use sinking inputs for the DMM drive, the rest of your inputs are gonna have to be sinking too. I run a 7i76e on my mill and had to jump through hoops with optocouplers to get the drive I/O going.

Anyway, you can use an SSR output with the a >14v DC common as the 7i96 SSR output common to enable the drive. You will have to set "Servo enable active low" or something like that in DMM's software.

wiring......
You need to put >14v-24v+ on pin 4 or 16 of the DMM DB25 connector
Then put the DC common of that same power supply on the OUT0+ pin (for example) of the 7i96
connect the OUT0- pin to pin 15 of the DMM DB25(enable)

Then in hal I do it like this....
(Powers the drive external contactor)
net estop-out <= iocontrol.0.user-enable-out
net estop-out => hm2_7i96.0.ssr.00.out-01

(enables the DMM drive with the power button)
net machine-is-on <= halui.machine.is-on
net machine-is-on => hm2_7i96.0.ssr.00.out-00

(enables the spindle stepgen)
net machine-is-enabled <= motion.motion-enabled
net machine-is-enabled => hm2_7i96.0.stepgen.04.enable

As for the PID, a milling spindle is very difficult to tune because you go from no load, to full load in an instant when the cutter enters the work. When the drive is running a PID internally and you are using a controller PID it's tough enough and PIDs with stepgens are not very forgiving. Remove the PID from the LinuxCNC spindle control stepgen and I promise you won't miss it with the DMM. A servo drive can respond faster to it's own servo than a controller can.

An Axis PID is a different story, It's a much less erratic than a spindle. The DMM PID gains are labeled odd but if you want to use a DMM servo for an axis and a LinuxCNC PID, I'd ask them what settings to use to null the drives PID and LinuxCNC should be a bit more straight forward.

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

More
14 Jul 2020 00:03 #174552 by natholego11
Replied by natholego11 on topic Encoders
Blazini,
thanks for that, I will work my way through what youve posted and let you know. my guess is that the DYN4 is doing a good enough job of controlling the speed itself and I dont need to have an additional PID loop in the system for that. I guess if I had a VFD or a DC motor or something maybe thats where it would be more important. but thinking back to when I bought the servo for the spindle... thats why I bought it, so it would maintain speed iself.

on to the axis drives. I am using clearpath servos, and the ones I ordered are the step and direction kind, meant to be drop in replacements for steppers. I very much trust their ability to turn to a specified location as they are "closed loop" being servos, what I dont trust is the chinese ball screw that I have that I think is a C7 grade, and not as reliable/accurate as I wanted it. so I bought some 5um linear encoders (TTL) which are again chinese, but for now im doing the best with what I can get cheaply. so I am planning on using those to control position better than the ballscrew I am running. that being the case it should be a "simple" controls problem since its essentially a stepper motor. I downloaded what I could find online about PID tuning in linux and am going to be doing some research there. but any help would be appreciated. im not familiar with scopes in general but from what I can see i am gonna need Halscope alot for this.

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

More
14 Jul 2020 00:48 #174558 by blazini36
Replied by blazini36 on topic Encoders
A VFD would be running an internal PID as well but your control method would be analog, serial, or something and velocity control. Your LinuxCNC PID would serve you better here. The DYN4 internal PID is very ridged with S/D whereas a VFD would have a rather loose PID.

I actually have a Clearpath SD servo running on another machine on a 7i96. It's not an "axis" drive but I can help ya with that too. The Clearpath is alot more straight forward however....linear encoders are difficult to deal with and only a few people on here have used them. I suggest you get your machine going without them for a while then work on those. If your axes use properly preloaded angular contact bearings and double ballnuts, you can get very respectable accuracy. Backlash in the mount bearings, single ballnuts, and your machine not being aligned properly will be your biggest accuracy issues.

I'm redoing my Mill now because I used single ballnuts and a single double row AC bearing on each axis. I had ~.002-.005" backlash in my axes and my circular bores were't really acceptable, but I worked with it for ~2 years. I made some mistakes with my mounts and have to re-do a couple but even still I have less than .001" backlash on everything so far. Chinese ballscrews themselves usually aren't that big of a deal.

I haven't fired up halscope once on my mill. Halscope isn't a real oscilloscope, it's just a tool to visualize signals in hal. Personally I find halshow more useful than anything else. You can go nuts trying to tune a PID but you can get good results by feeling it out with the systematic old school methods.

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

More
14 Jul 2020 11:08 #174618 by natholego11
Replied by natholego11 on topic Encoders
when I built my machine that was something I considered. I have double nuts on my ballscrews. and I only recently upgraded the bearing blocks to proper AC bearings. I still need to change them out in the Y axis and the Z axis, but otherwise everything else, I think, is ok.

just check my math though real quick.
for axis pul I am getting 4064 pul/in
ballscrew is a 1605 (5mm pitch)
direct drive with a lovejoy coupler
ClearPath servos are 800pul/rev
convert the 5mm pitch to in you get 5.08 rev/in
then 800 pul/rev * 5.08 rev/in = 4064

I dont have backlash turned on in my machine because of the double ballnut and preload on the AC bearings. am I missing something else? I was getting essentially the same accuracy you were between .003-.005" off what I was shooting for...

at one point I had mapped the ballscrew with a string pot and used that functionality, it only moderately worked, what with only 256 areas it works on.... so thats why I opted for linear encoders. do larger machines not use this method of accuracy? or are they just using much more precise parts? I figured some of the machines out there were using high end encoders for accuracy.

I still have the linear encoders, I would certainly like to try and get that to work if possible. since i went through the trouble to install them. plus it will be a good exercise for me to learn about PID controls...

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

More
14 Jul 2020 22:28 #174666 by blazini36
Replied by blazini36 on topic Encoders
Yeah the math on that is correct but you still have to fine tune each axis with a dial indicator until a 1" move is exactly a 1" move discounting backlash. All my screws are 5mm and I use 1.8degree/step @ 4x microstep (800/rev) as well. 4064 is what the math says but my step scales are set between 4046 and 4071.

Mapping the screws accounts for inaccuracies in the screws, I was solely talking about backlash so just make sure you make that distinction before you do anything. I don't care much for mapping screws, I haven't seen a large enough issue with screw tolerances to worry about that. If the screws are straight they shouldn't be too bad... then again there is alot of junk out there. I tried backlash correction when I first set that machine up and 2.8pre1 came out. There was some trajectory planner bug that caused an opposing axis to correct halfway through a straight linear move on another axis. I turned it off and haven't tried since, could be better now in master IDK.

Curious why you're bothering with Clearpath servos if you want to use linear encoders. Seems like steppers would be fine if you are using external encoders anyway. There probably are machines that use linear scales for axis but they are probably on the higher end machines, but that's like the whole machine. Pretty sure Haas grade machines just use servo encoders and I hear the really big Haas machines can hold .001" over a very long axis. You can certainly use the scales but I don't think you'll get a whole lot of help cuz I've only seen it done a few times around here......but it has been done.

Not sure what type of mill you're working with but it's all about how you wanna spend your money. If I wanted to spend what I figure you spent on the Clearpaths (the one Clearpath I have was ~$1000 all in), I would have bought DMM (or similar) axis servos and really good ballscrews.

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

Moderators: cncbasher
Time to create page: 0.185 seconds
Powered by Kunena Forum