585,741 active members*
5,036 visitors online*
Register for free
Login
IndustryArena Forum > Machine Controllers Software and Solutions > Dynomotion/Kflop/Kanalog > Setting up Feed, Rapid and Spindle override with potentiometers...
Page 1 of 2 12
Results 1 to 20 of 37
  1. #1
    Join Date
    May 2012
    Posts
    537

    Setting up Feed, Rapid and Spindle override with potentiometers...

    Hi guys looking for some help with setting up override knobs on my machine. First of all what resistance potentiometer is best to work with the Kanalog analog inputs? I have 5v and 12v supplys available.

    Next question, is there a c-program floating around for rapid override? If not what is the command to change it? I found an example of FRO and SSO here: http://www.cnczone.com/forums/dynomo...c-program.html

    And Im just learning basics of C programming so just want to confirm im on the right track. Both of these programs need to be merged into my init program right? Everything above main() goes above main in my init program and everything in the for (;;) loops gets added to my for (;;) loop right? How about the line in between main() and the for (;;) loop? In this case the FRO program reads: double Pot,FRO,T; and the SSO program reads double Pot,SSO,T; Do i need both lines before my for (;;) loop or could i just use double Pot,FRO, SSO,T; ?

  2. #2
    Join Date
    May 2006
    Posts
    4045

    Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Hi mmurray70,

    First of all what resistance potentiometer is best to work with the Kanalog analog inputs?
    I'd suggest around 2K Ohms.

    I have 5v and 12v supplys available.
    The Kanalog ADC Inputs are +/-10V. So 12V would require a series resistor of ~20% to reduce the range to 0-10V. Otherwise 5V could be used and you would get 1/4 of the range (4096/4=1024 count range).

    is there a c-program floating around for rapid override? If not what is the command to change it? I found an example of FRO and SSO here: Setting Feed and spindle by C program?
    The interface for Rapid Rate Override hasn't been added to KMotionCNC. We will try to add it into the next Test Version. If you are capable of adding the code to KMotionCNC please post the changes for us to merge.

    And Im just learning basics of C programming so just want to confirm im on the right track. Both of these programs need to be merged into my init program right?
    Yes

    Everything above main() goes above main in my init program
    Yes these are called global variables/defines. The same defines can be used for both functions so only include those once.

    and everything in the for ( ; ; ) loops gets added to my for ( ; ; ) loop right?
    Yes except for any redundancies (you only need/want one WaitNextTimeSlice() in the loop)

    How about the line in between main() and the for ( ; ; ) loop? In this case the FRO program reads: double Pot,FRO,T; and the SSO program reads double Pot,SSO,T; Do i need both lines before my for ( ; ; ) loop or could i just use double Pot,FRO, SSO,T; ?
    Yes these are local variables for the main function.

    double Pot,FRO, SSO,T;

    is correct as the same "Pot" and "T" variables can be used for both SSO and FRO.

    HTH
    Regards
    TK
    http://dynomotion.com

  3. #3
    Join Date
    May 2012
    Posts
    537

    Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Quote Originally Posted by TomKerekes View Post
    The interface for Rapid Rate Override hasn't been added to KMotionCNC. We will try to add it into the next Test Version. If you are capable of adding the code to KMotionCNC please post the changes for us to merge.
    So are you saying KmotionCNC will not update the display for rapid override? Thats no big deal. So looks like i need to use the SetRapidFRO <F> command right? I think i can probably handle this. Just add code to check pot and output say SetRapidFRO 0.50 for 50% override? Sounds easy enough. Thanks again.

  4. #4
    Join Date
    Dec 2007
    Posts
    578

    Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Hi murray,
    Did you get the potentiometers working for both Spindle Override and Feed Overrides? And did you do one for Rapid Override?
    Thanks,
    Troy

  5. #5
    Join Date
    May 2012
    Posts
    537

    Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Quote Originally Posted by Need TECH Help! View Post
    Hi murray,
    Did you get the potentiometers working for both Spindle Override and Feed Overrides? And did you do one for Rapid Override?
    Thanks,
    Troy
    Hi Troy,

    Yes I used potentiometers for all three and it works well, and best of all Its not too hard to setup. Just connect one side of the pot to ground, the other to 5v-10v and the wiper (middle pin) connects to Kanalog analog inputs. See attached for the code im using. I chopped this out of my init file, let me know if I missed something. You can also use the SetFROwithpot.c and SetSSOwithpot.c examples, but my example shows rapid too. You may have to tinker with the code a little, for example scale the input if a different voltage is used, and adjust maximum and minimum values to suit. I also added a deadband too so that 100% is easier to find. I found it annoying to see 0.99 or 1.02 on the screen, now it jumps to 100 if close. Good luck with it, let me know if you need anything else.

    Mark

  6. #6
    Join Date
    Dec 2007
    Posts
    578

    Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Hay Mark,
    Awesome, Will need to get some potentiometers as I only have 5k. Did you use a detent pot, linear, audio or?

    Thanks again,
    Troy

  7. #7
    Join Date
    May 2012
    Posts
    537

    Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    They were just normal rotary potentiometers, nothing special. Try and find one with a 1/4 shaft as this will be the easiest to get or make a knob for. Not a big fan of linear as they can get dirt inside. I didnt realize you could get them with detents until you just mentioned it. Might be handy to have a center detent at least so you know when your back at 100%.

    If your ordering new ones might as well get the 2k that Tom recommended, but if you have 5k already id try them. Im pretty sure they would work perfectly fine. Still going to vary the voltage the same way, and the input to Kanalog isnt going to draw any amount of current to throw anything off. Should be fine.

  8. #8
    Join Date
    Dec 2007
    Posts
    578

    Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    I didnt mean linear as mechanical movement but as type of taper. Mechanically they will be rotary. Only have 2 right now so i will need to buy another for the rapid override and might as well get 3 new ones that are all the same.

  9. #9
    Join Date
    Dec 2007
    Posts
    578

    Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    I have pots working. Wondering tho, if c code can be adjusted to bring feeds and spindle speed to 0? Or is this limited to the way KMCNC needs to work?
    Also, when FRO is over 100% it takes a couple seconds before feed updates. Is there some configuring I need to change? My look ahead is set to 1 and anything under 100% updates almost instantly when using potentiometer.

    Thanks again,
    Troy

  10. #10
    Join Date
    May 2012
    Posts
    537

    Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    On my machine turning the feed to minimum pretty much stops it, but i guess it is creeping along at some speed.

    If you really wanted a complete stop you could probably set your init file to do a stopcoordinatedmotion command if the pot value was below a certain number. You could also have it set a variable or bit at the same time to indicate it was stopped by the potentiometer. And then it could be resumed automatically if the pot is over a certain range, and this variable is set. Shouldnt be too hard to do. The spindle could probably be done the same way, but it might take a few extra steps if you want to add delays for it to ramp up to speed.

  11. #11
    Join Date
    May 2006
    Posts
    4045

    Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Hi Troy,

    I have pots working. Wondering tho, if c code can be adjusted to bring feeds and spindle speed to 0? Or is this limited to the way KMCNC needs to work?
    You should be able to command FRO of 0 to stop, or even a negative value to reverse. The problem is probably due to the analog signal will never be exactly zero due to noise, offsets, etc. You might force 0 below some threshold.

    when FRO is over 100% it takes a couple seconds before feed updates. Is there some configuring I need to change? My look ahead is set to 1 and anything under 100% updates almost instantly when using potentiometer.
    You might read this.
    TK
    http://dynomotion.com

  12. #12
    Join Date
    Dec 2007
    Posts
    578

    Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Hi Tom,

    So far iam able to issue a Feed Hold when any override is below a certain amount but cant get a resume action to happen when override is above a certain amount, I must press my CycleStart button to resume, which isn't bad but would be better if the resume action would happen when override pot is turned back up a certain amount. There is also a conflict with the behavior of my physical CycleStart and FeedHold button.
    Should the code that would issue a stopcoordinatedmotion command be with the part of code that handles my physical Start and Feed hold buttons? I tried doing this but could not figure it out.

    You might read this.
    Ahh, ok, that's what the setting in the Feed Rate Override is for on the Trajectory Planner Tab. One of those settings I never gave any thought about what it might do.

    Command FRO of 0 causes a pop up stating Enter a value between .1 and 2. Which now that iam using override pots, can this pop up be turned off?

    I have attached my current INIT code.

    Thanks,
    Troy
    Attached Files Attached Files

  13. #13
    Join Date
    May 2012
    Posts
    537

    Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Quote Originally Posted by Need TECH Help! View Post
    Hi Tom,

    So far iam able to issue a Feed Hold when any override is below a certain amount but cant get a resume action to happen when override is above a certain amount, I must press my CycleStart button to resume, which isn't bad but would be better if the resume action would happen when override pot is turned back up a certain amount. There is also a conflict with the behavior of my physical CycleStart and FeedHold button.
    Should the code that would issue a stopcoordinatedmotion command be with the part of code that handles my physical Start and Feed hold buttons? I tried doing this but could not figure it out.


    Ahh, ok, that's what the setting in the Feed Rate Override is for on the Trajectory Planner Tab. One of those settings I never gave any thought about what it might do.

    Command FRO of 0 causes a pop up stating Enter a value between .1 and 2. Which now that iam using override pots, can this pop up be turned off?

    I have attached my current INIT code.

    Thanks,
    Troy
    Hi Troy,

    if (FRO < .03) FRO = StopCoordinatedMotion(); should be:
    if (FRO < .03) StopCoordinatedMotion();

    But you would also need to set a variable or bit upon stopping and check for this variable AND the pot being set higher to resume. Toms way is alot easier and makes more sense. If you can get past the popup, Just use:

    if (FRO < .03) FRO = 0;

    Good luck with it.

    Mark

  14. #14
    Join Date
    Dec 2007
    Posts
    578

    Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    I tried using :
    if (FRO < .03) FRO = 0;
    nothing seems to change when override reaches .03.

    Troy

  15. #15
    Join Date
    May 2012
    Posts
    537

    Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    No it wont actually show a feed hold or anything this way, but it should stop moving completely. You removed the stopcoordinatedmotion line right? All you will need this way is just the one line:
    if (FRO < .03) FRO = 0;

    If your still having trouble for some reason and want to try the other way id probably try something like this:
    Code:
    if (FRO < .03 && !ReadBit(xx))             	// If FRO below 0.03 and not already stopped
    	{
    	StopCoordinatedMotion();	       // Stop
    	SetBit(xx);		                 // Set bit to indicate stopped by pot
    	}
    
    if (FRO > .04 && ReadBit(xx))             	// If FRO above 0.04 and stopped by pot
    	{
    	ResumeCoordinatedMotion();	        // Resume
    	ClearBit(xx);	                        // Clear bit to indicate stopped by pot
    	}
    This should apply a proper feedhold and then remove it when you increase the pot. You will have to enter some number in place of XX for an unused bit. I think there is a range of numbers that can be used for things like this that are not used for any inputs and outputs but im not sure what they are, maybe Tom can help with that. Any unused output number should work fine as well to test.

  16. #16
    Join Date
    May 2006
    Posts
    4045

    Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Hi Troy,

    It isn't clear whether you expect the sliders on the Screen to show or work properly. This is always a problem with multiple ways of setting things.

    For right or wrong KMotionCNC ignores FRO commands less than 0.001. Also the Slider and Feedrate edit control have a limited range down to 0.1.

    So much like Mark suggested I tried the code below and it seems to work reasonably well. What is sent to KMotionCNC is limited to 0.1. But below that a Feedhold is issued and PotSetFeedhold remembers that we did this so we can resume when the level goes above 0.1.


    Code:
        BOOL PotSetFeedhold=FALSE;
        
        for (;;)                    // loop forever
        {
            T = WaitNextTimeSlice();
            Pot1 = (double)KANALOG_CONVERT_ADC_TO_VOLTS(ADC(0));
            Pot2 = (double)KANALOG_CONVERT_ADC_TO_VOLTS(ADC(1));
            Pot3 = (double)KANALOG_CONVERT_ADC_TO_VOLTS(ADC(2));
            FRO = Pot3 * 0.217;
            FRO = persist.UserData[9] * 0.001;
            RAPIDO = Pot2 * 0.117;
            SSO = Pot1 * 0.17;
    
            if (FRO <= .1)
            {
                FRO = 0.1;
                StopCoordinatedMotion();
                PotSetFeedhold = TRUE;
            }
            else if (PotSetFeedhold)
            {
                ResumeCoordinatedMotion();
                PotSetFeedhold = FALSE;
            }
    Will this work for you?
    TK
    http://dynomotion.com

  17. #17
    Join Date
    Dec 2007
    Posts
    578

    Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    I have the sliders hidden so don't need them.
    Will give the code a go tonight.
    Thanks,
    Troy

  18. #18
    Join Date
    Dec 2007
    Posts
    578

    Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    I tried adding your above code to my main init and there is no response when I change potentiometer. The Feed Rate box stays at 2 no matter what position the potentiometer is at. I most likely inserted code wrong.

    Attached is my main init with new code.

    Troy
    Attached Files Attached Files

  19. #19
    Join Date
    May 2006
    Posts
    4045

    Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Hi Troy,

    I’m sorry. Please remove this line that I was using to simulate the pot value.

    FRO = persist.UserData[9] * 0.001;
    TK
    http://dynomotion.com

  20. #20
    Join Date
    Dec 2007
    Posts
    578

    Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Hi Tom,
    Thats the problem with being a copy and paste person like me, i dont really understand just how the code works. I do at times pick up something tho That said i was able to get all 3 overrides to issue a FeedHold when set to minimum. But now during a Gcode program run ,with Spindle running, my physical CW,CCW and Off buttons do not operate spindle but the keyboard hotkeys F9,F10 and F11 do work. Does this mean that the c code i added is not allowing the rest of c code to work?

    Attached is update INIT.

    Thanks again for support Tom,
    Troy
    Attached Files Attached Files

Page 1 of 2 12

Similar Threads

  1. Replies: 38
    Last Post: 03-09-2015, 05:19 PM
  2. Disable Feed and Speed override potentiometers - Heidenhain
    By doubravacek in forum CNC (Mill / Lathe) Control Software (NC)
    Replies: 1
    Last Post: 10-27-2011, 10:21 PM
  3. Override rapid feed rate in program?
    By donl517 in forum Fadal
    Replies: 5
    Last Post: 09-18-2009, 06:36 PM
  4. Please help with feed/rapid override parameter
    By Hermle UWF851 in forum Fanuc
    Replies: 2
    Last Post: 04-22-2009, 10:29 PM
  5. feed override and rapid speeds
    By rkremser in forum Mach Mill
    Replies: 1
    Last Post: 02-03-2009, 03:04 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •