Need Help! Spindle control using KStep and VFD


Results 1 to 11 of 11

Thread: Spindle control using KStep and VFD

  1. #1
    Registered
    Join Date
    Nov 2013
    Posts
    6
    Downloads
    0
    Uploads
    0

    Default Spindle control using KStep and VFD

    I have a new project with a small router using KFlop with KStep. I have got the axes configured and working but need help getting the spindle working using a VFD.
    Have been through the KStep/KFlop help but the setup instructions seem patchy to me. Is there any step by step instructions that I can use tat shows exactly what code I need and where?

    Similar Threads:


  2. #2
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Spindle control using KStep and VFD

    Hi wgmltd,

    Assuming your VFD accepts an Analog signal you might read the KStep Analog Output section here:
    Using KStep

    There is an example C Program to output speed to KSteps Analog output. See:
    \C Programs\KStep\KMotionCNC\Spindle_S_Kstep.c

    General Spindle control info can be found here:
    KMotionCNC Spindle Control

    HTH
    Regards

    Regards
    TK http://dynomotion.com


  3. #3
    Registered
    Join Date
    Nov 2013
    Posts
    6
    Downloads
    0
    Uploads
    0

    Default Re: Spindle control using KStep and VFD

    Hi Tom, thanks for your help thus far.

    I am using a Sunfar E300 series VFD that takes an analog input from 0 to 10V to control speed (0 to 60,000rpm) and a direction digital pin (that possibly needs a relay).

    Following though the "Using KStep" document, I am unsure which C file I should be writing the PWM configuration code too:

    FPGA(KAN_TRIG_REG)=4; // Mux PWM0 to JP7 Pin5 IO 44 for KSTEP
    SetBitDirection(44,1); // define bit as an output
    FPGA(IO_PWMS_PRESCALE) = 46; // divide clock by 46 (1.4 KHz)
    FPGA(IO_PWMS+1) = 1; // Enable

    I have set up channel 7 to use no input and DAC Servo output (using the template provided). However, I haven't been able to save this channel in my INT C program file like the other 4 channels I have used for the 4 axis. At this point I am not getting any signal from IO 44 from KStep.

    Regards,

    Shiloh



  4. #4
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Spindle control using KStep and VFD

    Hi Shiloh,

    That code would be included in the C program that you use to initialize your system. That way when you initialize your system the PWM will be also initialized and configured.

    You don't need an Axis Channel to write to the PWM and the PWM is not a Kanalog DAC so you can not use DAC Servo Output mode.

    Instead configure the example provided in the previous email for the S Action in KMotionCNC Tool Setup. In this way when speed is changed in KMotionCNC the program will be invoked and the speed will be written to the PWM and the KStep Analog Output should change.

    Regards

    Regards
    TK http://dynomotion.com


  5. #5
    Registered
    Join Date
    Nov 2013
    Posts
    6
    Downloads
    0
    Uploads
    0

    Default Re: Spindle control using KStep and VFD

    Hi Tom,

    I still aren't having any luck. I have set the S Action to execute ...\KMotionCNC\Spindle_S_Kstep.c and I have written those 4 lines of code previously mentioned in my INIT file. But when I run some G-code there is no signal sent to my VFD.

    This is how I have set up KMotionCNC so far:

    Spindle control using KStep and VFD-1-jpg

    Spindle control using KStep and VFD-2-png

    Spindle control using KStep and VFD-screen-shot-2017-02-06-3-53-a

    Attached Thumbnails Attached Thumbnails Spindle control using KStep and VFD-screen-shot-2017-02-06-3-58-a  


  6. #6
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Spindle control using KStep and VFD

    Hi Shiloh,

    I think the default Spindle_S_Kstep.c program is expecting to use Var=1 not Var=113.

    Please post your modified code so we can check it. It would be better to attache the file itself (you may need to add a .txt extension) rather than a photo of it.

    Regards

    Regards
    TK http://dynomotion.com


  7. #7
    Registered
    Join Date
    Nov 2013
    Posts
    6
    Downloads
    0
    Uploads
    0

    Default Re: Spindle control using KStep and VFD

    Hi Tom,

    Here is my INIT file. This is the only C program I have modified:

    Regards,

    Shiloh

    Attached Files Attached Files


  8. #8
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Spindle control using KStep and VFD

    Hi Shiloh,

    I was expecting you to post your modified Spindle_S_Kstep.c. But if you haven't modified it then as I stated in the last email it by default expects the Speed an Var #1. The idea is that KMotionCNC and the C Program must match and use the same variable for communication. If you read the Spindle_S_Kstep.c Program there is a comment:

    // desired speed is passed in variable 1


    Here is the line of code that reads Var #1:

    float speed = *(float *)&persist.UserData[1]; // value stored is actually a float

    HTH
    Regards

    Regards
    TK http://dynomotion.com


  9. #9
    Registered
    Join Date
    Nov 2013
    Posts
    6
    Downloads
    0
    Uploads
    0

    Default Re: Spindle control using KStep and VFD

    Hi Tom,

    I have checked and the variables do match (both KMotionCNC and Splindle_S_KStep are set to 1). I have also checked for a signal coming out of pin 5 I/O44 on JP7 which appears to simply have 3.3V.
    Do I also need to set JP6 pin 5 to out PWM or is that taken care of?


    I have attached my Spindle_S_Kstep.c. I have set the variable to 1 (on both KMotionCNC and Splindle_S_KStep), should they be set to something else?

    Regards

    Shiloh

    Attached Files Attached Files


  10. #10
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Spindle control using KStep and VFD

    Hi Shiloh,

    The max RPM_FACTOR is set at 500 RPM. What S RPM are you commanding? 500 or more would always set the PWM to 100% duty cycle which may be why you seethe output always 3.3V. Try S250 to get a 50% duty cycle.

    No you do not have to configure JP6 pin 5 as you are not using it.

    How is your Analog signal wired? Do you realize you must supply a voltage on AnalogVcc and AnalogGnd?

    Regards

    Regards
    TK http://dynomotion.com


  11. #11
    Registered
    Join Date
    Nov 2013
    Posts
    6
    Downloads
    0
    Uploads
    0

    Default Re: Spindle control using KStep and VFD

    Hi Tom,

    Setting the RPM_FACTOR to 60,000 seems to have done the trick. Now just working on turning the spindle on/off and direction.

    Thanks for all your help!

    Regards,



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
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

Spindle control using KStep and VFD

Spindle control using KStep and VFD