Hello Guest it is October 20, 2019, 05:40:15 AM

Author Topic: M3 M4 switching  (Read 4764 times)

0 Members and 1 Guest are viewing this topic.

M3 M4 switching
« 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

Offline Davek0974

*
  •  2,580 2,580
    • View Profile
    • DD Metal Products Ltd
Re: M3 M4 switching
« Reply #1 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;)
« Last Edit: March 05, 2016, 03:26:16 AM by Davek0974 »
Bridgeport Mill, Mach3 V062, CSMIO-IP/A controller, AC Servo Drives
Re: M3 M4 switching
« Reply #2 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.  :-\

Offline Hood

*
  •  25,856 25,856
  • Carnoustie, Scotland
    • View Profile
Re: M3 M4 switching
« Reply #3 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

Offline Davek0974

*
  •  2,580 2,580
    • View Profile
    • DD Metal Products Ltd
Re: M3 M4 switching
« Reply #4 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 ;)
Bridgeport Mill, Mach3 V062, CSMIO-IP/A controller, AC Servo Drives
Re: M3 M4 switching
« Reply #5 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.

Offline rcaffin

*
  •  1,003 1,003
    • View Profile
Re: M3 M4 switching
« Reply #6 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

« Last Edit: March 05, 2016, 07:10:24 PM by rcaffin »
Re: M3 M4 switching
« Reply #7 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?

Offline Davek0974

*
  •  2,580 2,580
    • View Profile
    • DD Metal Products Ltd
Re: M3 M4 switching
« Reply #8 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 ;)
Bridgeport Mill, Mach3 V062, CSMIO-IP/A controller, AC Servo Drives

Offline rcaffin

*
  •  1,003 1,003
    • View Profile
Re: M3 M4 switching
« Reply #9 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


« Last Edit: March 07, 2016, 08:49:32 PM by rcaffin »