Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: Buggalugs on August 03, 2014, 05:00:57 PM

Title: Help Please with PWM Spindle Motor Speed
Post by: Buggalugs on August 03, 2014, 05:00:57 PM
Been on best part of a day trying to setup my new Spindle Motor. The problem is in trying to calibrate the actual Spindle RPM to the Mach3 DRO RPM.  I am using 35KHz base engine and setting the PWM Base Frequency at 60 does nothing for it as it still runs about 20 times faster than the DRO.  I don't seem to be able to find the right answers in the Mach3 Manual. To give an example, using the MDI at S1000 the motor is doing 5,200 RPM and I don't seem to be able to bring the two together.

Once again thank you in advance for your response, only kindly note that I am still an (old) newbie to CNC so please do not baffle me with mathmatical calculations I just want to use the Mill not re-invent it :)
Title:
Post by: DMBGO on August 05, 2014, 12:49:05 AM
Mach gets its speed reading on the DRO from the spindle index sensor. Sounds like you might have an issue there.

Regards David
Title: Help Please with PWM Spindle Motor Speed
Post by: JohnHaine on August 22, 2014, 05:49:40 PM
How are you converting the PWM output to control your motor?  I assume you don't have a spindle speed sensor so the system is open loop. There needs to be a calibration adjustment in hardware between the PWM smoothing and the speed controller.  PWM base frequency is not directly related to spindle speed, it's just the frequency of the pulses whose pulse width is controlled to indicate the desired speed.  Normally you smooth those pulses to generate a voltage, which is scaled for calibration purposes, then applied to the speed controller.
Title: Re: Help Please with PWM Spindle Motor Speed
Post by: ger21 on August 22, 2014, 07:46:21 PM
Have you set up your pulley speeds? Those are what control the rpm range.
Title: Re: Help Please with PWM Spindle Motor Speed
Post by: Buggalugs on August 23, 2014, 10:51:35 AM
I'm having some major life issues at the moment to where this is going to have wait a bit, My Wife passed away last month after a very short illness, I'm now wishing I had spent more time with her rather than fiddling on with all of my dopey assed projects and hobbies.
Title: Re: Help Please with PWM Spindle Motor Speed
Post by: Vogavt on August 26, 2014, 09:26:52 AM
My condolences to you.

This should be a "Lessons Learned" for all of us.
Title: Re: Help Please with PWM Spindle Motor Speed
Post by: Buggalugs on August 27, 2014, 07:09:14 AM
Thank You I feel it will be a good while before I can get my head back into anything. The guilt is almost as unbearable as the grief and lonelyness.
Title: Re: Help Please with PWM Spindle Motor Speed
Post by: Buggalugs on November 10, 2014, 02:01:07 PM
I am back again from a being in a very dark place for a while. I feel I need to try and keep myself busy to take my mind away from reality.

Where I left off in July was in trying to configure my spindle Motor which is still giving me a major headache.  The problem I’m having is managing to get my Spindle DRO to match the actual spindle RPM and it looks like I need to set my pulley ratio’s at something like 5:1 But for whatever reason I cannot fathom out how to set it.

My Pulley setting dialog box is different to that in the Mach3 Manual to where I have an independent input panel rather than it being part of Ports and Pins dialog box. Have I an old distribution which needs updating?  I have Version R3.043.066??

As I said above, I think I need a ratio circa 5:1, (Driver Pulley 5T Driven Pulley 1T) How do I go about entering that into my Settings.

As always, any help is gratefully received. 
Title: Re: Help Please with PWM Spindle Motor Speed
Post by: hughes674 on November 10, 2014, 04:46:36 PM
Hi
Are you sure your motor pulley is 5 times bigger than your spindle pulley?

Mick
Title: Re: Help Please with PWM Spindle Motor Speed
Post by: Buggalugs on November 10, 2014, 05:42:40 PM
Thank you for your reply Mick. I might have that wrong. I need the (VIRTUAL) Driver Pulley to turn 5 times as fast as the Driven Pulley.

I have poked on again this evening but nothing seems to be making any sort of sense.  At one point I seemed to make some sort of progress to where the Spindle Motor would run at almost twice the DRO RPM but then it stopped showing the speed on the display...

This is really bugging me now to the point where taking up knitting and ballet is becoming a distinct probability.
Title: Re: Help Please with PWM Spindle Motor Speed
Post by: hughes674 on November 11, 2014, 03:33:42 AM
Hi
The spindle pulley set up is in the config menu third from bottom. I am new to this aswell but the way I understand it is this:
Select the pulley you are using.
Enter your min and max speed
If your motor pulley has 1 tooth and your spindle pulley has 5 teeth. That would give a ratio of 1/5.
You take the spindle speed and divide it by the motor speed which in this case would be 0.20.
This is then entered into the pulley ratio for pulley 1 or whatever pulley you are using.

I think this is right but please advise me otherwise.

Cheers
Mick
Title: Re: Help Please with PWM Spindle Motor Speed
Post by: Buggalugs on November 11, 2014, 04:18:57 AM
Thank you Mick. I see now where it is to go.
Title: Re: Help Please with PWM Spindle Motor Speed
Post by: Buggalugs on November 11, 2014, 10:20:06 AM
 Well another wasted day. (not that I have anything else to do!) This thing just does not want to do what I want it to do. I have set Pulley 1 to a minimum of 1000RPM and a Maximum of 10600RPM, then set the ratio on that pulley to 0.2

Working on the MDI if I enter 1500 RPM The Spindle Motor Clocks 6100RPM and at an input of 2000 it clocks up 8200

No matter what I chenge in the pulley setting input it just bloodywell does what it wants. Does it need to  restarting after any changes to the Pulley settings  ????

I know I'm doing something stupid, but for the life of me I cannot fathom out.
Title: Re: Help Please with PWM Spindle Motor Speed
Post by: hughes674 on November 11, 2014, 05:41:42 PM
Hi
Are you using a 0 to 10v input to your VFD from your breakout board?

Cheers
Mick
Title: Re: Help Please with PWM Spindle Motor Speed
Post by: Buggalugs on November 12, 2014, 08:05:50 AM
I am not too sure what a VFD is? My Breakboard PWM Output is connected to the Spindle Motor Controller. The controller can support a PWM Signal between 1Kz and 5Kz
Title: Re: Help Please with PWM Spindle Motor Speed
Post by: hughes674 on November 12, 2014, 08:33:12 AM
Hi
I don't know what BOB you have but mine gives out a 0volt to 10volt output depending on what rpm is entered. So if you enter 0 rpm it will give 0 volts and if you enter max rpm eg 3000rpm it gives out 10 volts. This voltage tells the VFD (variable frequency drive) how many HZ to use to control the speed. I think your speed controller is probably the same thing but you need to check if it works in the same way.
What speed controller do you have?

Mick
 
Title: Re: Help Please with PWM Spindle Motor Speed
Post by: Fastest1 on November 12, 2014, 10:13:54 AM
Take pics of the system with your phone and post them here.

 Btw, you arent the first to be dumbfounded by the spindle set up.

After rereading your entire thread, at no time do you disclose the equipment you have. Do us a favor and do so.
Title: Re: Help Please with PWM Spindle Motor Speed
Post by: hughes674 on November 12, 2014, 10:22:02 AM
Why wouldn't you disclose what equipment you have??

Mick
Title: Re: Help Please with PWM Spindle Motor Speed
Post by: hughes674 on November 12, 2014, 01:03:07 PM
Sorry fastest1 miss read what you wrote.

Mick
Title: Re: Help Please with PWM Spindle Motor Speed
Post by: Buggalugs on November 13, 2014, 05:56:06 AM
My CNC Kit is as follows:
Tonsen TS3040C-H80
I have fitted limits, e-stops, and replaced the Flexi-shaft hanging spindle motor with a 400W ER11 Spindle Motor. The Controller is powered by a 48V 10A SMPS.
The Manufacturers of the Motor and Controller makes the following claim:
Spindle Motor
Max 12,000 RPM
Max DC input 50V

Controller

Max Input 110V AC/DC
PWM Input Range 1kHz – 5kHz
Title: Re: Help Please with PWM Spindle Motor Speed
Post by: Buggalugs on November 13, 2014, 05:57:50 AM
More Images
Title: Re: Help Please with PWM Spindle Motor Speed
Post by: Buggalugs on November 13, 2014, 07:47:58 AM
More Images (Settings Screenshots)
Title: Help Please with PWM Spindle Motor Speed
Post by: JohnHaine on November 16, 2014, 07:23:09 AM
I suspect you may have a couple of basic problems.  First it is likely that the PWM speeds controller you have need a voltage between, probably, 0 and 10 v to set motor speed.  However to confirm this you need to provide more than a photo, we need to have its specification or a link to one.

Second, you don't say how your PC is connected to the controller.  Assuming you have a breakout board, the PWM output from this is just a train of 5 volt (usually) pulses of varying mark/space ratio, which needs converting to the control voltage.  Again, we need to know details of the BoB to confirm this.  Unless it does the conversion internally you would need something between it and the controller to do it, it's only a simple circuit and several have been published.

Third, the PWM base frequency you have set is far too high by a factor of 100.  Something like 25 to 50 Hz is better to get smoother control.

Once you have this working the pulley ratio is irrelevant as your spindle doesn't have pulleys.

Please give us more information, on the breakout board type and controller type!


Sent from my iPad using Tapatalk
Title: Re: Help Please with PWM Spindle Motor Speed
Post by: Buggalugs on November 16, 2014, 05:16:02 PM
Hello John and thank you so much for your reply. This is becoming a more of a quest or a mission to make this thing work properly, but at this point I am seriously thinking of ditching the Motor and Controller and either going back to the ‘Hanging Dolly’ and Flexi-Shaft or splashing out even more money on a different Spindle Motor set-up.

The kit came from (You guessed!) ‘Fleebay’ on http://www.ebay.co.uk/itm/400W-CNC-Spindle-Motor-Kits-PWM-Speed-Controller-400W-Motor-With-Mount-Bracket-/221360481671?pt=UK_BOI_Metalworking_Milling_Welding_Metalworking_Supplies_ET&hash=item338a1ce587

I must confess, the Motor is quite impressive, very quite at 6,000 to 8,000 RPM with very little run-out.

The specs on the PWM Controller are:
•   Support AC and DC input
•   DC Input : DC 15-160V
•   AC Input : 12-110V input
•   Support Current :10 A
•   PWM input : level 3.5-12V VPP
•   Frequency :1K-10KHZ(Particularly suitable for MACH3 spindle speed control.)

  The Breakout Board is what was supplied with the Mill, which I have modified to take opto-couplers for the limits, e-stops and a touch pad. Pin1 from the LPT port as in the drawing from a kind person on CNC Zone is fed directly to the Speed Controller.

The Power supply is a 48v 10A SMPSU with enough power to blow your hat off.

As I said in the very beginning, it works fine I just cannot get it to marry up with the spindle speeds on the DRO’s it’s not a matter of being out a 1,000RPM or so, it is running about 75 – 80% out.

I really appreciate any help that anyone can throw at me; I cannot believe I am the only ‘Muppet’ on the Planet to have bought one of these .

One slight caveat with the drawing I have posted is that if memory serves me the pulse train on the Pin 1 is negative going to where pin 2 on the ‘MOTO’ Port is High (5v) In the drawing Pin 2 goes to deck. 
Title: Help Please with PWM Spindle Motor Speed
Post by: JohnHaine on November 16, 2014, 07:05:27 PM
Ok, here are a couple of ideas.  First, let's assume that the controller wants to receive a PWM signal at its input at a frequency between 1 and 10 kHz, which is what the spec says.  If this is correct then the controller just uses that to switch the supply to the motor on and off with the varying mark/space ratio that Mach puts out, which should vary the motor speed in the expected way.  You have set the PWM base frequency to 2500 Hz which is in the range suggested.  Unfortunately the way that Mach works is that the mark/space ratio is derived from the kernel speed.  Supposing that the kernel speed is set to 25 kHz which is suggested in the manual, there are only 10 discrete pulse lengths of a  2.5 kHz signal that Mach can generate.  You would not therefore expect to see a very smoothly varying speed.  One way to check this would be to set the PWM base frequency to something very low, like say 2 Hz.  If the controller works in the way we are assuming, you will find that the motor runs very unevenly, as it will be starting and stopping twice a second.  IF the controller works in this way then it isn't really compatible with Mach.

So could I suggest that you try this test and report what you find.  Depending, we can think again about what to do.


Sent from my iPad using Tapatalk
Title: Re: Help Please with PWM Spindle Motor Speed
Post by: Buggalugs on November 17, 2014, 04:24:36 AM
Thank you once again John for your help, it is greatly appreciated. I will try this out later today and get back to you.
 

I don't want to muddy the water any more at this stage, but after writing  my last post I did ponder about the PWM signal to the Speed Controller being inverted from the Breakout Board. I have a full set of Spare PCB's for the Mill's Electronics and I am going to ring through the 5v Line to the MOTO Connector to validate my statement that there is an error on the Drawing. My thinking is that if the Pulse train is Negative going and the Speed Controller is expecting a Positive going then that could explain why my findings are so erratic. (Y/N??) 

I'm not too sure what would happen if as I am thinking the PWM Pulse train was inverted, if it would indeed work at all.

Just thoughts of a desperate and demented individual..... ??? 
Title: Help Please with PWM Spindle Motor Speed
Post by: JohnHaine on November 17, 2014, 05:45:09 AM
Well, if it was just inverted then you would expect the sense of the speed control to be inverted too.  So set it lowest and it would run highest and vice versa.  But if the BoB and controller have a common ground then you would just be grounding the controller input and nothing would happen.

By the way I see no drawing?


Sent from my iPad using Tapatalk
Title: Re: Help Please with PWM Spindle Motor Speed
Post by: Buggalugs on November 17, 2014, 08:15:27 AM
Hello again John, The Schematic is attached at the bottom of my second last post as a schematic.pdf.

As a side element, can you recommend a Speed Controller that works with the Spindle Motor I purchased and with Mach3 ?
Title: Re: Help Please with PWM Spindle Motor Speed
Post by: JohnHaine on November 18, 2014, 12:57:14 AM
I see it!  I'm not sure what you meant by your comment in pin 2 and negative going.  Pin 2 on which connector?  I suggest we try to find out more about this speed controller first before looking for another one.  Suggest you try the test that I recommended.
Title: Help Please with PWM Spindle Motor Speed
Post by: JohnHaine on November 18, 2014, 11:05:23 AM
Well this is curiouser and curiouser!  There is an exactly similar unit on eBay with the item number 191239446164, but there it says that it uses a variable voltage drive and even supply a potentiometer  for manual control.  Did the supplier send any documentation with the unit?  I think either it has two modes, one in which it uses a variable voltage and the other where it accepts an external PWM pulse (possibly selected by that jumper on the pcb); or it is designed to accept only a variable voltage but the suppliers have tried driving it directly from Mach and found the only way to make it work is to use a high base frequency and hope the circuit does a bit of smoothing internally.  Unless we have some documentation or I can see the unit I don't know what to suggest.


Sent from my iPad using Tapatalk
Title: Re: Help Please with PWM Spindle Motor Speed
Post by: Buggalugs on November 19, 2014, 06:59:24 AM
Sorry about my absence yesterday, however I am back hopefully with a renewed vigour to put this to bed.

Okay, firstly, I bumped the PWM base frequency down to 2Hz as you recommended and the motor seems to respond in the same manner as you mention, it tries to pick up, but it is pulsed about 5 times per second. When I go back to the Config|Ports & Pins|Spindle Setup, Mach3 has changed the  PWM base frequency to 5Hz. I have some video of it which I will post later.

Secondly, after ringing out the Break Out Board I have amended the schematic of the Break out Board to show the correct routing of the Spindle Output Port. The original is incorrect in so much as Pin 1 of the ‘MOTO’ connection is connected directly to Pin 1 of the LPT Port, whilst Pin 2 is connected Hi (TTL Vdd)  via one segment of the SIL resistor.

You query what I mean about what I mean in ‘Negative Going’ This may be an old term, but Positive and negative going relates to the pulse position with respect to 0v. I have attached a drawing which I used to show the kids at College to demonstrate what is meant by Positve or Negative going.


“Did the supplier send any documentation with the unit”? of course not !!! You’re very lucky if you get a receipt. ::)

The Controller did not come with an external Pot, there is a onboard Jumper option which allows you to select between the onboard Multi-Turn Trimmer which if I remember is about 100k, or external PWM. The jumper I have selected is onto the external PWM option.
Title: Re: Help Please with PWM Spindle Motor Speed
Post by: Buggalugs on November 19, 2014, 07:28:47 AM
There is a video of what happened when I bumped the PWM base Frequency down to 5Hz at

http://youtu.be/zptYwb7_8uQ
Title: Re: Help Please with PWM Spindle Motor Speed
Post by: JohnHaine on November 19, 2014, 08:51:26 AM
OK, I think I know where we are now!

First, I think the speed controller you have is designed to get its pulse stream externally, and possibly also from an internal oscillator as an option.  The latter is probably a 555 timer.  An option to control the speed with an analogue voltage, which is the conventional approach, is not provided.  So it expects to get a pulse stream with a variable mark:space ratio which it uses to switch the motor supply on and off.  The frequency of this has to be pretty high, so you have to set the Mach 3 PWM base frequency rather high as well.  But Mach 3 trades off base frequency against speed resolution, the normally expected base frequency is of the order of 25 Hz.  I'm afraid that this makes the controller unsuitable for direct connection to the BoB which clearly just outputs the PWM from Mac directly.  Whoever designed it didn't understand how Mach3 works.

It would be possible in principle to convert the Mach PWM signal at 25 Hz say to a voltage (it just needs an R and a C); then convert that back to a PWM signal at 2500 Hz; but all a bit of a faff.

What I would recommend is that you use a controller that expects to see a 0 - 10V signal, which can easily be derived from the normal PWM output using a normal base frequency.  A possible unit is this one on eBay: 151151353460  I have one of these which I haven't yet used, but have seen good reports on them in other forums.  

Then you will need a simple adapter circuit that smooths the PWM output to produce the 0-10V.  I have posted a circuit somewhere in this forum recently.

Alternatively you can buy a board from Roy Harding at http://www.diycnc.co.uk/html/spindle_boards.html - this one actually uses step/direction rather than PWM but it's just another Mach config option.  Roy's documentation is good - you can download the manual.  As this has reversing relays and things it is probably a good get.

Now, on to the wiring.  It isn't correct to say that the signal is "negative going" as the BoB can only product 2 output levels, 0 v and ~+5V.  The signal might be inverted, but that's a different thing.  Almost certainly the motor controller expects to see a pulse train at 0 to 5V on pin 1 and ground (common) on pin 2.  As you have shown the wiring pin 1 on the parallel port will be connected to the common on the motor controller.  The resistor is there to pull up the parallel port output to 5V since normal TTL high level is only ~3V.  I think it was right the first time.  But frankly I would prefer to see some buffering between the parallel port pin 1 and the speed controller.

I hope this all helps - not the best news I fear.
Title: Re: Help Please with PWM Spindle Motor Speed
Post by: Buggalugs on November 19, 2014, 11:27:58 AM
Hello again John, and thank you so much for your advice. Well as you say, not the best news, but frankly I was half expecting a reply as such. However, the good news is in one respect, it is not something stupid that I have been doing (Which was what I was also expecting!) and in another respect, it looks like what I have bought is a bit of a pup in so much as in its present form it would never do what it is expected to do.

I have briefly looked at both your recommendations and on reflection I will probably go for the the Chinese option after a little research. I would prefer to go the route of the Roy Harding recommendation for one I prefer to spend money at home if I can, and I still don’t trust the little yellow bugga’s. What does put me off though is that it looks like I am going to need a ‘Motor Speed Inverter Unit’ also..


What I think I will do before I do anything else is to drag the scope over to the Mill and have a poke about to see what exactly is going on with that signal, which is probably what I should have done in the first place.

Once again thank you so much for your help and I’m sure I will get back here to let you know what I find and above all what I do to resolve the issue.
Title: Re: Help Please with PWM Spindle Motor Speed
Post by: JohnHaine on November 19, 2014, 12:30:33 PM
I don't know why you think you would need an inverter.  I think you are saying that you may get the motor speed controller and one of Roy's boards.  You can be pretty confident that Roy's board will behave properly without any extras.  Where are you based?