Encoders

More
20 Jun 2020 09:51 - 20 Jun 2020 09:51 #172149 by tommylight
Replied by tommylight on topic Encoders
The 7i96 has spindle encoder inputs, so a step/dir spindle can be used with encoder feedback.
The stepgen has to be set to velocity mode for this to work.
Last edit: 20 Jun 2020 09:51 by tommylight. Reason: More info
The following user(s) said Thank You: machinedude

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

More
20 Jun 2020 10:14 - 20 Jun 2020 10:23 #172151 by machinedude
Replied by machinedude on topic Encoders
and one last thing i do believe the DYN4 drives will work with just the 4 step and direction pins. i was told this by DMM i will look back through my emails to confirm this. if your using step and direction for spindle control i would think you need all 4 of those pins so you have forward and reverse?

yes i did confirm these drives will work with just the step and direction connections only. i would add the GND but they will work without that too according to DMM.
Last edit: 20 Jun 2020 10:23 by machinedude.

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

More
20 Jun 2020 14:27 #172159 by blazini36
Replied by blazini36 on topic Encoders

ok, so I got the machine moving. but I am having diffeculty with the PNCCONFIG and the spindle. I am using a DYN4 system and have it pinned as follows:
19 GND DYN4 - PIN 1 OR 9 OR 12
20 STEP 3 - N/A
21 STEP 3 + DYN4 - PIN 11 (PUL +)
22 DIR 3 - N/A
23 DIR 3 + DYN4 - PIN 22(DIR +)
24 5V DYN4 - PIN 12(ENA)

but when I get to the page where it lets me configure the spindle. its asking for an encoder input... how do I get around this, I am not at the point yet where I can hook my encoder up to the system.


Why are you only using step+ and DIR+? you can do this but the dyn4 has differential inputs and the 7i96 has differential outputs, you should be using the step/dir- pins for noise immunity especially for high step rates.

Also, what is this?
24 5V DYN4 - PIN 12(ENA)

Pin #24 of TB1 on the 7i96 is 5v+. All of the IO on the DYN4 is sinking, meaning it is active low, i.e. you put DC- to it, not +. Also any of the inputs have to reference >14v so the 5v pin of the 7i96 won't do anything for you. This doesn't apply to step/dir, encoder, or serial IO because they are on different circuits. Now the drives come standard setup as the enable isn't even active, so you wouldn't even notice that it is not working how you have it wired. If you hook up the tuning cable and connect to the drive with the DMM software you have to selact "enable active low" for it to do anything anyway. To use any of the IO you have to supply >14v+ to pin 4 or 16 of the DYN4, then use an output from the 7i96 that is referenced to DC- of that supply. That includes the enable but you can use the drive without any of this connected to get started.

What encoder are you trying to hook upto the Mesa card? is it a separate spindle encoder, or the encoder output from the DYN4? Either way it's the same deal connection wise and in hal, except the DYN4 encoder output is emulated, meaning it can be damn near any number of encoder lines you configure it as in the DYN4 drive software. If you're using a 1:1 ratio between the motor and spindle, you may as well just be using the servo encoder output, even if it's not 1:1, you can do some tricks and never need a spindle encoder unless you really want it.

You should probably not use PNCConfig for this. I haven't used it in a long time but IIRC it always wants to stuff a PID in front of stepgens. The servo drive is running a PID loop internally and it does fine, the LinuxCNC PID only causes problems running on top of the DYN4 PID. You should just deselect spindle stuff from PNCConfig and manually add it afterwards.

You should post up your hal and ini files. I've been running a DYN4 spindle drive for some time now with step+dir.

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

More
22 Jun 2020 14:14 #172343 by natholego11
Replied by natholego11 on topic Encoders
@machinedude - I dont have a way to get 0-10v, so im going to go with Step and Dir for the spindle.

@Tommy - How do you set the step gen to velocity mode? in the PNCConfig there doesnt seem to be alot of options for how certain things are configured.

@Blazini36 - I dont have an answer for why i dont have +/- hooked up, other than to say I didnt know... its not a big deal for me to wire all that up, but the original wiring diagram I got from DMM had it wired the way I have shown. pin 24 on the 7i96 is 5v, does that not need to be wired to the ENA pin on the DYN4? the DYN4 JP1 shows that the ENA pin wants 5v. I guess Im just not understanding.

the "encoder" is a magnetic proximity sensor so there is only 1 output and its normally open. so I was told I can wire that to an ENC on the 7i96 as a single input, the reason for this is because I have a 2.5:1 pulley ratio and I want true spindle speed not having to rely on maths along with my poor turning skills to assume I have a good ratio.

what else should I be using if not the PNCConfig? im not good at writing the HAL files myself from scratch.

@All, at this point I am able to get the machine jogging around. once I get the spindle working the next step is to get the encoders hooked up to the 7i85 and then configure everything from there. thatll be the next big hurtle for me. as that seems like a daunting task. not sure how to begin that but i still need to do some wiring and what not before then.

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

More
22 Jun 2020 14:36 #172345 by tommylight
Replied by tommylight on topic Encoders


@Tommy - How do you set the step gen to velocity mode? in the PNCConfig there doesnt seem to be alot of options for how certain things are configured.

linuxcnc.org/docs/html/man/man9/stepgen.9.html
Pncconfig does a lot of things, but still can not do everything possible.
For you case it can do everything as it has provisions for spindle stepgen and encoder, so should be good to go.

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

More
22 Jun 2020 23:28 - 22 Jun 2020 23:34 #172404 by blazini36
Replied by blazini36 on topic Encoders

pin 24 on the 7i96 is 5v, does that not need to be wired to the ENA pin on the DYN4? the DYN4 JP1 shows that the ENA pin wants 5v. I guess Im just not understanding.


Are we looking at the same DYN4? AFAIK, manual #ZM7-A10A covers all DYN4 drives, and there is no JP1 on a DYN4. The connector with the "enable" input is a DB25 labeled JP4. Have a look at the attached picture from the manual....Circuit A is the inputs on that connector and they are all "active low" look at the picture, it is an optocoupler array with a common high side (the 14-24v on pins 4 and 16) Meaning you have to supply the low side to the input pins to light the opto and turn the output of the opto on. If you put 5v to the enable pin your drive will still work if you did not go into the software and select "enable active low".....you just woun't have an enable at all. Technically, it's a "disable pin" since you have to actively pull it down to disable the drive. You can however probably get away with placing a resistor between the enable pin and DC- then using an output on the 7i96 to pull it up but why bother? the 7i96 can handle low side outputs. The drive outputs won't do you much good with the 7i96 since your drive outputs a low when the 7i96 has active high inputs. You can do the same resistor trick but then you have to use the input-not pins and it just gets messy.

the "encoder" is a magnetic proximity sensor so there is only 1 output and its normally open. so I was told I can wire that to an ENC on the 7i96 as a single input, the reason for this is because I have a 2.5:1 pulley ratio and I want true spindle speed not having to rely on maths along with my poor turning skills to assume I have a good ratio.


1ppr would be a lousy resolution for velocity or position, and you'll spend as much time tuning it to get something useable as you would scaling the servo encoder velocity to get a far far better result. the Servo has a 16bit encoder resolution, you should get some use out of that. The funny thing is that a spindle servo with a decent resolution encoder and a 1ppr switch on the spindle itself is all you need to do rigid tapping. If you have a spindle drive belt that won't likely be slipping it is far better to use the drives encoder output.

It's actually pretty simple there man. Go into the DYN4 drive software and set the drive to 1000 lines and a 1000 gear ratio or whatever they call it. the output of the drives encoder emulator is now 1000ppr. set the 7i96 encoder jumpers for quadrature and your 1:1 scale is now 4000ppr. Now I would enter this as my encoder scale to the 7i96 (I did), then scale the velocity and position before sending it to the motion component. You obviously want to keep it simple so if your spindle motor turns 2.5 times for every 1 time that the spindle turns.....well that is dead simple. multiply 4000 x 2.5 = 10000....and that is the encoder scale that gets entered in PCNC or whatever to set the 7i96 up. it's hal component will output the correct position and velocity. There is a very accurate (and simple) physical way to verify the exact amount of encoder counts per spindle revolution, But I don't want to complicate this one post with it, just using the math will get it very close and 10000 counts per rev is a little better than 1.


what else should I be using if not the PNCConfig? im not good at writing the HAL files myself from scratch.

Well that's why I said what almost anyone in here says...post your hal and ini files. People here will help you. PCNC is really good for getting a config started but it quickly becomes a big hindrance because once you make a manual change to the hal file you can't use PCNC again or it will overwrite it. You can stuff things in a separate hal file but if you can manage that you can pretty much just drop PCNC anyway. You might be able to get away with PCNC but running a machine on LCNC for any amount of time and you will need to learn hal sooner or later, and trust me, you'll be glad you did.




Attachments:
Last edit: 22 Jun 2020 23:34 by blazini36.
The following user(s) said Thank You: tommylight

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

More
09 Jul 2020 01:41 - 09 Jul 2020 01:46 #174047 by natholego11
Replied by natholego11 on topic Encoders
Blazini,
so I did what you said with a few modifications (also the 7i96 has ttl or differential encoder inputs, im assuming ttl is the correct one in this case) and I think I am getting what I am supposed to be getting out of the DYN4. its set to Gear ratio:1000 and line:1000

my linux is set to:
step scale - (-4000)
max accel 40
max vel 25
encoder scale 1000

and its not allowing me to run any faster than that it gives me the error
"hm2/hm2_7i96.0: stepgen.03.maxvel is too big for current step timings & position-scale, clipping to max possible"
and it automatically sets the max vel to 25.

the motor will spin at 3k rpm giving me approx 7500 rpm at the spindle. I have the encoder (on the spindle) hooked up to a digital read out so I can see actual spindle speeds, and it looks like its spinning at the correct speed when I command 1000 RPM, so now its just a matter of getting this max vel error out

attached is my ini and hal file.
Attachments:
Last edit: 09 Jul 2020 01:46 by natholego11.

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

More
09 Jul 2020 03:05 - 09 Jul 2020 03:08 #174048 by PCW
Replied by PCW on topic Encoders

hm2/hm2_7i96.0: stepgen.03.maxvel is too big for current step timings & position-scale, clipping to max possible
and it automatically sets the max vel to 25.


This means your spindle step timings will not allow a high enough step rate to reach 50 RPS
That is, currently you have 5 usec step length and 5 usec step space so the minimum cycle
time is 10 usec so the maximum frequency is 100 KHz. Since you have 4000 steps per turn,
25 revolutions per second = 100 KHz. One way to fix this is to shorten the step length and step space
for example, 2000 ns for both steplength and steppace, would get you to 250 KHz so allow 50 RPS
with some margin. Another option is to lower the steps per turn on your drive.
Last edit: 09 Jul 2020 03:08 by PCW. Reason: clarify

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

More
09 Jul 2020 17:58 #174113 by natholego11
Replied by natholego11 on topic Encoders
@PCW I will try and adjust the values tonight. I am trying to get an answer from DMM on what exactly the line number and the gear number mean, and how to set those so I can maximize what I have.

@blazini,
Ive got the DMM wired up to the 7i96 like you are showing in section 2.3.3 JP4 Interface and all seems to be working well, my problem right now is that the ACCELERATION seems ok and adjustable. but when the spindle is commanded to STOP it stops almost immediately. how do I set a DECELERATION in linux so it will slow at a commanded rate?

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

More
11 Jul 2020 13:26 - 11 Jul 2020 20:03 #174302 by blazini36
Replied by blazini36 on topic Encoders

@PCW I will try and adjust the values tonight. I am trying to get an answer from DMM on what exactly the line number and the gear number mean, and how to set those so I can maximize what I have.

@blazini,
Ive got the DMM wired up to the 7i96 like you are showing in section 2.3.3 JP4 Interface and all seems to be working well, my problem right now is that the ACCELERATION seems ok and adjustable. but when the spindle is commanded to STOP it stops almost immediately. how do I set a DECELERATION in linux so it will slow at a commanded rate?


I just had to rewrite this post cuz I noticed your hal and ini files.

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.

DMM'd gear number is the stepgen command scale and the line number is the emulated encoder output scale. These are per turn, but they are both quadrature so if you set gear number to 1000, the step scale of linuxcnc needs to be 4000, which you have. Why are you doing this:
setp hm2_7i96.0.encoder.04.counter-mode 1 (this means not quadrature)
and this:
ENCODER_SCALE = 1000 (which explains this)
with this?
DMM line_num=1000 (because of this)

If you are using the DMM encoder output for LinuxCNC I pretty much already told you what you need to have them set to. The problem is you aren't using quadrature but I'm not sure why. Set this:
setp hm2_7i96.0.encoder.04.counter-mode 1 (cuz now counts are x4)
keep this:
DMM line_num=1000
But now you need to figure this out:
ENCODER_SCALE = ?

this only works if you are using a single channel of the encoder because you are not using quadrature, in other words A, but not B. If you don't use quadrature, you're going to have shit encoder resolution (literally 1/4). If you use TTL rather than differential then you may have noise issues and miss counts and be speed limited by the signal integrity. You have the abillity to use quadrature counting and differential signalling right now so why you wouldn't is beyond me.

if you have the DMM outputting 1000 lines in quadrature (which it is) you need your A/B channels connected whether you use +/- or not, the 7i96 will see 4000 pulses per rev. But you don't care how fast the motor is spinning, the drive is handling that internally based on the number of steps your sending. You need to know how fast the spindle is moving and you say the pulley ratio is 2.5:1 so:
4000(counts per rev) x 2.5(spindle ratio) = ENCODER_SCALE = 10000. If you were using your spindles encoder, assuming it is direct drive or 1:1, it would just be encoderPPR x 4(if quadrature) because there is no pulley ratio to consider. This will get you close enough but your belt drive is probably not exactly 2.5:1, I can tell you how to get an exact number with no guesswork but you need to get this stuff right first or it will just confuse you.

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.
Last edit: 11 Jul 2020 20:03 by blazini36.

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

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