Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: rhtuttle on March 04, 2016, 05:38:16 PM

Title: M3 M4 switching
Post by: rhtuttle on March 04, 2016, 05:38:16 PM
Have a bench top lathe (Seig C3, 7x14) that I have converted to CNC.  Currently run with a Gecko 540, Mach 3 and UC100.  Would now like to automate the spindle direction change through Mach.  Current machine has a 350 watt brushed DC motor with a 3 position switch reverse-off-forward.   I am upgrading the motor to 750 watt, 7.5 amp, brushed DC out of a treadmill which has a controller with speed control and magnetic speed sensor.

In spindle setup for Mach3 you specify relay #1 and #2 for m3 and m4 commands.  What would you recommend to use in this application?  Any help appreciated.

TIA
Title: Re: M3 M4 switching
Post by: Davek0974 on March 05, 2016, 03:24:31 AM
I would use relay 1 & 2 - of course you will need to fit two relays, most BOB's only have one.
I would have BOTH relays working, one to start stop the drive, one to switch direction as this is done later in the supply line...

The hard bit is reversing the motor - treadmills generally only go one way ;)

Is it a permanent magnet motor or field wound DC motor - permanent magnet just reverse the supply wires, field wound generally reverse the relationship between the field and brush wires - a bit harder to do and sometimes not that simple.

The drive for the motor must be powered off before switching of course and the motor stationary or the back-emf might kill the drive so no instant reversing the lathe i think;)
Title: Re: M3 M4 switching
Post by: rhtuttle on March 05, 2016, 07:19:25 AM
All good info, thanks.

The motor is a permanent magnet type and the brushes are perpendicular, not offset. I have tested it on the bench and it runs both ways by reversing the wires.   :o

I thought I would be able to rewrite the M3 and M4 macros to read the actual spindle speed and not reverse until actually stopped.  I usually start these queries with an admission that I am an electrical idiot.  Should have done that this time too.

You say that the drive for the motor must  be turned off as well. Are you saying the Gecko and/or UC100 need to be powered down as well? That would certainly defeat the purpose of having it switched automatically.  :-\
Title: Re: M3 M4 switching
Post by: Hood on March 05, 2016, 09:45:58 AM
What drive will you be using for the motor?
If a servo drive such as a Gecko then you will be using Step/Dir nd thus no need for relays. If an analogue command drive then likely you will need the relays, all depends on the drive.
Hood
Title: Re: M3 M4 switching
Post by: Davek0974 on March 05, 2016, 12:05:28 PM
Yes, i was presuming OP was using the analogue drive from treadmill.

If using the treadmill drive then I would make it so power was off before switching motor direction so relay one would be spindle off/on and relay two would reverse the motor wires. Simple bit of logic somewhere to ensure fwd/rev cannot change until on/off is off would be all that is needed, I very much doubt the treadmill drive would survive if running and the motor wires were reversed ;)
Title: Re: M3 M4 switching
Post by: rhtuttle on March 05, 2016, 01:16:35 PM
I have attached two photos of the board that came with the motor and the wiring diagram for it as well.  The speed pot has a MIN and MAX as well as a RESET position.  When turned through the min and max you can feel detents but once you get past min going to reset there is nothing.

When the kill switch is closed:

1.   If the pot is set to RESET, only the D11 light comes on.
2.   If the pot is set between min and max, the D11 and D7 light but no movement.
3.   If the pot is then moved to reset, the D7 goes off and if the pot is then moved to something other than reset the D7 and D6 light and the motor begins movement.

What I gather from this is that the reset position is simply moving the pot to a point where the wiper wire is not connected and therefore I need to put one of the relays on the white pot wire.  Am I anywhere close to correct?  If so, can you point me to an appropriate relay for this?

For the other relay I assume (and we all know what that means) that I need a DPDT(?) relay between the motor MC-68 card, red and black wires, that can handle 95v.   Again, can you point me to a relay that would do this and would I need a separate power supply or can it be powered by ?

Thanks for taking time to ‘edicate’ me.
Title: Re: M3 M4 switching
Post by: rcaffin on March 05, 2016, 07:03:02 PM
This is a very good question - meaning I have had to redesign my own system to solve some problems here  ;D
First, you have a brushed DC motor: that can be reversed, so that part is easy.
Next: what sort of relays to use?

I suggest that DPDT power relays such as the JQX-13F are suitable. Cheap on eBay. Mine have 24 VDC coild, but you can get them with 12 VDC coils.

I started with a single DPDT relay to do the reversing. That was a simple, but it has real problems. If I was spinning in reverse (M4) and I turned the spindle off (M5), the reversing relay dropped out, and the motor suddenly had +50 V across it rather than -50 V. That did not harm the motor (I think), but it was stressing the hell out of the spindle driver, and not doing the relays any good either.

I changed the design to have TWO relays. One relay is for M3: go forwards, the other relay is for reverse (M4). I have some interlock logic in both the M3 and M4 macros and also in the hardware to prevent me ever trying to turn both relays on at once. This is ESSENTIAL!
Now when I issue M5 both relays are turned off (even though only one of them was actually turned on). All is well.

Some enhancements: when you issue M3, M4 or M5, Mach introduces a dwell time before the program continues. This allows the motor to spin down. I have about 1.5 seconds for this dwell time.

My M3 and M4 relays have the Common terminals going to the motor. The Normally Open terminals go to the power supply. When the relays are Off, the Common terminals (and hence the motor) are connected to the Normally Closed terminals. I have put 45 ohm 25 Watt power resistors across these NC terminals. These resistors are NOT in circuit when the relay is energised, but when M5 is issued the contacts drop back to the NC terminals, putting these power resistors across the motor. They very quickly suck all the energy out of the motor (which is now acting as a generator) and stop the spin. I have two resistors, but in fact you only need one due to the wiring arrangement. They are sometimes called 'braking' or 'dump' loads.

As to the strange behaviour of the speed control pot - that is probably a safety feature. If you power the system up with the pot NOT on zero, a safety circuit prevents the supply from giving out any volts. That way you don't find the spindle suddenly doing 3,000 RPM when you turn the machine on. Either power up with the control pot on zero (or reset), or manually reset it after powering up.

Cheers

Title: Re: M3 M4 switching
Post by: rhtuttle on March 07, 2016, 09:58:56 AM
Thanks for taking time to answer with so much detail. I am traveling this week  so will take some time to digest the information. Does this mean I actually have four wires from the motor  (2 red and 2 black) and four from the power off of the control board?
Title: Re: M3 M4 switching
Post by: Davek0974 on March 07, 2016, 10:37:58 AM
Not as far as i can see, the motor will only have red/black as its a permanent magnet motor. Perhaps rcaffin could sketch out his plan with the dump resistors as its a good idea, BTW the value of the resistors controls how hard the motor comes to a stop but best not to go too low as it can work the motor brushes/commutator a bit hard ;)
Title: Re: M3 M4 switching
Post by: rcaffin on March 07, 2016, 08:47:46 PM
Brushed DC motor: TWO wires. Colours optional.

Relays arranged as shown below lower photo (I hope).
Power supply comes in at left and goes out at right. The Mill & Lathe relays are there because my machine is more of a machining centre with dual spindles, but I only ever drive ONE at a time.
The dump resistors are labelled 100 ohms, but I think they are 47 ohms each. Also notice that the two 47 ohm resistors are actually in parallel, making the equivalent of a single 23 ohm dump resistor.
Read diagram carefully to see which terminals are NC (Normally Closed) and which are NO (Normally Open).

Relay drivers shown in 1st photo (I hope).
M3 and M4 signals come in at left from BoB and are Active HI. They go through a lockout circuit consisting of three 2-input NAND gates (74HC00), and then they drive some opto-isolators AQV-102. These drive the coils for the power relays.
The lockout circuit works thus:
If neither M3 nor M4 is asserted, then neither AQV is activated. (eg you have done an M5).
If ONE of the two is asserted, then the appropriate AQV is activeated and the appropriate relay is switched ON.
If both M3 and M4 are asserted, then the Lockout signal goes LO and all outputs are then OFF.

On top of that, my M3 command starts by checking that the power supply is actually ON, then it kills (deasserts) the M4 output pin regardless of what state it was in before, waits one second (just in case) and only then asserts the M3 signal. M4 is analogous. M5 simply kills both output signals.

HTH
Cheers
Roger


Title: Re: M3 M4 switching
Post by: DICKEYBIRD on March 08, 2016, 02:00:56 PM
A nice solution to this issue is to look around on ebay & find a deal on a KBCC-125R drive.  They're old school (compared to servo drives, vfd's, brushless, yada-yada) and are very reliable, being a industrial product.  They come with built-in circuitry & relay to allow instant reversing & dynamic braking plus easily configurable for different HP motors, PM magnet or wound field types.  I have one on my lathe & really like it.  I didn't have the patience or knowledge to do a bullet-proof relays circuit like shown above & kept looking 'til I found one for $65 NIB!

The on-board reversing function is also available in other later KB drives (PWM & others) but I like the older SCR types 'cuz they're usually cheap but good.

Here's the manual: http://www.kbelectronics.com/manuals/kbcc_manual.pdf
Title: Re: M3 M4 switching
Post by: rcaffin on March 08, 2016, 05:27:26 PM
Those old-school drives are OK if the motor is rated for an SCR drive, but they can make the motor hot if the motor is not designed for them. You get a LOT of 100 Hz or 120 Hz ripple on the power, and some of this comes through.

On the other hand, the more modern MOSFET drives like the KBWT-26 leave the motor a whole lot cooler and quieter - but I have to admit they can radiate interference half-way to the moon. KB should have put a LARGE dual-winding L-filter on the output.

Both designs seem to have somewhat arcane interfaces, which may be fine for manual controls but are a pain for CNC interfacing. The KBWT unit analog input controls are at -100 VDC!

Cheers
Roger
Title: Re: M3 M4 switching
Post by: DICKEYBIRD on March 09, 2016, 10:38:15 AM
Both designs seem to have somewhat arcane interfaces, which may be fine for manual controls but are a pain for CNC interfacing. The KBWT unit analog input controls are at -100 VDC!
Hi Roger, I was going to defer to your superior electronics training & keep my mouth (keyboard) shut but I have to voice my opinion.  I know my electronics knowledge is sadly lacking but I do read about this stuff & have been able to make my hacked-together stuff work pretty well.  I just don’t want someone down the road to stumble onto this thread searching for spindle drive info, take your statement as gospel & go away misinformed.

I have never owned or used a KBWT-26 but just couldn’t believe that KB would make a drive has a “somewhat arcane interface” that is “a pain for CNC interfacing.”  I took the trouble of Googling the drive’s manual & found the following:

“Signal Input: The drive can be operated with a 5 kΩ Main Speed Potentiometer (supplied), an isolated 0 – 5 Volt DC analog signal, or an isolated Pulse Width Modulated (PWM) signal from a microprocessor.”  To me that doesn’t sound like a pain.  Granted, one does have to observe the “isolated” instruction without fail.  Don’t ask me how I know!  “Note: If an isolated signal is not available, an optional signal isolator must be installed (KBSI-240D or equivalent).”  I picked up 1 of these on ebay for $30 and solved my isolation problem. 

As to the old school KB SCR drive’s propensity to “make the motor hot if the motor is not designed for them” both the minilathe’s drive & the treadmill motor’s MC-68 drive are both SCR types so the motors will be fine as far as heating is concerned.

I hope I don’t come across as argumentative; just trying to be factual.   I was wrestling with the exact issues as the OP with my ORAC conversion a few years ago & the KBCC-125R was suggested to me and was an immediate revelation.  When necessary, the lathe can be spinning a 6” 4-jaw at full chat in one direction, receive an M5 command & the KB quickly & smoothly brakes the motor to a stop, receives M4 command, relay clicks, motor reverses & smoothly accelerates to the set speed, all in a couple seconds.  I had asked around and was struggling with relays & a big resistor trying to do it myself.  When I stumbled onto the KB, the problem was solved & I was able to get onto the next thing on the list.

Granted, you fellows with solid electronics knowledge can design the circuitry needed to do the same thing using the OP’s MC-68 but I was just trying to provide an easier alternative.:)


Title: Re: M3 M4 switching
Post by: rcaffin on March 09, 2016, 03:59:42 PM
Hi Dickybird

Sounds as though the KBCC is a good match for those motors. Useful information to spread around. And my experience has been that the KB drives have reasonable reliability too - maybe better than some Chinese VFDs. (However, one KB drive has failed on me.)

The arcane interface on the KBWT ... IS arcane imho. Yes, I know what the manual says, and I know what the front end circuitry actually looks like (because I managed to get part of the circuit diagram from KB). The problem is getting enough power out of the KB front end to power an optically-isolated interface **while keeping the response reasonably linear**. If you don't care about a somewhat non-linear behaviour it is much easier. OK, I was being fussy.

I must admit I had not searched on ebay for the KB SI interface. That might be easier, although my interface is reasonably simple NOW. It just took a bit of experiment on the bench - which was part of the fun after all.  :-)

Cheers
Roger
Title: Re: M3 M4 switching
Post by: DICKEYBIRD on March 10, 2016, 06:55:34 AM
Thanks Roger, as usual all that linear/non-linear stuff zings right over my noggin.

Fortunately I chose commercial equipment & got real lucky on the price.  The KBSI 240D has adjustment pots, the KBCC-125R has adjustment pots and the CNC4PC C-11 has an adjustment pot.  When I finished twiddling them, I have solid Mach spindle speed control in both directions within a couple 10's of rpm from 50 to 1700 rpm.  Way better than I need for 99% of my lathe work.

It does have a teeny cyclic variation that affects threading at times.  With that in mind I picked up an AMC BE25A20AC analog servo drive a while back but haven't  yet taken the time to install it.  Too busy making parts to undo all that hard-earned success and start over!
Title: Re: M3 M4 switching
Post by: rcaffin on March 10, 2016, 04:11:38 PM
> It does have a teeny cyclic variation that affects threading at times.
Could you somehow just add mass to the spindle drive? That can be really effective.

Cheers
Roger
Title: Re: M3 M4 switching
Post by: rhtuttle on March 10, 2016, 04:45:10 PM
Guys, still  traveling but wanted to say thanks for all of the great information. I'll be tackling this later next week. Probably have more questions then.

RT
Title: Re: M3 M4 switching
Post by: DICKEYBIRD on March 11, 2016, 10:32:31 AM
Could you somehow just add mass to the spindle drive? That can be really effective.
You would think so but it didn't.  It exhibits the same symptom with the same work held in a light ER32 chuck & in a heavy 4 jaw as well.

Besides, I just wanna play with a servo drive when I get time.  I had already mounted a Servo-Tek 7V/1000 rpm tach generator on the motor & wired it into the feedback circuit of the KB.  The variation problem got better but was still there.  That's when I hunted down the AMC servo drive.  The existing tach/gen will be wired into the new drive & it will be configured in the velocity mode.  An encoder might be better but since the tach is already there I'll try it 1st.

(Sorry for the hijack RT, we're just keeping your thread warm 'til you get back. :) )
Title: Re: M3 M4 switching
Post by: rcaffin on March 11, 2016, 03:54:49 PM
Hi DB

That cyclic variation - is there a feedback loop around the system? If it is not properly tuned it can sometimes cause some oscillation. The simplest solution in that case is to back off the P or gain term a whisker.

Cheers
Roger
Title: Re: M3 M4 switching
Post by: rhtuttle on March 12, 2016, 12:12:20 PM
Okay, back to the original subject  ;),

When I started shopping for the relays I got confused by the nomenclature.  My motor at 70% power says 7.5 amps, 95vdc.  The product descriptions like the one below have ratings like the 4th line.  Will this one work? (DC 28V)

Product Name   Electromagnetic Relay
Model   JQX-13F
Coil Voltage   DC 12V
Load   10A AC 240V/ DC 28V
Type   DPDT
Pin Number   8
Size (Approx.)   40 x 27 x 20mm / 1.6" x 1" x 0.8" (L * W * T)
Weight   33g
Package Content   1 x Electromagnetic Relay
Title: Re: M3 M4 switching
Post by: rcaffin on March 12, 2016, 03:42:39 PM
I use a bunch of JQX-13F relays myself, on my 180 VDC spindle motors. They seem very reliable. I use 24 VDC coils, but that only is because I have a fair amount of 24V power available. I also use the sockets sold with the relays. Mine came from eBay, 22newcentury.

Cheers
Roger

Title: Re: M3 M4 switching
Post by: DICKEYBIRD on March 13, 2016, 08:57:52 AM
Those relays are only rated for 28 vdc.  I read a thread on another forum (HSM) that warned about the difference in arcing of the contacts between switching DC vs. AC and the consequent shorter lifespan when using under-rated switches & relays.  I think it may be wise to chose relays that are rated correctly for the job?  I'm sure those will work fine now but if they see heavy usage, may cause a problem down the road & the contacts stick closed at the worst possible time.  Just a thought.

You guys with more electrical smarts & experience can tell me to shut up & go back to my hole if need be.:)
Title: Re: M3 M4 switching
Post by: rcaffin on March 13, 2016, 05:44:08 PM
No, that's not quite correct. They mfr give specs for 240 VAC and 28VDC because they are two common voltages, but the relay can be happily used for a wide range of voltages, AC and DC. (28 VDC: over-voltage on 2 x 12V batteries.)

Yes, there is a difference in how contacts work. These are silver oxide / cadmium oxide, and they are designed for heavy currents. There is ALWAYS arcing when contacts are opened, and that's why the contacts use those materials. It's a bit hard to 'burn' an oxide surface, after all. Other switches and relays use gold-plated sufaces instead: gold is good for LOW-level SIGNALS, but not for power applications.

One of the advantages of using plug-in relays (ones using a socket) is that if there is ever a problem, you can pull out the doubtful relay and replace it with a new one. That is a lot smarter than soldering onto the terminals of the relay.

'Shorter lifespan' - debatable. If the relay is rated at 28 VDC & 10 A, but you use it at 48 VDC and 1 A, will it have a longer or shorter life? If you have the spindle motor howling away at full load and you open the relay, there will be some arcing - although the relay is designed to handle that. On the other hand, if you kill the supply down to 2 VDC & 0.5 A before turning the motor off, how much arcing?

In this day and age of modern semiconductors, it turns out that power relay technology is pretty good. Even a wall switch works pretty well.

Cheers
Roger
Title: Re: M3 M4 switching
Post by: DICKEYBIRD on March 13, 2016, 08:30:53 PM
Okay, back to the original subject  ;)
Sorry RT, you're absolutely right!  When you get your relay setup working, please post up a diagram.  I'd like to have it around for possible future use.:)
Title: Re: M3 M4 switching
Post by: rcaffin on March 13, 2016, 11:14:40 PM
Hi DB

There's one circuit diagram at the bottom of the first page. It works very well for me.

Cheers
Roger