Electronics

Contactor 

Yaskawa manual to servo drive shows a basic wiring examples. The diagrams shows a contactor connected on servo drives power mains. After some research I found that this is a protective safety member controlled by external switches, such as limit switches or E-stop button. A similar diagram is also found in the manual for MB2. 

So the idea is to turn off the contactor when a safety hazard occurs. MB2 has a nice feature to collect signals from more sources and when one of these signals goes down (signals X203 - X210) then it de-energizes OSSD input connected to contactor. Sounds simple. The only thing I found is that the 24V DC contactors take usually about 3 to 5 Watts on a relay, i.e. current larger than 100 mAmps which is the maximum allowed to go through the transistors installed on MB2. 

I decided to buy Siemens Sirius 3kW/400V, DV24, type 3RT2015-1BB41. Relay losses are 4 W, which means 4/24 = 166 mAmps. My benchtop DC power supply showed 177 mAmps. Therefore I'm going to switch the relay with an external PNP transistor rated for higher currents (I use PN2907A).

I will assume a current of 5 mAmps through the OSSD transistor. For pull-up PNP it means resistor of R = 1.3Vsat/5mAmps = 260 ohms (I use 300 ohms). To limit the current through OSSD to 5 mAmps I need to add a collector resistor. I measured the voltage drop over the MB2 transistor and it is 0.65V. So the collector resistor should be (24V - 1.3V - 0.65V)/5mAmps = 4.4 kOhm (I use 4.7 kOhm). Power = 4700 x 0.005^2 = 0.12 Watts < 0.5Watt so OK. Putted on breadboard, everything works fine. 

Finally the magnetic contactor cut the mains when:

  1. E-Stop is pressed
  2. Limit switch is hit
  3. Servopack alarm occurs (ALM)

Cool ! 

Spark Killer

Knowing the switching relay inside the magnetic contractor generates high voltage peaks which can damage relay contacts and attaching electronics I bought the Siemens Surge Suppressor plug-in option 3RT2916-1CB00. The surge suppressor (also called spark killer) consists of resistor and capacitor attenuating the peak voltages. It is must and I bought it for about 7 EUR.

E-Stop

I bought E-Stop switch again on eBay for about 10 EUR. Connected to MB2, one wire to NPN X203 input pin, the other to 0V. See figure 11 on page 14 in MB2 manual.

Limit Switches

After some research on internet I go with simple lever micro switches for a few euros. The reason was that I couldn't find non expansive inductive NPN normally closed (NC) switches in small housing. I can bent lever of micro switch to allow little bit more overtravel so that's fine.

Limit switches will be connected in series to MB2 NPN input pin X204. They are normally closed. If overtravel occur, the singal goes low and OSSD is de-energized.

Servopack Alarm

The photocoupler output (pins 31 ALM+ and 32 ALM-) handles maximum of 50 mAmp (see chapter 3.2.4). These pins can be directly connected to MB2 NPN inputs similarly like E-Stop. I use

  • X205 for X-axis (for MACH4 the signal is mapped to Input 7 --> mc.ISIG_INPUT7, see MB2 manual)
  • X206 for Y-axis (for MACH4 the signal is mapped to Input 8 --> mc.ISIG_INPUT8, see MB2 manual)
  • X207 for Z-axis (for MACH4 the signal is mapped to Input 9 --> mc.ISIG_INPUT9, see MB2 manual)

Inductive prox

For homing I'm going to use inductive NPN-NO sensor Omron TL-W5MC1 (bought on eBay for a suspiciously low price - I guess it is not genuine). I was thinking also about a hall sensor (which I have planty at home) but stick with the inductive one because it is already in a nice low-profile plastic watertight housing and I don't need to deal with magnets. 

From TL-W5MC1 datasheet:

  • consumption max 10 mAmps
  • response frequency 500 Hz
  • brown wire +24V
  • blue wire 0V
  • black wire is output
  • the sensing distance is about 5 mm for mild steel object of diameter 20 mm and thickness of 1 mm (check the datasheet for the curves)

I measured consumption of 6 mAmps and voltage across NPN (black to blue wire) about 0.7 V when in metal proximity (otherwise +24V obviously). The connection to MB2 is easy, just connect brown to +24V, blue to 0 V, and black wire to one of NPN inputs (X110-X115). I decided to go with X110 (x-axis), X111 (y-axis), and X112 (z-axis).


SERVOPACK

I bought an original I/O cable (JZSP-CSI01-x-E, see page 227, doc. YEA-KAEPS80000042K) for xx dolars. The each cable has 50 wires and I need just 12. Terrible, I should more think before buying it. I decided to make my own cable. I stripped LAN data cable which has 4x twisted pair and assembled them to get 6x twisted pair. Put everything into aluminum foil and cover with the metal net which left from the stripped LAN cable. Finally, the whole stuff is slipped into a rubber hose. The wires are soldered on D-SUB 15 male connector.


The pins are connected as follows:

Pin 1 = 31 +24V
Pin 2 = (7) PULS
Pin 3 = (8) /PULS
Pin 4 = (11) SGN
Pin 5 = (12) /SGN
Pin 6 = (15) CLR
Pin 7 = (14) /CLR
Pin 8 = (40) S-ON
Pin 9 = (31) ALM+
Pin 10 = (32) ALM-
Pin 11 = (44) ALM-RST
Pin 15 = (1) GSDouble checked.

Everything is fine !

This is what they are

Note: The signal names with a forward slash (/) are for reverse signal (i.e. ones that are valid when pulled low - contact closed). See also chapter 3.4.2.

  • /S-ON (pin 40) - turns servo ON/OFF --> Power ON
    • always input the servo ON signal before inputting the position reference to start or stop the servomotor (otherwise degrade of internal parts).
    • when an alarm is reset after an alarm occurs, the servomotor may operate unexpectedly if an alarm is reset while a reference is being input
    • /S-ON is turned off or Alarm Occurrence - ??????
    • check chapter 3.4.2 (1) photocoupler input circuit example (open-collector transistor circuit) - notice the diode on the input
    • connected to MB2 Y305 for X-axis and Y306 for Y-axis.
  • SG - signal ground
  • +24VIN (pin 47) - control power supply for sequence signals
    • see chapter 3.4.2
  • ALM+ (pin 31), ALM- (pin 32) - servo alarm output signal
    • configure an external circuit so that this alarm output turns OFF the main circuit power supply whenever an error occurs
    • ALM is normally closed
    • check chapter 3.4.3 (2) photocoupler output circuit example and figure in chapter 3.2.4 (output current max 50 mAmp)
  • /ALM-RST (pin 44) - alarm reset,
    • input pin for a release of the servo's alarm state (Reset when pulled low)
    • be sure to eliminate the cause of the alarm before resetting it!
    • connected to MB2 Y307 for X-axis, Y308 for Y- axis, and Y309 for Z-axis
  • PULS (pin 7), /PULS(pin 8), SIGN (pin 11), /SIGN (pin 12) - input pulse mode
    • check chapters 3.4.1(2) and 5.4.1(3) for line driver connection example
  • CLR (pin 15), /CLR- (pin 14) - clear signal setting
    • set when the position error should be set to zero (see chapter 5.4.2)
    • for open-collector output use a resistor 2.2kOhm before CLR to limit current  between 7 mA and 15 mA !!!
    • CLR connected to +24V with the 2.2 kOhm resistor
    • /CLR connected to MB2 Y3xx for X-axis and Y3xx for Y-axis



LUA Notes:

PLC script - this runs at a periodic interval (default is 50ms). You could place the code there, but you would have to check for a change in state of the input signal. Do-able but more work and not as efficient as the following methods as this code would run even if input signal hasn't changed states. And there would be a variable delay (from 0ms to the "PLC Interval" defined in the top level of the screen set) in responding to the input signal. In your case that would not be an issue as all you are doing is enabling Mach4.

Signal script - this script, in the wx4 screen set, is just the dispatcher for Mach4 signal events. Every event in Mach4 runs this script, which simply checks to see if there is a script associated with that event (in the "signal library", which is just an array of functions indexed by event number) and if so, it runs the script. Again, you could place the code here, but that doesn't fit with the overall design of the event flow in the wx4 screen set.

Screen Load Script - This is where the "signal library" is defined, and where the screen set places code for its event handlers. The screen load script is run once at start up. Part of what is does is initialize the SigLib[] array with code to handle the various events. SigLib[] is then used by the signal script to process events. This code is only run when its associated event is triggered.

ADDING SERVO EVENTS

1) Operator -> Edit Screen
In Screen Tree Manager select wx4 and in properties window click on the button with events. Open the event Signal Script and add the following:

if SigLib[sig] ~= nil then
    SigLib[sig](state);
end

SERVO ERROR EVENTS

1) In Screen Tree Manager select again wx4 and in properties window click on the button with events. Open the event Open Screen Load .

2) Find SigLib dictionary and add these function three states:

-- Servo Alarm X-axis: Check to see if fault signal is on
[mc.ISIG_INPUT7] = function (state)
    if (state == 1) then
        ServoError("X-Axis")
    end
end,

[mc.ISIG_INPUT8] = function (state)
    if (state == 1) then
        ServoError("Y-Axis")
    end
end,

[mc.ISIG_INPUT9] = function (state)
    if (state == 1) then
        ServoError("Z-Axis")
    end
end,

3) After definition of events in the SingalLib dictionary add the following functions (at the end of the script). Add the ServoError function:

---------------------------------------------------------------
-- Stop Machine if triggered the Servo Alarm
---------------------------------------------------------------
function ServoError(str)
    local hsig;
    local isEnabled;
    hsig = mc.mcSignalGetHandle(inst, mc.OSIG_MACHINE_ENABLED);
    isEnabled = mc.mcSignalGetState(hsig);

    if ( isEnabled == 1 ) then
        text = "Triggered Servo Alarm Fault for " .. str;
        mc.mcCntlEnable(inst, 0 );
       mc.mcCntlSetLastError( inst, text );
    else
    -- Mach4 is already disabled
    mc.mcCntlSetLastError( inst, "Ignoring Servo Alarm Fault." );
    end
end