Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: PurpleThumb on July 31, 2013, 11:16:53 AM

Title: Mach3 Output For DC Motor Control
Post by: PurpleThumb on July 31, 2013, 11:16:53 AM
Hello Everyone...I'm new here today.

I have a Bridgeport style mill (48" table) with a Leeson 90volt DC motor attached (no speed control other than pulleys)

I plan to convert this mill to CNC shortly, using Mach3 as control software.

I'm well versed in digital and analog electronics, as well as computer science and programming ( basic, C, C++, visual basic )

Sorry, no bragging here, but I don't want anyone to hold back tech info.

My main question is with spindle speed control.

While reading other posts, I notice that with Pusle Width Modulation control of DC motors, most users on this site

convert the PWM output of Mach3 to a 0 - 10 volt analog dc voltage and use it to control a PWM DC motor driver board.

I don't get it. Why not just drive a hefty Mosfet ( like a irf260n (50 amps @ 200 volts) ) directly from the Mach3 output pin? (through a suitable FET driver chip such as  a 4420CN, and  an opto-isolator of course )

Why go from PWM to Analog and back to PWM again to drive the motor?

Am I missing something?

Thanks!



Title: Re: Mach3 Output For DC Motor Control
Post by: DICKEYBIRD on July 31, 2013, 11:30:46 AM
Probably because many of the users you're referring to (like myself) don't have the electronics knowledge to build their own safe, reliable DC speed control from scratch.  Most will buy an industrial controller new or used off ebay, like KB brand or others.  You just can't beat their availability & value.  I have 4 or 5 of the KBIC-120's and paid less than $35 each incl. shipping.  They're older SCR models and not PWM but the motors are very happy with them. 
Title: Re: Mach3 Output For DC Motor Control
Post by: PurpleThumb on July 31, 2013, 11:38:48 AM
Hello, and thanks for the quick reply!

I understand.

It just did'nt seem efficient to me.

I wonder why someone doesn't sell a board like the one I described?

Seems less complicated.

( Sorry if I sounded like an arrogant know-it-all, I did'nt mean to )

Best Regards,

B.
Title: Re: Mach3 Output For DC Motor Control
Post by: Hood on July 31, 2013, 02:05:29 PM
Does your spindle drive accept a PWM signal? Most I would have thought look for a 0-10v signal but then again I have never used any DC spindle drives so......
Hood
Title: Re: Mach3 Output For DC Motor Control
Post by: stirling on August 01, 2013, 05:00:12 AM
Not speaking for PurpleThumb here but as I understand it he's suggesting this as a way to implement your own drive that DOES accept PWM rather than use an off-the-shelf drive that expects an analogue voltage.

Personally I think it sounds like a nice (and dirt cheap) idea for those that want to roll their own.

(But then I know squat about driving large DC motors so I might be backing the wrong horse here for all I know).

Ian

Title: Re: Mach3 Output For DC Motor Control
Post by: Hood on August 01, 2013, 07:45:43 AM
Ian, yes I think thats what he was meaning but it was just this bit
Quote
most users on this site convert the PWM output of Mach3 to a 0 - 10 volt analog dc voltage and use it to control a PWM DC motor driver board
Which to me seemed like he was saying that normal DC motor drives accepted PWM so why convert to an analogue voltage in the first place only to convert back.
 I know nothing of electronics so I will keep away from that side of things other than to say if it was that easy to make a drive would it not have been used Industry wide long before now rather than complex drives that cost many hundreds or thousands of £ or $.
 

Hood
Title: Re: Mach3 Output For DC Motor Control
Post by: PurpleThumb on August 01, 2013, 08:28:41 AM
Hello All,

I've found that what is needed is what is called a "H-Bridge" circuit.

Simply said, it takes the PWM output from Mach3, and simply amplifies it to the voltage and current required

by the motor.

Has three control pins...

1. Forward
2. Reverse
3. PWM Input

That connect directly to Mach3 output pins on the computer.

The cost of the parts involved for a 200 volt 50 amp amplifier are less than $30.00, ( 4 fet transistors, 4 npn transistors, and an isolator chip if I want to solder my own)

I would rather purchase the thing assembled if the price is right.

I'll let you know what I find out.

Cheers!
B.
Title: Re: Mach3 Output For DC Motor Control
Post by: HimyKabibble on August 01, 2013, 11:15:03 AM
An H-bridge is the basic output circuit used in nearly any DC motor controller that supports bi-directional operation, and many that only support uni-directional operation.  But the H-bridge itself is only PART of a usable motor controller.  There is MUCH more required to make something that would be suitable for driving a machine spindle, including voltage and current feedback, I/R compensation, and protection circuits to prevent the H-bridge from going up in smoke if not driven correctly (and you CAN'T count on Mach3 to always drive the PWM output correctly.  Without all that other other logic, you can expect to have something that works very poorly, up to the point where it goes Pfffffffffffffft!  And that WILL happen in very short order.

Regards,
Ray L.
Title: Re: Mach3 Output For DC Motor Control
Post by: PurpleThumb on August 01, 2013, 11:43:37 AM
Wow!

You sound angry!

WILL go up in smoke?

You assume I know nothing?

You don't know anything about me.

If it goes up in smoke, I lose a few dollars.

But I have some fun, and I learn something.

I'll modify the circuit and try again, and  I'll solve any problems.

When it works, I'll enjoy the great satisfaction of solving those problems.

Opto isolation protects the computer, fuses protect the motor.

I'm not selling anything here, just learning, and sharing.

Don't take it personally, its not your money.




Title: Re: Mach3 Output For DC Motor Control
Post by: Tweakie.CNC on August 02, 2013, 12:01:48 PM
Hi B,

Please keep us informed of the progress on your own designed PWM speed controller. Once it is all sorted I am sure others would be most interested in the circuit details etc. if you are happy to share it as a project.

Tweakie.
Title: Re: Mach3 Output For DC Motor Control
Post by: PurpleThumb on August 02, 2013, 12:12:58 PM
Hi Tweakie,

I would be most happy to share my progress ( successes & failures ).

Thanks for Asking.

B.

"All of us together are smarter than any one of us"

Title: Re: Mach3 Output For DC Motor Control
Post by: Tweakie.CNC on August 02, 2013, 12:16:42 PM
Quote
"All of us together are smarter than any one of us"

Absolutely true my friend  ;)

Tweakie.
Title: Re: Mach3 Output For DC Motor Control
Post by: JohnHaine on August 04, 2013, 03:07:34 AM
To answer your original question, the answer is that the PWM base frequency that Mach outputs is quite low. See section 5.5.5.2 of the config guide which mentions a value of 50 Hz.  But I am sure I have seen posts where people are using even lower, down to 20 Hz.  So smoothing the signal with an RC and applying the resulting signal to a conventional motor control makes more sense perhaps to give smooth running.  If you try the direct drive it would be interesting to know the results.
Title: Re: Mach3 Output For DC Motor Control
Post by: PurpleThumb on August 04, 2013, 09:43:44 AM
Hi Tweakie

I think that 50hz base frequency may be unusable, as I understand most systems use 10K or more.

I'm hoping that the base frequency is configurable in Mach3, see below...

(http://i44.tinypic.com/2564jnd.jpg)

I would like to construct a spindle motor speed control driver that will also operate stand alone, so I would'nt have to boot
the computer and launch Mach3, just to drill a hole. Also maybe a foot operated foot switch to reverse the spindle, for tapping threads...

Funny how these projects tend to sometimes expand on their own...

Cheers!

Bill
Title: Re: Mach3 Output For DC Motor Control
Post by: HimyKabibble on August 04, 2013, 09:49:46 AM
The PWM outputs, like all Mach3 outputs when using the PP, are limited by the kernel frequency.  The higher the output frequency, the less resolution you get.  With a 25kHz kernel, and 10kHz PWM frequency, you'd have less than 2 bits of resolution.  Some hardware motion controllers, like SmoothStepper, will allow higher frequencies, but I'd be surprised if even they supported 10 kHz.

Regards,
Ray L.
Title: Re: Mach3 Output For DC Motor Control
Post by: PurpleThumb on August 04, 2013, 10:07:03 AM
Hi Ray,

I understand.

Could be the reason why no one ( as far as I know ) drives directly from Mach3.

I wonder what the lowest usable base frequency is?

What are the drawbacks of a low base frequency? Noise? Choppy Operation?

Don't know.

Thanks for posting,

Bill
Title: Re: Mach3 Output For DC Motor Control
Post by: JohnHaine on August 04, 2013, 05:40:15 PM
Both of those.  And if you want to be independent of Mach for the odd hole then a standard motor controller makes sense.  It only needs an R and a C to smooth the PWM output, and maybe an op amp.  I use a KB motor controller and they are excellent ( though haven't got Mach controlling it yet).