Need Help! CNC Spindle Control, PWM to 0-10v


Results 1 to 12 of 12

Thread: CNC Spindle Control, PWM to 0-10v

  1. #1
    Member shinytooth's Avatar
    Join Date
    Jan 2021
    Posts
    3
    Downloads
    0
    Uploads
    0

    Default CNC Spindle Control, PWM to 0-10v

    Hello everyone!

    I have a 4x8' CNC router running Mach4 and I have been having a ton of trouble setting up automatic spindle speeds. I cut lots of materials and would like to control the spindle speed with G-Code.

    I am using an Ethernet SmoothStepper, which outputs a 5v PWM single, but the VFD that I am using accepts a 0-10v analog signal. I ordered a breakout board with a PWM to 0-10v converter off of Amazon, but the board was dead on arrival. I found another board on Amazon that advertises converting a PWM signal to a 0-10v analog signal, but it does not do so linearly. I have even tried to create my own low-pass filter with an op-amp giving me the gain to output 0-10v, but there is still an error of around +/- 200 millivolts (For my 24,000RPM spindle, +/-200mV correlates to +/-480RPM).

    I know that Mach4 has PID loop capabilities, but I cannot find much information on indexers for spindles at this speed. Also, I am aware that Mach3 has a linearity.dat file to adjust the spindle's linearity. Does Mach4 have such a configuration file that I am missing?



    What are you guys using to get an accurate 0-10v output? Else, how are you guys controlling the speed of your spindles?

    Thanks!

    Similar Threads:


  2. #2
    Member
    Join Date
    Jan 2005
    Location
    USA
    Posts
    12179
    Downloads
    0
    Uploads
    0

    Default Re: CNC Spindle Control, PWM to 0-10v

    Quote Originally Posted by shinytooth View Post
    Hello everyone!

    I have a 4x8' CNC router running Mach4 and I have been having a ton of trouble setting up automatic spindle speeds. I cut lots of materials and would like to control the spindle speed with G-Code.

    I am using an Ethernet SmoothStepper, which outputs a 5v PWM single, but the VFD that I am using accepts a 0-10v analog signal. I ordered a breakout board with a PWM to 0-10v converter off of Amazon, but the board was dead on arrival. I found another board on Amazon that advertises converting a PWM signal to a 0-10v analog signal, but it does not do so linearly. I have even tried to create my own low-pass filter with an op-amp giving me the gain to output 0-10v, but there is still an error of around +/- 200 millivolts (For my 24,000RPM spindle, +/-200mV correlates to +/-480RPM).

    I know that Mach4 has PID loop capabilities, but I cannot find much information on indexers for spindles at this speed. Also, I am aware that Mach3 has a linearity.dat file to adjust the spindle's linearity. Does Mach4 have such a configuration file that I am missing?



    What are you guys using to get an accurate 0-10v output? Else, how are you guys controlling the speed of your spindles?

    Thanks!
    You would not be using the PWM output if you have a PWM to analog converter, you should be using a regular output to supply the converter most converters take a voltage input and convert that to the analog 0-5v / 0-10v some VFD Drives can use 0-5v analog so don't always need 0-10v depends on the VFD Drive spec's

    Mactec54


  3. #3
    Member shinytooth's Avatar
    Join Date
    Jan 2021
    Posts
    3
    Downloads
    0
    Uploads
    0

    Default Re: CNC Spindle Control, PWM to 0-10v

    Mactec54, thanks for your reply.

    There is no way to configure my VFD to accept a 0-5v signal. The SmoothStepper is what outputs the digital PWM signal, which has to be converted to the 0-10v analog signal. The VFD accepts 0-10v on the analog-in pin, 10v correlating to max RPM and 0v correlating to 0 RPM. To simulate this signal, I can use a bench power supply to output the 0-10v, or use a potentiometer with the wiper connected to the VFD's analog-in.


    I was wondering what board/circuit people have used to convert this 5v PWM signal into a 0-10v analog output capable of controlling my VFD. Again, I have been able to achieve this with a low-pass filter and an op-amp, but with the sloppy accuracy of roughly +/-200 millivolts.

    Edit:
    I am using a 1.5kW Huanyang VFD (due to budgetary reasons) and an imported spindle.

    Last edited by shinytooth; 01-13-2021 at 06:21 PM.


  4. #4
    Member Sterob's Avatar
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    591
    Downloads
    0
    Uploads
    0

    Default Re: CNC Spindle Control, PWM to 0-10v

    If he budget can stretch, a MB3 BOB has a 0-10v speed signal. That would solve all your problems except expenditure.
    Thats what I use.
    That would also give you one less 'failure point' if you had any future problems.



  5. #5
    Community Moderator ger21's Avatar
    Join Date
    Mar 2003
    Location
    Shelby Township
    Posts
    35445
    Downloads
    1
    Uploads
    0

    Default Re: CNC Spindle Control, PWM to 0-10v

    There is no way to configure my VFD to accept a 0-5v signal.
    Try setting PD070 to 1 for 0-5V control.

    ±500 RPM isn't going to make much difference.

    On my Huanyang, when using analog control, I had an RPM variance of ±1000 RPM with a steady analog voltage, so I used RS-485 for speed control.

    Gerry

    UCCNC 2017 Screenset
    http://www.thecncwoodworker.com/2017.html

    Mach3 2010 Screenset
    http://www.thecncwoodworker.com/2010.html

    JointCAM - CNC Dovetails & Box Joints
    http://www.g-forcecnc.com/jointcam.html

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)


  6. #6
    Member
    Join Date
    Jan 2005
    Location
    USA
    Posts
    12179
    Downloads
    0
    Uploads
    0

    Default Re: CNC Spindle Control, PWM to 0-10v

    Quote Originally Posted by shinytooth View Post
    Mactec54, thanks for your reply.

    There is no way to configure my VFD to accept a 0-5v signal. The SmoothStepper is what outputs the digital PWM signal, which has to be converted to the 0-10v analog signal. The VFD accepts 0-10v on the analog-in pin, 10v correlating to max RPM and 0v correlating to 0 RPM. To simulate this signal, I can use a bench power supply to output the 0-10v, or use a potentiometer with the wiper connected to the VFD's analog-in.


    I was wondering what board/circuit people have used to convert this 5v PWM signal into a 0-10v analog output capable of controlling my VFD. Again, I have been able to achieve this with a low-pass filter and an op-amp, but with the sloppy accuracy of roughly +/-200 millivolts.

    Edit:
    I am using a 1.5kW Huanyang VFD (due to budgetary reasons) and an imported spindle.
    The Huanyang is ( 1 ) of the VFD Drives that can use 0-5v analog to control it but does not take the PWM direct there are many converters look at CNC4PC they have one

    You can use an output from the SmoothStepper to a converter you don't use the PWM output to the converter

    Mactec54


  7. #7
    Member
    Join Date
    Jan 2005
    Location
    USA
    Posts
    12179
    Downloads
    0
    Uploads
    0

    Default Re: CNC Spindle Control, PWM to 0-10v

    Here is a converter that will work with your 5v PWM signal

    PWM to Voltage Converter Module 0%-100% to 0-10V for PLC MCU Digital to Analog Signal

    Mactec54


  8. #8
    Member
    Join Date
    May 2004
    Location
    usa
    Posts
    181
    Downloads
    0
    Uploads
    0

    Default Re: CNC Spindle Control, PWM to 0-10v

    Something to think about in all this is how the 0-5V and 0-10V conversion works. Generally, it is what they call a Low Pass filter which means that the top voltage (5V or 10V) is based on the highest voltage of the PWM signal. A lot of power supplies are within spec at plus or minus 5% so that PWM signal may only be able to provide a 0-4.75V signal (95% of 5V). So, if your "5V" PWM signal comes from a circuit with 4.75V, it will never get to 5V, even at full speed (ie 100% PWM duty cycle). To state the obvious, it would only get to 4.75V, at best. Also, digital logic often eats a little of the voltage so you might also be seeing that. You can measure the net result by outputting a full speed signal and measuring the voltage of the PWM output with a halfway decent multimeter.

    A lot VFDs which accept PWM input directly use the Low Pass Filter approach and have the same issue.

    The 0-10V conversion modules you can get are often adjustable and allow you to compensate for the source PWM signal being low. Measure full speed output of it with your multimeter and turn the potentiometer until it reads 10V.

    Or, you can just accept that 16K RPM is really just 15.2K (or what ever your output voltage is off by).



  9. #9
    Member shinytooth's Avatar
    Join Date
    Jan 2021
    Posts
    3
    Downloads
    0
    Uploads
    0

    Default Re: CNC Spindle Control, PWM to 0-10v

    Thank you for the replies.

    Mactec54, the board that you suggested is one of the boards that I have tried, it's the one that lands me within roughly 500 RPM of the target speed. I have been able to measure the discrepancy to about 200 millivolts and my oscilloscope shows a very clean DC voltage. I suppose 500 RPM is only about 2% of 24,000, it just sounds like a lot to me. I don't believe that my VFD is a genuine Huanyang. My particular VFD does not directly support a 0-5v analog input; however, you can adjust a "max voltage" setting between 0 and 1024, but 1024 always equates to 10v. Adjusting the min and max to somewhere around 10-980 does get me a little closer, but not by much. At this point, I think I might be splitting hairs.

    I looked into controlling the VFD with RS-485, but I don't believe that my VFD is a genuine Huanyang. Tearing it apart, the PCB appears to have RS-485 IO, but there are no screw terminals and the manual says little on the topic. Maybe that is something to play with in the future, but for now I think that I am going to stick with the PWM to analog board that Mactec54 suggested. If anyone is curious, the VFD model number is "YL620-A-1.5KW" and has no brand name or manufacturing information. But hey, it was cheap and the spindle cuts well .



  10. #10
    Member
    Join Date
    Jan 2005
    Location
    USA
    Posts
    12179
    Downloads
    0
    Uploads
    0

    Default Re: CNC Spindle Control, PWM to 0-10v

    Quote Originally Posted by shinytooth View Post
    Thank you for the replies.

    Mactec54, the board that you suggested is one of the boards that I have tried, it's the one that lands me within roughly 500 RPM of the target speed. I have been able to measure the discrepancy to about 200 millivolts and my oscilloscope shows a very clean DC voltage. I suppose 500 RPM is only about 2% of 24,000, it just sounds like a lot to me. I don't believe that my VFD is a genuine Huanyang. My particular VFD does not directly support a 0-5v analog input; however, you can adjust a "max voltage" setting between 0 and 1024, but 1024 always equates to 10v. Adjusting the min and max to somewhere around 10-980 does get me a little closer, but not by much. At this point, I think I might be splitting hairs.

    I looked into controlling the VFD with RS-485, but I don't believe that my VFD is a genuine Huanyang. Tearing it apart, the PCB appears to have RS-485 IO, but there are no screw terminals and the manual says little on the topic. Maybe that is something to play with in the future, but for now I think that I am going to stick with the PWM to analog board that Mactec54 suggested. If anyone is curious, the VFD model number is "YL620-A-1.5KW" and has no brand name or manufacturing information. But hey, it was cheap and the spindle cuts well .
    That board has pots that you can adjust to get your RPM closer, first adjust the PWM to get the 5v then adjust the 0-10v output

    A YL620 is not a Huanyang VFD Drive post a photo of the terminals

    Mactec54


  11. #11
    Community Moderator Al_The_Man's Avatar
    Join Date
    Dec 2003
    Location
    Canada
    Posts
    23669
    Downloads
    0
    Uploads
    0

    Default Re: CNC Spindle Control, PWM to 0-10v

    If you want to try a DIY version, there is this.
    Al.

    Attached Thumbnails Attached Thumbnails CNC Spindle Control, PWM to 0-10v-pwmanalog-jpg  
    CNC, Mechatronics Integration and Custom Machine Design

    “Logic will get you from A to B. Imagination will take you everywhere.”
    Albert E.


  12. #12
    Member
    Join Date
    Jan 2005
    Location
    USA
    Posts
    12179
    Downloads
    0
    Uploads
    0

    Default Re: CNC Spindle Control, PWM to 0-10v

    Quote Originally Posted by Al_The_Man View Post
    If you want to try a DIY version, there is this.
    Al.
    The one I posted is very cheap $4 and change and it is quite a well made PWM to Analog Board

    It's always fun to make you own though if you have the time

    Mactec54


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

CNC Spindle Control, PWM to 0-10v

CNC Spindle Control, PWM to 0-10v

CNC Spindle Control, PWM to 0-10v