Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: chrisjh on July 25, 2010, 07:23:17 AM

Title: PWM Spindle Control using Mach3 - How I did it
Post by: chrisjh on July 25, 2010, 07:23:17 AM
Hi All,

I see a lot of queries, especially from novices, regarding methods of Spindle Control.  There are a lot of topics covering this but most do not give a full explanation with examples in one place.  

What I have tried to do is put a lot of scattered info and the benefit of my own personal experience into one document.

Please take advantage of my experiences at www.cjh.com.au//PWM Spindle Control using Mach3.pdf (http://www.cjh.com.au//PWM Spindle Control using Mach3.pdf)

Regards

Chrisjh
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: Tweakie.CNC on July 25, 2010, 10:32:45 AM
Excellent work Chris, a well prepared document which I am sure is extremely useful to us all.

Tweakie.
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: RICH on July 25, 2010, 10:56:14 AM
Thanks for the write-up Chris.
I have created a new thread in Members Docs titled Spindle Speed Control and have posted your document there.
It is nice to have some focused documents on subjects. Those documents can save users a lot of time since sometimes you need to have
a grasp ( or maybe total read of the manuals ) to get what you need to know.
 :)
RICH
 
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: budman68 on July 25, 2010, 11:11:26 AM
Very nice work, Chris, thanks for sharing-

Dave
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: khalid on July 25, 2010, 11:58:46 AM
thanks  Chris.. It is useful to all of us.
Regards
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: airnocker on January 11, 2011, 10:53:17 PM
Thanks Chris for a great, well documented explanation on your Mach3 spindle speed control.  This information was extremely helpful to me.

Best,

Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: Peter Homann on January 12, 2011, 01:36:30 AM
Hi Chris,

Unless I've understood incorrectly, There doesn't appear to be any opto-isolation in your PWM to voltage converter circuitry. If this is the case you are relying on the VFD or speed controller having opto-isolation on its input.

If your circuit is connected to a VFD or motor controller input that is not isolated from the rest of the outputs connected to the same supply, you will most likely fry whatever is connected to these other outputs.

At the very least you need to put in a warning in your documentation. Otherwise some of the novices you are trying to help wont be happy.

Better still, replace T1 in your circuit with an opto-isolator and make it clear that the Gnd and 12V supply comes from a separate isolated power supply.

Otherwise all good info. :)

Cheers,

Peter.
 
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: chrisjh on January 12, 2011, 07:03:41 AM
Hi Peter,

The input to T1 on the PWM Converter is channelled through an Opto Isolated C23 Breakout board.  The Output to the VFD is as recommended by Danfoss documentation.  The PWM converter is powered by a 12VDC supply which is used only for the PWM Converter and a workspace illumination lamp.  All power supplies (5VDC, 12VDC and 42VDC) are all securely grounded to the chassis on the -ve side. 

I am a firm believer in having all supplies grounded to the chassis on the negative side as it make things safe and easy to troubleshoot.  I believe that isolated, floating power supplies introduce problems that are difficult to faultfind when things go wrong.  I have a Syil CNC Mill that has multiple isolated supplied with at least 2 separate grounds.  It is a right menace to faultfind and is downright dangerous to work on because of isolated, non common grounds.  It was because of this poor design that I deliberately designed my lathe to make it safe and easy to work on.

Regards

Chrisjh
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: Peter Homann on January 12, 2011, 07:25:36 AM
Chris,

The output you are using pin 14 on port 2 uses the same supply as pin 1, 16, and 17 on port 2. So if you try to use a VFD or DC motor controller such as the KBIC-120, with a non-isolated analog control voltage input, the 0V terminal is likely to be at supply((110V) - 10V. If that is the case, there will be serious damage if these other inputs are referenced to chassis ground.

If the VFD or DC motor controller has an isolated or ground reference input as is the case with your Danfoss VFD, then yes your circuit will work.

You should still make it clear that your circuit will not work with non-isolated VFD or Motor controller inputs.

Cheers,

Peter.
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: airnocker on January 12, 2011, 11:57:26 AM
Chris, what Mach3 Kernel Speed are you running to have the PWM Base Frequency set to 500?

Thanks

Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: chrisjh on January 13, 2011, 01:58:59 AM
Hi,

My understanding is that Kernel Speed is not important when using a Smoothstepper as the step and direction pulses are generated by the Smoothstepper, not the controlling computer.

To answer your question, my Kernel Speed is set to 45000.  I use a 1.6GHz Centrino Dell Laptop.

Regards

Chrisjh
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: airnocker on January 13, 2011, 10:27:28 AM
Chris, thanks for your quick reply.

 I'm not using smooth stepper which is why I asked.
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: peu on July 06, 2011, 03:22:26 PM
I just built this circuit, if you use low PMW, say 100hz, the spindle speed woobles, above 1000hz is a safe value. Thanks for sharing it.


Pablo
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: Mountainman on December 07, 2012, 07:53:33 AM
OK, kernel speed 45000hz pwm base frequency 1000hz= 45 possible speed increments on the spindle.  In all honesty this barely sounds acceptable.  at this point it seems like the VFD should be chucked for a variable pulley? 
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: krypton on September 01, 2014, 04:09:56 AM
I noticed that you have earthed all unused 4011 pins.  You must not do this.  Only earth (or connect to +12V) unused inputs. 

The logic gate inverts.  So if you earth both inputs the output goes high - the top output transistor turns on.  If you earth the output the only limit to the current drawn is the on-resistance of the top transistor.  This will heat the package, as you have three of the gates with outputs shorted.  The currents and power may exceed the maximum specified, and the chip life will be reduced.

So leave all outputs open-circuited.

And check that the chip is specified to handle 12V - some have a maximum of 7V, designed to operate on 5V supplies.
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: Tweakie.CNC on September 01, 2014, 07:46:43 AM
Well spotted Krypton - you are quite correct - only the unused inputs should be tied to GND.

Tweakie.
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: chrisjh on September 03, 2014, 01:13:14 AM
Hi All,

Thanks for correcting my error.  The design intent was to tie all unused inputs to ground (the reason for this is to prevent high impedance inputs from "floating high", thus causing indeterminate output states).  I got a bit carried away when I was drafting the schematic.

The CNC lathe has been operational for quite a few years now, and the spindle control has never missed a beat.

Regards

Chris Humphris
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: garycapetown on September 04, 2014, 02:46:12 PM
Firstly, Thanks Chris for your well documented info for the PWM converter.
l have bought one of the China spindles kits that included the VSD, which I knew would not be the best VSD.
The VSD does not have a PWM input, so I also need to convert the PMW signal sent from my smooth-stepper controller, to a 0-10V input for the speed VSD.
I bought the required parts today, but need to confirm the part number for the input transistor. My local electronic supplier supplier me with a surface mount BC848, but all the other parts are "through hole".
In the pictures of the converter already built, transistor does not look like a surface part. I first though they supplied me the incorrect part, but when I Google BC848 it also shows it as a surface part.... some help please...
Then I also understand that there is an issue with the GND in the Schematic, so was wondering if the correct Schematic could be placed on the site to help us novice electronics guys...
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: chrisjh on September 04, 2014, 07:51:02 PM
Hi All,

My sins have caught up with me :'(

I have corrected the schematic and published a Parts List (BOM) and attached them below.

To make it easier for others to assemble this PWM to Voltage Converter, I have also attached the photographs showing the Veroboard PCB layout (top and bottom side).

Regards

Chris Humphris
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: krypton on September 09, 2014, 05:18:52 AM
We bought a Chinese NC milling machine that was supplied with NCstudio software and driver board.  Being familiar with Mach3, we decided to convert.  With a non-isolated breakout board and a 5V external supply, it was easy to connect up the X, Y, and Z stepping motors (there is isolation in their driver units).

The spindle motor is driven by a Fuling V/F inverter model DZB312B001.5L2DK.  An internet search located a manual for the DZB200 / DZB300 series inverters, showing that there are some differences between the DZB300 and DZB312 models, like a panel mounted speed pot on the latter.

The manual shows about 200 commands, so it is a complex machine.  We set the command so that it could be controlled by the keypad.

We found that the speed was controlled by NCstudio from three digital inputs in eight levels, so we were at least able to run the mill by connecting the appropriate wires together

Trial and error located the command that allowed the speed to be controlled by the panel mounted pot or by an external pot.  (Command F0.03 set to 1 or 2.)  There is a 10 V supply with an analogue ground for the external pot.

The breakout board supplies a 5 V signal driven by the PWM output of Mach3.  This would not directly drive the external pot input - it seemed to upset certain timers in the inverter.  The filtering command F2.13 designed to smooth out interference did not seem to work.

The PWM signal was opto-isolated (to keep the analogue ground separate from the digital ground), amplified to 10 V and filtered.  The command F2.11 to set the upper voltage limit to 5 V did not seem to work, (although it worked on the panel pot okay), so the amplification to 10 V was necessary. 

The PWM signal from Mach3 has a minimum space pulse width, so as the frequency is increased the filtered voltage range is reduced, down to 50% at over 4 kHz.  A compromise was reached by setting the frequency to 100 Hz, and the RC filter time constant to 100 ms.  Because the inverter input has an input resistance of 20 kohms, the R value has to be low.  A sufficient value was 470 ohm, losing 2.5% of the signal.  To not lose any more voltage the filter input was driven hard, by using a CD4069 hex inverter with all six inverters in parallel, losing only 20 mV.

So the circuit was:  an opto-isolator driven such that its output transistor was off when not driven from a computer, so that the speed is zero when first powered on.  That transistor drives the CD4069 parallel inputs with a pull-up resistor.  The chip and resistor are powered by the inverter's +10V.  Then an RC filter into the external pot input.  If a non-isolated input is satisfactory the opto-isolator is replaced by an npn transistor and two resistors.

(So it is a lot like Chris Humphris' one except with no LED, no power supply capacitor, no pot, using an optoisolator on the input, and using a different logic chip.  With his, I would recommend a resistor between the transistor base and earth so the spindle motor does not turn on ever if the input is unplugged - base leakage current.)

As it turns out the full range of the frequency to get 24,000 rpm was available and Mach3 successfully handled the spindle motor.

Then a digital input to the inverter was used to set the motor in run mode from Mach3.  This was derived from the PWM spindle drive with a filter, to put the inverter in Run Forward mode whenever the pulses were there, and Stop mode when they were absent.

The emergency stop button was wired to the computer to action a Mach3 emergency stop when required.

And using an inverter relay output (command F2.21) to be active only when the spindle motor was turning to drive a solid state relay to turn on the spindle motor water cooling, vacuum dust extractor, mister and cooling fans, so that it is quiet unless the mill is actually cutting material.

It is intended to get the mill to produce a printed circuit to replace the non-photogenic prototype board – then we can produce the photos for all to see.

Krypton
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: xtreme_2010 on March 22, 2015, 05:38:12 AM
Hi to all,

First of all I am a novice, so please pardon me if I ask the wrong question at wrong place. This thread is very well written and is very useful to people like me who are trying to build a cnc lathe with threading option and thanks to Chris for sharing this useful info.

The main thing I want to ask the expert persons is that my PWM signal is not isolated, hence i may end up frying everything, can any one please post a diagram of a circuit on how to isolate the pwm signal from parallel port before passing it to the PWM-to-analog converter, without disturbing its frequencies or voltages.

Errors happen with me all the time so i just want to be safe. What I understand from my knowledge is that a device like opto-coupler (to be used for pwm signal isolation) should be very fast because PWM signals are high in frequencies?

Also if I use I regular Solid State Relay which has a switching time of 10 milliseconds, to isolate the signal, will it work?

Thanks to all in advance and sorry again for stupid mistakes.

Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: krypton on March 22, 2015, 07:48:00 AM
Practically any opto-isolator will do, as the PWM pulses are not fast.  I used a HCPL-0501 because I had it in stock.  I drove the opto-isolator internal LED direct from the break-out board through a 470 ohm resistor (into pin 3).  The output transistor (pin 6) has a 22K load to +10V, into the hex inverter inputs.  Pin 8 to +10V, pin 2 breakout board earth, pin 5 the motor controller earth  See my last posting - Sep 9, 2014.

You cannot use a solid state relay because they are a latch, and normally are only used for switching AC - they depend on current reversal to turn off.

Krypton
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: xtreme_2010 on March 22, 2015, 02:09:49 PM
Thanks for pointing me in the right direction but as I said that I'm just a person with less electronic skills and I said wasn't able to understand your post  ???

I have EL817 and 4N35 opto couplers in stock, if you can draw and show a circuit on how to hook either one of these to the Chris's described schematics, I would be really thankful to you guys

Cheers
GAURAV
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: krypton on March 22, 2015, 08:03:03 PM
Sorry, one picture is worth a thousand words.
Krypton

Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: xtreme_2010 on March 23, 2015, 02:09:01 AM
Wow  ;D that was super. Very helpful, heartiest thanks to the experts here. Will complete the trials and let you know what's up.
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: Len-Tikular on March 23, 2015, 09:24:47 AM
I could use some help please in hooking up my Spindle motor to my breakout board.
This is ongoing from my conversion of my TCL160 which has a Mitsubishi FR-Z024 0.37k fitted.

The original Documentation from the TCL160 shows these connections were used.

STF (Fwd) to pin 5 on my new board
STR (Rev) to pin 7 on  my new board
5
2
P24 (Looks like pin SD which is common) Output shutoff, how is this handle by Mach3
MRS/RT This is marked as 'Boost' on the original TCL Manual (What is the purpose of the Boost)

I have included some diagrams and would appreciate help on the correct hookup.
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: xtreme_2010 on March 24, 2015, 03:53:33 AM
Hi Krypton,
just a small thing about the optocoupler, in the diagram you have shown pin2 of EL817 is connected to 0 volt, there is no 0volt DC in my circuit or power supply, so can you suggest where and how to connect the pin 2 of the optocoupler?
Many thanks
Gaurav
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: krypton on March 24, 2015, 05:22:48 AM
To the common ground of the breakout board - the computer ground.  Because there are two grounds that are not connected, they have to have different names.

Krypton
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: krypton on March 24, 2015, 07:48:23 AM
Len-Tikular wrote:
I could use some help please in hooking up my Spindle motor to my breakout board.
This is ongoing from my conversion of my TCL160 which has a Mitsubishi FR-Z024 0.37k fitted.

The original Documentation from the TCL160 shows these connections were used.

STF (Fwd) to pin 5 on my new board
STR (Rev) to pin 7 on  my new board
5
2
P24 (Looks like pin SD which is common) Output shutoff, how is this handle by Mach3
MRS/RT This is marked as 'Boost' on the original TCL Manual (What is the purpose of the Boost)

============
I am doing some guessing here.  

I have not learned how to control the forward from Mach3, because it would require a motor on/off inserted in the right places in the G-code.  I am sure it is possible.  That is why I added the extra circuit, filtering the PWM signal, so it is in forward mode only when the PWM pulses are present.

The FRZ-024 manual shows that there are two ways to control the speed.  One is with three wires (RL, RM, RH), providing slow, medium and high speed.  The other is a potentiometer (pins 10, 2, 5) that gives a speed proportional to the voltage on the slider.  This would be best, so I suggest my Krypton circuit as above (reply 23) to give both speed and forward signals.  There is an internal +5V supply (pin 10) to power the filter circuit, and the same constraints are needed - a low value filter resistor to provide the full range from the internal +5V with the filter driven hard from a low resistance driver chip.  Use pin 5 as the common ground for this circuit, not the digital ground P24.  See Appendix B in the manual.

I cannot envisage a need for reverse motor direction, so you will not require that input at all.

I think that the second acceleration/deceleration (MRS) would be for emergency stop conditions, a safe fast stop, not a dead stop, which may put more stress on the motor than is justified or safe.  Remember that these controllers are not only used for NC milling, etc. (I worked on locomotives, and if they are stopped too quickly they can derail, or put flats on the wheels - there is an optimum deceleration.)

Krypton
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: Len-Tikular on March 24, 2015, 09:34:30 AM
Thanks for your reply Krypton.

On this Lathe (TCL150) the way the tool turret and tools are designed the Surfacing tools come into contact with the workpiece from above. This is where the reverse rotation of the spindle motor is needed.

I assume also that accurate control of the spindle speed is required where 'Threading operations' are carried out ?

George
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: RICH on March 24, 2015, 01:40:04 PM
Quote
I assume also that accurate control of the spindle speed is required where 'Threading operations' are carried out ?

The more stable the rpm the better and set it manualy. ie; don't have a vfd trying to maintain the rpm while Mach is trying compensate for
rpm changes.

RICH
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: xtreme_2010 on March 24, 2015, 04:29:44 PM
Fired the circuit but looks like I messed up, there is no analog output coming from it, so gonna assemble a new circuit keeping in mind the schematics, hope for the best

Cheers
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: xtreme_2010 on March 24, 2015, 04:31:14 PM
Even if it doesn't go well, I am much thankful to the community.
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: xtreme_2010 on March 24, 2015, 04:37:49 PM
Quote
I assume also that accurate control of the spindle speed is required where 'Threading operations' are carried out ?

The more stable the rpm the better and set it manualy. ie; don't have a vfd trying to maintain the rpm while Mach is trying compensate for
rpm changes.

RICH

To be honest, I doubt mach 3's capability of threading because it likes one pulse per rev which leaves a lot of gray area between pulses whereas being a cnc lathe machine retro fitter I have seen professional systems like HUST and Siemens go haywire even while having 1024 pulses per rev from a good quality encoder.
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: xtreme_2010 on March 24, 2015, 04:43:46 PM
Some peoples have answered to the gray area by giving mach 3 more than one pulse per rev and compsating the more pulses by increasing the pulley ratio so that the increased RPM display is corrected, but again this remains unanswered as the speed of the LPT port is limited.
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: krypton on March 24, 2015, 04:59:29 PM
On this Lathe (TCL150) the way the tool turret and tools are designed the Surfacing tools come into contact with the workpiece from above. This is where the reverse rotation of the spindle motor is needed.

I assume also that accurate control of the spindle speed is required where 'Threading operations' are carried out ?

==========
Of course.  If you always use reverse then my Krypton extra circuit would work.  If you require both forward and reverse, then the G-code solution would be best - that I cannot advise on.

Inherent in the PWM filtering is a ripple on the DC.  I adjusted the values of the filter (R, R*C) and the PWM period as a compromise to achieve satisfactory operation.  In our spindle driver there is an output when the speed is stable, and it showed that the speed was continuously hunting - trying to follow the ripple.  But the motor sounded fine, so it is a reasonable compromise.

Krypton
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: krypton on March 24, 2015, 05:25:24 PM
Fired the circuit but looks like I messed up, there is no analog output coming from it, so gonna assemble a new circuit keeping in mind the schematics, hope for the best

Cheers

==========
It should be very easy to debug.  There should be pulses on the new circuit input (the output from the breakout board).  If you do not have access to an oscilloscope, then an old-style analogue voltmeter would be better that a digital meter because it has inherent mechanical filtering.

So you should be able to control the voltage on the circuit input by controlling the speed through Mach3.  Then look at the optoisolator output (the logic chip input), the logic chip output, the filter output - in turn.

I would expect that your problem is that Mach3 is not yet producing pulses.

Krypton
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: RICH on March 24, 2015, 08:08:46 PM
XTREME 2010,
Quote
To be honest, I doubt mach 3's capability of threading because it likes one pulse per rev which leaves a lot of gray area between pulses


Threading will only be as good as "your lathe system". Have a look at figure 4.4.5 in the Threading On the Lathe Manual for accuracy basis.
Also the rpm indication can be very accurate, out to 4 places, and that was tested / confirmed with a  custom pulse counter accurate to 30 ppm.
If one can "almost" accomplish class 3A threads with a hobby machine, 0-80 and on up.........of what matter should one be concerned.

FWIW,
RICH
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: xtreme_2010 on March 25, 2015, 04:18:48 AM
Fired the circuit but looks like I messed up, there is no analog output coming from it, so gonna assemble a new circuit keeping in mind the schematics, hope for the best

Cheers

==========
It should be very easy to debug.  There should be pulses on the new circuit input (the output from the breakout board).  If you do not have access to an oscilloscope, then an old-style analogue voltmeter would be better that a digital meter because it has inherent mechanical filtering.

So you should be able to control the voltage on the circuit input by controlling the speed through Mach3.  Then look at the optoisolator output (the logic chip input), the logic chip output, the filter output - in turn.

I would expect that your problem is that Mach3 is not yet producing pulses.

Krypton



Kypton,
I dont have a mechanical voltmeter at the moment but I have digital multimeter and I checked the output on pin 14 (defined pin 14 as spindle step pin and dir pin 1, also pwm out enabled in the spindle options) when I gave the command m03 s500 in mdi mode, there was approx 1.5volt coming from it and when I pressed the main reset switch the voltage dropped to zero. So, I guess it's pretty much in order, what do you think? BTW There's an oscilloscope lying unsed in my company's store room from the last 30 years , i will check if its operation.

Gaurav
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: krypton on March 25, 2015, 04:28:11 AM
right, you have pulses at the input.  Now check the circuit as I have listed.  You don't need the oscilloscope,  just the on/off signal you have been using so far.

There are two signal inversions, one through the optoisolator and the other through the logic chip.

Krypton
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: xtreme_2010 on March 25, 2015, 07:18:16 AM
right, you have pulses at the input.  Now check the circuit as I have listed.  You don't need the oscilloscope,  just the on/off signal you have been using so far.

There are two signal inversions, one through the optoisolator and the other through the logic chip.

Krypton

Krypton,

I am not an expert so at first I am making the circuit without the opto-isolater(just sticking to the schematics for troubleshooting). Looks like there might be something else which may have gone wrong.  Can this be the problem that I am using capacitors of capacity 10uF 63volt and 100uF 25volt against 10uF 16volt and 100uf 16volt ?? Also I have connected 12volt to pin 14 and GND to pin 7 of 4011 IC, is this to be done or not? These are the gray areas which might be causing trouble as per my brain works.
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: johnstij on March 25, 2015, 01:39:55 PM
Krypton.
I built Chrisjh circuit some time ago but never got around to fitting it into my system, This thread has spurred me into action. I noted your comments about opto isolator of the circuit from the PWM on pin 14. With your opto circuit you say to omit the resistor & transistor in Chrisjh circuit. On my BOB the PWM from pin 14 is already opto isolated so do I just connect this and ground to the I/p & ground of the  4011N ( ie omit R4 & TR1)
Thank you.
Ian
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: krypton on March 25, 2015, 05:01:37 PM
right, you have pulses at the input.  Now check the circuit as I have listed.  You don't need the oscilloscope,  just the on/off signal you have been using so far.

There are two signal inversions, one through the optoisolator and the other through the logic chip.

Krypton

Krypton,

I am not an expert so at first I am making the circuit without the opto-isolater(just sticking to the schematics for troubleshooting). Looks like there might be something else which may have gone wrong.  Can this be the problem that I am using capacitors of capacity 10uF 63volt and 100uF 25volt against 10uF 16volt and 100uf 16volt ?? Also I have connected 12volt to pin 14 and GND to pin 7 of 4011 IC, is this to be done or not? These are the gray areas which might be causing trouble as per my brain works.

The maximum voltage rating of the capacitors will make no difference.  It must exceed the applied voltage, in this case 12V.

And you are correct that the 4011N pin 14 should be connected to +12V and pin 7 to GND.  If you are not using the N-type (dual-in-line) check the specs for your chip.

In Chris's circuit he had lines to the chip, with no numbers, which in this case he should have added.  Professional engineers sometimes have a shorthand, and often neglect to detail the power connections, in the interests of clarity of operation of the logic.

I said in a previous post that some logic chips are designed for use on 5V supplies, and cannot handle the 12V.  So check that the chip you are using is the correct one.  The easiest way is to google the exact chip name that is printed on the chip you have, and look for the absolute maximum part of the specification.  You will need 16 or 18 V versions.

My apologies for not replying promptly - I am in a very different time zone, GMT+13.

Krypton
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: krypton on March 25, 2015, 05:31:19 PM
Krypton.
I built Chrisjh circuit some time ago but never got around to fitting it into my system, This thread has spurred me into action. I noted your comments about opto isolator of the circuit from the PWM on pin 14. With your opto circuit you say to omit the resistor & transistor in Chrisjh circuit. On my BOB the PWM from pin 14 is already opto isolated so do I just connect this and ground to the I/p & ground of the  4011N ( ie omit R4 & TR1)
Thank you.
Ian

Yes, you must wire it without R4 and T1, direct into the logic chip.  In Chris's circuit he needed to amplify the voltage from TTL levels to the 12V.  His circuit can also handle 5V inputs, that are more common these days.  The transistor also inverts the signal, and you should get the same inversion through the opto-isolator, depending on how it is wired.  There are spare inverters in the 4011, or you can change the polarity in Mach3.
 
Krypton
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: krypton on March 25, 2015, 09:41:34 PM
Just a note to tell you why I did not use Chris's circuit directly.  I did not need an external supply, because there was one directly available in the spindle motor drive inverter, with its own analogue earth, for a potentiometer input.  To get the maximum speed the voltage has to range right up to (usually) 10V.  Hence I needed a low resistance drive and a low resistance in the filter.  In my case the potentiometer input resistance was 20K, so that was the load on the filter.  As it turned out the internal power supply was 10.2V, giving me some head room, and it worked out fine - I could get the full speed from the spindle.

So I was then happy to further load the logic chip with the extra filter to drive the forward pin.  I was also happy to use the internal power supply analogue earth for the common, where I should have used the digital earth for this digital signal.  I could get away with this because it is a steady load on the speed signal for the full time of when the spindle is spinning.  If any other digital input loaded the circuit it could alter the speed slightly when active.

And I required optoisolation.

A further note.  There are many thousands of transistors, all with similar specifications.  So it generally does not matter what transistor is used.  Voltage and current rating are important, but for small signal transistors your use will be well below the limits.  FETs have different abilities than bipolar, and there are npn, pnp, n-type and p-type specs that you must get right.

Similarly resistors have voltage and power maximum ratings and capacitors have maximum voltage ratings.  But again you are likely using them well below their maxima.  The same is true for logic gates.  We could have used any NOR, NAND or NOT gates available, because we are using the chip only as an inverter.  Subject to their maximum voltage rating as already noted.

Krypton
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: xtreme_2010 on March 26, 2015, 01:36:29 PM
Krypton

You don't need to apologize as you are a contributor, instead I should be apologizing because I'm asking too many questions over a simple circuit. My chip CD4011BE and it can handle 12v, I didn't get time today but I will diagnose the circuit tomorrow and update.

Thanks
Xtreme
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: xtreme_2010 on March 26, 2015, 01:51:59 PM
Also I want to tell something ,a so called "expert" friend of mine told me that this is a precise circuit and because of heavy solder joints signal attenuation can be there which may hinder the functioning, can this be the case?
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: xtreme_2010 on March 30, 2015, 01:44:13 PM
Help needed!! :-X

Hello,

I have built the Chris's pwm to analogue converter circuit. I have tried calibrating it with the built in Trimpot but there seems to be a big problem with it. At full RPM it is supposed to give out 10volts and at the half RPMs it should give out 5.0 volt. Here lies the problem My full rpm are 3000 @ 10 volt dc but when I issue the command for 1500 rpm the voltage drops to 4.89 or 4.90. How can the loss for RPMs in this case be compensated? If anybody can point me in the right direction I will very thankful.

Xtreme
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: terrymccafferty on November 07, 2015, 10:43:11 PM
Hi All,

I see a lot of queries, especially from novices, regarding methods of Spindle Control.  There are a lot of topics covering this but most do not give a full explanation with examples in one place. 

What I have tried to do is put a lot of scattered info and the benefit of my own personal experience into one document.

Please take advantage of my experiences at www.cjh.com.au//PWM Spindle Control using Mach3.pdf (http://www.cjh.com.au//PWM Spindle Control using Mach3.pdf)

Regards

Chrisjh
I can't seem to access this document.  It has been quite a long time.  Any chance this would be archived somewhere accessible?

I need to tune a spindle control loop and need all the help I can get.
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: chrisjh on November 08, 2015, 03:15:46 AM
Hi,

You should find the document here in Members Docs:

http://www.machsupport.com/forum/index.php?action=dlattach;topic=15457.0;attach=21882

Unfortunately my website is dead (I found an obituary for the bloke who hosted my website after I investigated why my website was down).

Chrisjh
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: terrymccafferty on November 08, 2015, 08:03:49 PM
Got it.... Thanks
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: jbar on October 25, 2016, 08:55:03 PM
Am I correct in saying since this thread mentions VFD's it is for controlling an AC spindle motor?  I'm looking for direction on controlling a  DC spindle motor with Mach3.
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: chrisjh on October 26, 2016, 01:03:23 AM
Your assumption is correct.  Ac Motors only.

Chrisjh
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: jbar on October 26, 2016, 04:41:19 PM
Your assumption is correct.  Ac Motors only.

Chrisjh
I have searched high and low trying to find out the basics needed to run a DC spindle motor from Mach3.  I am using a C10 breakout board - which I know will not support PWM.  If someone would give me a basic overview of what I need from a hardware standpoint I'd appreciate it.  Since Im already using up my parallel port, for the C10 board, Im thinking of using a RJ-45 breakout board.  Then, I'd go from the RJ-45 board to a DC motor controller to the DC motor.....would that work? 
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: Peter Homann on October 26, 2016, 05:21:19 PM
Hi,
Controlling the spindle speed has little to do with the motor type, ac,dc,brushless, etc, and everything to to with the motor controller driving spindle motor.
It is the motor controller that  determines how you will drive your spindle motor.

What motor controller do you have? If all you have is a DC motor, what are the motors specifications, that is what is the rated voltage and current for the motor?

Cheers,

Peter
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: jbar on October 27, 2016, 10:51:17 PM
Using a treadmill motor PM-DC, Model C3354B3008, 21.4 Amps, 2.6 HP max, 1.5 HP @ 95 volts DC continuous.  As far as controllers, I hope to use the MC-60 controller that came off the treadmill.  I am open to suggestions if you think I should us another controller.
Title: Re: PWM Spindle Control using Mach3 - How I did it
Post by: Peter Homann on October 29, 2016, 07:42:59 PM
Hi,

I don't have experience with this particular controller, but you may be able to get it to work.

I mainly use KB electronic controllers. The KBIC-125 below or similar should be suitable for your motor.

http://www.ebay.com/itm/KB-Electronics-KBIC-125-1-5-HP-90-VDC-OUT-115-AC-IN-MOTOR-SPEED-CONTROL/231944525239

You could then use a DC-03 Digispeed to then control it from Mach3.

http://www.homanndesigns.com/index.php?main_page=product_info&cPath=54_1&products_id=21

Cheers,

Peter