Hello Guest it is March 06, 2021, 06:31:42 AM

Author Topic: VFD Forward/Reverse Relay Control in Mach3  (Read 12882 times)

0 Members and 1 Guest are viewing this topic.

VFD Forward/Reverse Relay Control in Mach3
« on: October 11, 2008, 02:26:06 AM »
I am planning a CNC Lathe conversion based on the following Electronic Components:
1.    Smooth Stepper
2.   CNC4PC C23 Breakout Board
3.   Danfoss VLT Micro Drive FC51 VFD http://www.automationdirect.com.au/Welcome/drives/Danfoss.html
4.    Mach3

All was going well until I was planning the Forward/Reverse function for the VFD.  The Danfoss VFD has "Start" and "Reverse" Input Pins which can be selected via external relay contacts.  The VFD supplies 24VDC out for the purpose of being switched to various Input Pins including "Start" and "Reverse".
I am interpreting the "Start" as being "Forward" and “Reverse” as being "Reverse".
I plan to use the PWM function within Mach3 in conjunction with the CNC4PC C23 Breakout Board to generate the 0 - 10VDC speed control for the VFD and to utilize the 2 mechanical relays to select Forward and Reverse.  According to the Silkscreen on the C23 Breakout Board, the 2 relays are associated with Pins 1 and 16 (presumably of the Port 1 Ribbon Cable Connector).

I configured the Ports and Pins within Mach3 to do this by:
1.   In the Spindle Setup Tab, enabling M3 and 4 to O/P 1, Use Motor Control Output Checked, PWM Control Checked, Disable Relays Unchecked, and PWMBase Freq to 1000.
2.   In the Motor Outputs Tab, enabling Spindle, Port 1 Step Pin 14, with no direction Pin selected.
3.   In the Output Signals Tab, enabling Output 1, and Selecting Port 1 Pin 14.

The problem I have is that I don’t understand how to associate M3 with Pin 1 (thus energizing one relay for “Forward”) and M4 with Pin 16 (thus energizing the second relay for “Reverse”).
Can anyone suggest a way to do this or am I barking up the wrong tree?


Regards

Chrisjh

Offline jimpinder

*
  •  1,232 1,232
  • Wakefield, West Yorks, UK
    • View Profile
Re: VFD Forward/Reverse Relay Control in Mach3
« Reply #1 on: October 11, 2008, 03:26:26 AM »
The way I interpret your start and reverse functions is "start" on gives you a forward rotation, and "start" and "reverse" together gives you the reverse direction - I may be wrong, but this is fundamental to your wiring, and you must be certain.

Mach 3 puts out signals on seperate pins for forward and reverse.
I take it that you will be driving relays from these pins and the easiest way to me, is to drive the two relays via diodes. I do not know what pins are available on a smooth stepper, they have more outputs  and inputs than the 25 pin lead, but if I stick to the 25 pin output, someone will enlighten us ( probably Hood) when it comes to Smooth Stepper.

I take it that pins 2,3  4,5  and 6,7 are taken up with the axis drives. You therefore have 8,9, 1,14,16,and 17 left. (As I say with Smooth Stepper you may have more)

On the spindle page allocate M3 and M4 to outputs 1 and 2,  and uncheck disable relays. The PWM base should be 5, not 1000. It sounds daft, but the slower the PWM base is, the more control you have over the speed - since Mach has greater time to split the PWM base signals into a greater number of segments). Tick Use Spindle motor output and PWM control.

The PWM signal is allocated to the step pin of the spindle motor (on the Motor Outputs page) so put that out on whatever pin you want.
The outputs 1 and 2 are allocated to pins on the Output Signals page ( I have mine on 8 and 9, but you can put them on whatever you like.

If you then drive your "Start" relay say from pin x via a diode, and wire your "Reverse" relay from pin y with a diode across to pin y to the "Start" relay, then you will get the effect that pin x will fire up the start relay only, but pin y will fire up the start and the reverse relays.

I think everything is covered there, and it seems like you have 90% of it anyway. The bit you need seems to be in bold type.
If you find that your start and reverse "switches" are indeed seperate, then it seems alright as you were doing it - forgive the ramblings of an old man, especially so early on a Saturday morning.
 










Not me driving the engine - I'm better looking.
Re: VFD Forward/Reverse Relay Control in Mach3
« Reply #2 on: October 11, 2008, 10:24:02 AM »
Chris,
    I could be wrong, but I don't believe the C23 supports PWM for the spindle.  It expects a STEP single, and it does a frequency to voltage conversion on that, just like all the other CNC4PC boards.
   I also believe Mach has a FWD output, and a REV output, so you'll need to wire two relays, so that the one activated on M3 only activates the START intput to the VFD, while the one activated on M4 activates both the START and REV inputs to the VFD.  However, I'd check the VFD documentation very carefully.  They often have configuration options that define how those inputs work, so they can be configured as START+REV, or separate FWD/REV inputs.  The latter is more compatible with the way Mach works.

Regards,
Ray L.
Regards,
Ray L.
Re: VFD Forward/Reverse Relay Control in Mach3
« Reply #3 on: October 12, 2008, 06:30:57 AM »
Ray and Jim,

Thanks for the pointers.  I was focussed on PWM because my cnc mill works with PWM.  Now that have been pointed in the right direction, I have realized that the C23 BOB indeed works on step pulses and not PWM. I am now concentrating on working out a plan for steps to be converted to 0 - 10VDC for speed control. 

I now plan to use my original idea to use the 2 on board mechanical relays for channelling the 24VDC from the VFD back to the Forward (Start) and Reverse pins of the VFD but now will use the step function through the C23 BOB to control the speed.

One thing I learned is that the Smooth Stepper firmware is smart enough to recognize errors on my part in the ports and pins configuration.  For example, it reported that I had mistakenly assigned pin 14 on Port 1 twice.  When I set up the step function for the analogue conversion on Pin 14, it complained that I had not assigned a corresponding pin for direction.  I could not see that direction was needed (the spindle direction having been taken care of by the forward and reverse relays).  However to keep the Smooth Stepper happy, I assigned an unused pin to direction.  Smooth Stepper now appears to be happy.

I will report further progress in the near future.

Kind Regards

Chrisjh
Re: VFD Forward/Reverse Relay Control in Mach3
« Reply #4 on: October 12, 2008, 11:36:16 AM »
Chris,

    Since you have a SmoothStepper, I'll give you the (perhaps limited) benefit of my experiences getting the spindle speed control working over the last week.  It was anything but an intuitive process, but I finally got it working as I wanted.  My machine has a two-speed motor, and four step pulleys.  My goal was to have the "spidnle speed" command that Mach sees be the VFD frequency times 10.  So, for example, doing an S750 in the G-code would set the VFD to 75Hz.  I modified my SheetCAM post-processor so I could input RPM into SheetCAM, and the post-processor would then figure out which motor speed and step pulley to use, insert an M00 into the G-code prompting me to make those settings, then output the S commands as VFD frequency times 10.
    When I first brought up the spindle speed control through my CNC4PC C10 board and SmoothStepper, after much futzing around, I ended up with settings that worked, but not very well.  Speed was uneven, wandering around quite a bit, especially at lower frequencies.  After a few days, it stopped working even that well - really went to hell.  Seems the LM2907 on the C10 went Tango-Uniform.  So, I replaced the LM2907, and this time set about trying to understand how the circuit really worked, and how to optimize the Mach and SmoothStepper settings.  This turned out to be quite an exercise, and required putting an oscilloscope on the LM2907 to see what was being commanded (step pulses coming into), and what was being output (analog voltage to VFD).
    Here's what I determined:  First, the "step pulse width" settings in the Motor Tuning dialog do nothing with SmoothStepper.  Instead, there is a corresponding setting in the SmoothStepper config dialog.  The key to getting reliable operation is getting this step pulsewidth setting, and the stes/unit setting in the Motor Tuning dialog properly balanced.  In addition, I had to fudge the max frequency setting in the VFD to get the desired range of motion.  The VFD outputs a 10V supply to be used with the control voltage input.  With 10V coming in, the C10 can only output about 8.5V.  So, I increased the VFD max frequency to about 120Hz, so the 8.5V from the C10 would correspond to about 90HZ, which was my desired max frequency.  Next, using the oscilloscope, I looked at the duty cycle of the step pulses coming into the LM2907, and determined that the 5uS default setting was far too narrow, and would require an extremely high pulse frequency to generate any usable output.  So, I played with pulsewidth settings to get one that seemed to give close to the range I wanted.  Finally, I played with steps/unit to scale the response as I wanted.  I ended up with, I believe, 40uS pulsewidth for the step pulses, and 4600 steps/unit.  This gives the response and scaling I wanted, and the speed is now stable, even at very low frequencies.  Response is also reasonably linear, being off a perhaps 10% (high) at the very low end, but well within 1% at the high end.
    I can't guarantee your settings will be the same, or even close, but this is what worked for me, and there was no way I could have ended up there just fumbling around in the dark, and chaning settings at random.  As I said, the key is getting the pulsewidth and steps/unit properly balanced to each other.  If you don't have that, it just won't work in a rational manner at all.

Regards,
Ray L.
Regards,
Ray L.
Re: VFD Forward/Reverse Relay Control in Mach3
« Reply #5 on: October 12, 2008, 06:55:28 PM »
Hi Ray,

Thanks for your notes on your experience .  I will need time to digest your notes and perform some experiments.

Last night I was able to successfully cofigure the 2 mechanical relays for forward and reverse (M3 operated one of the relays and M4 operated the other).

I then tried following the C23 BOB procedure for step to analogue via Pin 14 Port 1 without success.  No mater what I did the analogue O/P remained at about 9VDC.  It was getting late so I gave up with the intention of getting to trace the Step Pulses through the BOB using my CRO later today.

I'll let you know how I go.

Regards

Chrisjh
Re: VFD Forward/Reverse Relay Control in Mach3
« Reply #6 on: October 12, 2008, 07:38:49 PM »
Chris,

    Sounds like you're seeing the same kind of behavior I was, before I broke down and put the scope on it.  Why not try the settings I used, and see how it behaves.  That will at least confirm the hardware is working right.  Set pulsewidth to 40 us (in SmoothStepper config), set steps/unit to 4600, and max speed to 900, then try spindle speeds from 0-900, and see what happens.

Regards,
Ray L.
Regards,
Ray L.
Re: VFD Forward/Reverse Relay Control in Mach3
« Reply #7 on: October 17, 2008, 08:39:43 AM »
Ray,

I tried your suggested settings and got some improved control over the Analogue DC O/P of the C23 BOB.

However with extensive trial and error, I concluded that the LM2907 frequency to voltage converter was a poor design choice.  I found that it was too sensitive to pulse width variations, Mach3 configuration variations and did not give a full range of 1 - 10VDC O/P.  Also the voltages that I did get out of it were far from linear and I never saw the same voltage out twice for the same requested RPMs.  I am trying to be diplomatic here.

I quickly realized that I was wasting time trying to get the smooth, linear control that I wanted to control a VFD, so I decided to abandon the LM2907 for a PWM approach.  I threw together a prototype PWM to Voltage converter Board designed by Paul Kelly. See http://www.cncathome.com/vfd.html  for his schematic.  Thanks Paul.

I reconfigured Mach3 for PWM Spindle control and set the PWM O/P to Port 2 Pin14 driving Paul’s design.  I trialed both 1000Hz and 2000Hz Base frequencies and concluded that either setting would be OK for my proposed lathe conversion.
My slightly modified schematic and test results  can be found at http://www.cjh.com.au/PWMConverter.pdf

Tests clearly show a linear progression from 50 RPM to 1400RPM (the range that my intended motor will run over).  Extensive testing over time ( a couple of days) revealed very consistent voltages out for any requested RPM using Mach3 as the PWM signal source.

I am now confident that this VFD control approach will work and next week will proceed with the procurement of the Danfoss VFD and Australian manufactured 3 Phase motor 0.75KW for the next stage of development.

I’ll let you know how that goes in a couple of weeks.

Regards
Chrisjh
« Last Edit: October 17, 2008, 09:11:31 PM by chrisjh »