Can PNCconf set up my spindle encoder?

More
10 Oct 2014 21:44 #51948 by cncbasher
M19 works , if your unsure of setting this up post a full archive of your config files or email me , and we can add it , and go from their
follow the link Andy posted makes it much clearer ( thanks Andy)

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

More
10 Oct 2014 21:59 #51949 by andypugh
Note that the example I linked to uses open-loop spindle speed and closed-loop spindle position. If you wanted closed-loop spindle speed then that would require a second PID.

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

More
12 Oct 2014 03:57 - 12 Oct 2014 04:06 #51969 by akb1212
I know the M19 works now, which is why I expected the wiki to have been written some time ago when it wasn't......
And I also hope to be able to use it to its full extent, with the possibility to set the required rotational angle as I need.

So far the configs I have found (including yours Andy) does set the orient angle to a fixed value in the hal file. I assume that is what this line does?:
setp orient.0.angle 180

How does the angle data provided with the M19 command do this? Is it adding the given value to this initial angle, in effect making the programmed angle a matter of setting the home position of the spindle?

I have attached my ini and hal file as requested. I have switched to gmoccapy for GUI as I find it far superior to axis, and a lot easier to work in. It is what I intend to keep working in, and it's only standard stuff added to a standard axis config. So I hope that's no problem.

I just did a test, and I have no control over the speed of my spindle. I can only turn it on and off. It goes to full speed (which is +/-10V on the analogue outputs), and goes correctly forwards and backwards.
Not sure when and how, but I'm fairly sure I was able to control the speed of the spindle at one time (when I used Axis GUI) by issuing S commands. I have configured it to use the encoder (I think...). It's a standard 1024 ppr encoder with index. I know its working as I have watched the values change as expected in halmeter. The encoder is fitted on the spindle directly, so it's not affected by the two speed gearbox.

And yes, I would very much like to have full PID control over the speed as well. I have intention of using it to put small work pieces in the spindle and using it as a lathe for small parts. That means I'd like to use CSS. And I will use it for rigid tapping. And since the encoder is there it's the best way to make things accurate.

I do expect the PID loop to be affected by a gear change (PID values might change since things are mechanically different). And to be honest I don't know how to make the gears work yet either. It has 2 switches as sensors to indicate what gear it's in. And several outputs to control the gear change motor. I guess it should be straight forward to program the needed logics in a ladder program. I need one for my ATC anyway, so I guess making the gear box work first will be a good exercise on how to work with ladder logic.
I guess I will be following the Brother TC-211 thread to see what happens there as well.

Here is a zip of my ini and hal files. If I need to attach any other files let me know. I haven't made anything out of the standard config as far as functionality in gmoccapy.

File Attachment:

File Name: Gmoccapy_m...test.zip
File Size:4 KB


BTW, I really appreciate the willingness to help me out here. I hope it will be helpful to others as well.
Can I just ask one small thing: It's much easier to follow what's been added if you can add comments on what parts are inserted by you guys. That way I know what parts you have manually added and what parts are made by pncconf. That is a good idea for learning. And if error finding is needed I know where to look (as I know the config work as it is now).

Anders
Attachments:
Last edit: 12 Oct 2014 04:06 by akb1212.

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

More
12 Oct 2014 04:31 #51970 by andypugh

So far the configs I have found (including yours Andy) does set the orient angle to a fixed value in the hal file. I assume that is what this line does?:
setp orient.0.angle 180
How does the angle data provided with the M19 command do this? Is it adding the given value to this initial angle, in effect making the programmed angle a matter of setting the home position of the spindle?

It rather depends on what you want to have. You could simply net the orient.0.angle to the M19 angle output pin instead of setp-ing it in the hal file. eg
net orient-angle motion.spindle-orient-angle => orient.0.angle
www.linuxcnc.org/docs/html/man/man9/motion.9.html
If, however, you wanted a fixed angle on tool change and spindle orient on M19 as a separate function, then you would need to use a mux2 to choose between the fixed value and the M19 value, and have an or2 function so that the position-feedback PID was activated with either M19 (motion.spindle-orient) or a tool-change request (iocontrol.0.tool-change)

I just did a test, and I have no control over the speed of my spindle. I can only turn it on and off. It goes to full speed (which is +/-10V on the analogue outputs), and goes correctly forwards and backwards.

I think this might be a bug in PNCConf, or at least a misunderstanding.

Change all the numbers at the end of your INI file to suit the max spindle speed:
OUTPUT_SCALE = 10.0
OUTPUT_MIN_LIMIT = -10.0
OUTPUT_MAX_LIMIT = 10.0
This config set makes any speed above 10 rpm max speed.

See this thread for info on how to work with your gearbox: www.linuxcnc.org/index.php/english/forum...cconf?start=10#51927 (et seq)

As for the config I pointed at, I never had the working file. In fact I don't have spindle-orient on my machine.

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

More
13 Oct 2014 04:22 #51984 by akb1212

M19 works , if your unsure of setting this up post a full archive of your config files or email me , and we can add it , and go from their
follow the link Andy posted makes it much clearer ( thanks Andy)


I really appreciate this offer, and would like you to add it to the config I posted in my previous post if possible. I hope the fact thay I don't use axis is a problem in this regard. If so it should be easy enough to comment out the parts related to gmoccapy and set axis as GUI.

Just out of curiosity, is there a guide on what to add to get M19 to work?

And I'm happy with using M19 for tool change. So I won't need additional logics to control that.

On the gear changing: Will I need different tuning depending on what gear I have chosen? The characteristics will differ, but is this difference large enough to go through the effort of setting up two PID systems and add them together? Then use a mux and logic to zero out one or the other depending on the gear indicators. This will leave only one working at a time and they can both be active.

Anders

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

Moderators: cmorley
Time to create page: 0.229 seconds
Powered by Kunena Forum