Urgent help required with EMC please

More
14 Aug 2016 18:00 #78759 by sxyuklad
OK, so I have a few things and updates to share.

This new PC gave me the maximum number on testing that I shared a screenshot of (20324). I entered 20000 in stepconf and guess what this time linuxcnc did not give me any error of delay or latency which I used to have with my old PC. As soon as I started linuxcnc, it just gave me latency error and I was really surprised why that was happening because I thought I had already set the jitter number very high. So 350000 was never going to do it as you pointed out quite right.

Now, PC side, everything fine, I believe this number will work for me (still awaiting your feedback on this).

I tried to hook up my spindle as it was with Mach3 and playing a little bit with settings here and there (in stepconf spindle tab), I actually got it working. I have actually managed to set the scale perfect like if I say run at 50rpm, it is 50, 100 is 100, 200 is 200 and upto 1500. That is the max rpm of my motor so not going above that anyway. This is very satisfying day for me because everyday with your help, I am making progress.

Now, the only big thing left is basically the ATC.

But, I do have a small problem to be addressed before that. Spindle scaling is bang on but the problem I am having is, the spindle rpm not stable. There is difference of plus minus 15. So 30rpm in total it goes up and down. For example I say S200, it keeps wandering between 185 to 215 rpm, it goes up and down, up and down so quickly that is it never stable. Interesting thing is, this variation in spindle rpms is not in percentage. Like if it was in percentage and at 200 rpm there is 30 rpm total difference, so similarly at 400 rpms the difference should have been 60 rpms as percentage. But it is not in percentage, no matter what rpm, it is the same 30 to 35 rpm difference. I hope you got my point. What do you think the problem could be?

Do you think could be that I need to change values of my electronics components or there is noise on the encoder lines? There are two optical encoder scanning a disk 100 hole disk and 1 tab for index. I will try to take photos and share. But let me make it clear, the optical sensors board is from the manufacturer of the lathe, I did not amend or change it anyway. It has resistors and a capacitor on it. So do you think that I may need to change the values of these components which I according to me will be less likely the case. Because it is from a very reliable manufacturer (EMCO) which is famous for making very good lathes. So obviously what they used on the board to get the encoder pulses is better than what I may use. They have professional electronics engineers who understand things much much better than I do. The only reason I see is maybe they designed it to used with their system (it had its own complete cnc system), so it may not work with linuxcnc, that is the only possibility that I may need to make my own sensor board. But I again for this, I will need your or someone else help who can sketch a schematic for me which will work with linuxcnc.

Having said all this, I also believe there maybe a setting in linuxcnc which I need to tweak or add to the files to get stable rpm. You know sensors maybe outputting clean signal but there is some sort of setting which I am not familiar with. Please guide. Your thoughts and links are helping me alot.

After explaining all this, when I look back two days ago, I am making progress you know. If I look at my project, the only big thing left is ATC and the rest is almost done once I get the stable rpms.

OK, let me talk a little bit about ATC if you can help with programming. If I can know only a few statements, I think I will be able to write the ATC code. So if you can throw a little light on the following points:

1. I have enabled manual tool change via stepconf. Which setting or line I need to add to which file to make it auto tool change?
2. When you give M06T0202 command for example, what happens, every cnc software goes to a section of code related with M6 command and runs it. Where and in which file is the code which runs when you issue an M6 command? In mach3, there is folder called macros under your profile name and there is separate file called M6start which basically runs top to bottom when an M6 command is called for. I did not have much VB knowledge but looking at other poeple macros, I stole a few statements and understood what exactly they meant, I was able to write my macro in Mach3 VB script. So I am hoping to do the same here with linuxcnc.
3. First of all, I need to store the CURRENT TOOL NUMBER, NEW TOOL NUMBER to variables. Do you know the language I can do that in linuxcnc? In mach3, it was like old_tool = GetCurrentTool() and new_tool = GetSelectedTool(). So the values go into these two variables.
4. Next I need to know, how to wait for an input to go high or low. The code should stop there and wait for the said input to go high or low as programmed and once it gets the signal, it moves forward. Do you know the statements for this? In mach3 it was pretty easi with while wend loop like "While Not IsActive(INPUT1)"..... "Wend"or "While IsActive(INPUT1)"....."Wend".

INPUT1 here is basically tied to a parallel port so the code waited there as the motor is moving and as soon as the optical sensor made the signal low or high, the code began and moved forward. I need to know the exact type of statement in linuxcnc language. I do not know what language it uses. Is it python?
5. Next I also need to make a counter to count pulses and stop at the right tool number as you can see in the macro I wrote. I am attaching it here, you will understand it quite easily with a little bit of knowledge of VB scripting. Basically, two outpus are the relays, Output5 turns on the motor power and OUTPUT6 moves it forward and when off, it moves reverse to lock the ATC against ratchet/pawl. INPUT1 is for tool no. 1 only that is ATC index too. INPUT2 is basically mark at every tool location to count tool numbers.

I am attaching macro so you can see what I sort of program I need. Just use any text editor to open it (Notepad) or Notepad++.

Thanking and will be waiting for your detailed input on the said matters. Thank you.

OldTool = GetCurrentTool()
tool = GetSelectedTool()
NewTool = tool
MaxToolNum = 6
CurrPos = OldTool
Steps = 0
i = 0

While (NewTool > MaxToolNum)
NewTool = Question ("Enter New Tool Number up to " & MaxToolNum)
Wend

If (NewTool = OldTool) And (NewTool > 0) Then
Exit Sub
End If

If (OldTool = 0) Then
ActivateSignal(OUTPUT5)
ActivateSignal(OUTPUT6)
While Not IsActive(INPUT2)
Wend
CurrPos = 1
SetCurrentTool(CurrPos)
If (CurrPos = NewTool) Then
DeActivateSignal(OUTPUT6)
Sleep(2000)
DeActivateSignal(OUTPUT5)
SetCurrentTool(NewTool)
Exit Sub
End If
End If

If NewTool > CurrPos Then
Steps = NewTool - CurrPos
Else
Steps = MaxToolNum - CurrPos + NewTool
End If
Steps = Steps + 1
ActivateSignal(OUTPUT5)
ActivateSignal(OUTPUT6)
CountPulses:
While Not IsActive(INPUT1)
Wend
i = i + 1
While IsActive(INPUT1)
Wend
If (i = Steps) Then
DeActivateSignal(OUTPUT6)
Sleep(5000)
DeActivateSignal(OUTPUT5)
SetCurrentTool(NewTool)
End
End If
GoTo CountPulses
Attachments:

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

More
14 Aug 2016 20:55 #78772 by Todd Zuercher
Glad to hear that you are making progress.

The fact that your spindle speed seems to be fluctuating by a fixed number of RPMs doesn't seem to be surprising to me. It may simply reflect system jitter in the PWM generation and encoder reading. (I haven't put forth the effort to do the math to see if the numbers add up to those amounts to confirm.)

Latency scores in the 20000-30000 range should be acceptable. They aren't stellar numbers and could limit your rates some. I would first make sure that you have gotten the computer set up as good as possible. One more thing to try with a multi core CPUs it often helps to set up ISOCPUS. This isolates 1 (or more) of the CPU cores to only be used for real time computing. This can often improve the latency times by 3-4 times better than you had.

I'm afraid that I won't be much help with the ATC questions, as I have not done an ATC on Linuxcnc yet.

To get more help from others on the ATC subject, I'd suggest starting a new topic on the forum specifically about configuring your ATC.

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

More
14 Aug 2016 22:25 #78780 by PCW
Also I would suggest reading the man page for the carousel tool changer component:

man carousel
The following user(s) said Thank You: sxyuklad

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

More
15 Aug 2016 02:58 #78785 by sxyuklad
How to setup ISOCPUS, if you can guide me please. In the BIOS?

I checked my spindle encoder inputs with Halscope, built in feature. Both Index and Phase A seems to be doing pretty good, I will take images and share. But I do not know why there is so much up and down in rpm readings. Now after checking the signals, I believe there should be a filtering setting like Mach3 has debounce settings.

But the problem is whenever I google something about linuxcnc, it never comes up. I was trying a synchronized motion (thread) but linuxcnc will give me an error "Spindle not turning in G76". There is absolutely no help on this error and this is what I hate the most. Try it, you will not get a single google result on this error. How am I supposed to know what this error means and what code I need to enable turning in G76... Ahh. I really need to sort this out.

I seriously want stable rpm. The sensors are doing pretty good job, the PC latency test is not that bad, then I do not know why it will not stabilize my rpm.

Await your input.

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

More
15 Aug 2016 07:24 - 15 Aug 2016 07:41 #78786 by Rick G
Have you read these?
linuxcnc.org/docs/html/examples/spindle....d_spindle_feedback_a
linuxcnc.org/docs/2.7/html/gcode/g-code.html#gcode:g76
sourceforge.net/p/emc/mailman/message/33701301/

Like other synced moves, G76 should error if spindle is not turning

Was the spindle turning?

The sample program g76.ngc shows the use of the G76 canned cycle, and can be previewed and executed on any machine using the sim/lathe.ini configuration.


Rick G
Last edit: 15 Aug 2016 07:41 by Rick G.
The following user(s) said Thank You: sxyuklad

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

More
15 Aug 2016 10:18 #78790 by sxyuklad
Hi Rick

Yes I have gone through all these documents. Nothing is working. No matter what it gives me the same error. Yes, I tried turning on the spindle and turning off too. It just gives me the same error. I do not what I am missing. The rpm shows which means linuxcnc is receiving encocder pulses and know spindle is turning then gives me this error. I do not know. Anyone please any suggestions. I am stuck on a simple thing.

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

More
15 Aug 2016 11:24 #78792 by Rick G
Might want to look here...
forum.linuxcnc.org/forum/49-basic-config...s-on-g33-g76-command

and check your hal connections.

Also you may want to try the sample g76.ngc program on the sim lathe configuration.

The G76 canned cycle is based on the G33 Spindle Synchronized Motion. For more information see the G33 Technical Info.
The sample program g76.ngc shows the use of the G76 canned cycle, and can be previewed and executed on any machine using the sim/lathe.ini configuration.


Rick G
The following user(s) said Thank You: sxyuklad

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

More
15 Aug 2016 13:56 #78799 by sxyuklad
Hello Rick

Finally I got it working. I do not know exactly how, but I kept playing around with my hal file for hours. Trying different things from the forum and all that. And magically it just worked.

Still got unstable rpm readout. Encoder signals are clean, I do not know why linuxcnc would not keep them stable. Do you know how to add debounce settings for spindle encoder input signals? That may be the problem. But I got the syncronized motion at least. I need to stabilize spindle encoder rpm readout somehow if you can help.

And the next big thing is my ATC. Searching around, I found 2 people have already written ATC which are very close to the one I want. Just a little alteration and it will suit me perfect. Now, the problem is I have no knowledge of altering the code sir. Do you have any knowledge and help me just altering the comp and counter stuff and inputs and outputs. The code is already there, just need a little alteration and I will be done. Can you help? If you can then I can share the comp and then we can work on it to suit my needs. Please help me altering it.

Thank you.

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

More
15 Aug 2016 15:09 - 15 Aug 2016 15:19 #78802 by Todd Zuercher
As to your limited number of I/O, You could simply add another parallel port. PCI parallel port cards are cheap and can be configured as input (13-in 4-out) or output (5-in 12-out) or X-mode (9-in 8-out, but good luck finding a breakout that supports X-mode though) . (You can have up to 8 of parallel ports.). I've used 3 parallel ports on a couple of machines. Or you could consider better interface hardware, maybe something that supports hardware step generation, and encoder reading (something from Mesa or Pico Systems)

ISOLCPUS is configured in software. It is a setting that is saved in the Grub boot options.

To set it up one way is with a text editor edit the file /etc/default/grub
From a command prompt type
sudo mousepad /etc/default/grub
look for a line that starts like this
GRUB_CMDLINE_LINUX_DEFAULT=
At the end of that line but inside the quotes add isolcpus=1 for a dual core cpu (for a quad core add isolcpus=2,3)
like this.
GRUB_CMDLINE_LINUX_DEFAULT="lapic quiet rootdelay=5 isolcpus=1"
Save it, and then at the command prompt type
sudo update-grub
reboot
Then open the Linuxcnc config picker, and open the latency-histogram (under the sub-menus Sample Configurations/apps/latency)
At the top of the latency histogram window it will tell you if isolcpus is active and what cores are isolated.
Last edit: 15 Aug 2016 15:19 by Todd Zuercher.

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

More
15 Aug 2016 15:53 - 15 Aug 2016 16:16 #78807 by cncbasher
you wish to alter the atc ?, what do you need ?
the emco or orac toolchanger components , are quite specific to this type of tool changer
where their is a pawl to reverse on to ,
using M6 T2 for instance will start the atc and select tool 2

also you will need to know if this is using a stepper motor or a dc motor , as their are 2 types

spindle not turning on g76 is usually a problem with the encoder running backwards rather then in sync with the spindle
and also possible is it requiresthe spindle speed to be within x% of speed before it will start the spindle turning , so having the spindle speed encoder be exact helps
Last edit: 15 Aug 2016 16:16 by cncbasher.
The following user(s) said Thank You: sxyuklad

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

Time to create page: 0.138 seconds
Powered by Kunena Forum