01 Preparations
I. Material Preparation
1. Hardware
One A.ZMC432 controller with an EtherCAT bus interface.
B. One set of Panasonic EtherCAT servo drive and motor
C. One computer.
D. Two shielded network cables.
One E.24V DC power supply.
F. Several terminal blocks and connecting wires.
2. Software
A.ZDevelop V3.10 is a controller programming software.
Download the compressed package from the official website www.zmotion.com.cn, extract it, and run the application directly; no installation is required.
B. Panasonic servo drive host computer debugging software.
Download and install it from the Panasonic website.
II. Hardware Wiring
1. Controller wiring
See the diagram below for the purpose of the controller interface.
A. Main power supply: Connect the E+24V terminal on the controller's main power supply terminal to the positive terminal of the 24V DC power supply, and connect the EGND terminal to the negative terminal of the 24V DC power supply.
B. Ethernet Port Wiring: Connect the controller's Ethernet port to the computer's Ethernet port using a network cable.
C. Servo driver and controller wiring: Use a network cable to connect the controller's EtherCAT bus port to the servo driver's X2A or X2B port.
Note that the servo driver has two EtherCAT interfaces. Some drivers allow both ports to be connected arbitrarily, while others have EtherCAT IN and EtherCAT OUT. The IN port is connected to the upstream device, and the OUT port is connected to the downstream device. The two cannot be used interchangeably, and attention must be paid to the connection order.
In multi-axis control, the EtherCAT OUT port of the servo driver is then connected to the EtherCAT IN port of the next-level drive device, and so on.
2. Driver wiring
Refer to the driver manual for wiring instructions for the servo driver, motor, and encoder. Connect the driver to 220V AC power.
02 Connecting the controller to the computer
The controller can be connected to the computer via a serial port or a network port. The following explanation uses a network port connection as an example.
I. Network Port Communication Operation Method
First, connect the controller to the computer using a network cable, turn on the controller's power, then open the ZDevelop programming software, click "Controller" → "Connect" in the menu bar, and open the "Connect to Controller" window.
The "Connect to Controller" window allows you to quickly view your local IP address and compare whether the controller and your computer are on the same network segment.
When selecting from the IP address list dropdown, it will automatically find the available controller IP address on the current local area network (the controller's IP address can be found when the POWER and RUN lights are on after the controller is powered on).
When there are multiple controllers on the same network, if the IP drop-down list does not display the IP address of the target controller, you can perform an IP scan to view all available controller IP addresses. After the scan is complete, confirm and close this window, then select again from the IP drop-down list.
After selecting the correct IP address and clicking connect, the programming software and controller are successfully connected, and the online command and output window will print information prompts.
The controller's default IP address is 192.168.0.11. The "Connect to Controller" window displays the local IP address. Please ensure that the wired and wireless network cards are configured with their respective IP addresses. The computer's IP address must be on the same network segment as the controller's IP address for it to connect; that is, the first three segments of the four-segment IP address must be the same, and the last segment must be different for communication to occur.
If the controller and the computer are not on the same network segment, you need to change the IP address of either the controller or the computer to make them on the same network segment.
To change the controller's IP address, you first need to connect to the controller via serial port, obtain the controller's IP address, and then modify either the local IP address or the controller's IP address to ensure they are on the same network segment.
II. Modify the controller IP address
First, connect to the controller via serial port to obtain the controller's IP address, and then modify the controller's IP address.
Method 1: You can directly modify the controller's IP address through the menu bar "Controller" → "Modify IP Address" window.
Method 2: Modify via online command sent through the IP_ADDRESS instruction.
After the command is successfully sent and modified, the connection will be automatically disconnected. The online command will print the controller connection error information. Reconnect to the controller via the network port by selecting the new IP address 192.168.0.23. The IP address will be permanently valid after successful modification.
III. Change the local IP address
Taking Windows 10 as an example, open Control Panel from the Start menu, and then open "Network and Internet".
Then open "Network and Sharing Center".
Click "Ethernet".
In the "Ethernet Status" window, click "Properties" to open the "Ethernet Properties" window. Locate Internet Protocol Version 4 (TCP/IPv4) and open it. You will then see the local IP address modification window. Check "Use the following IP address" and modify the IP address in the IP address input field. Change the local IP address to be on the same network segment as the controller IP address. After modification, click "OK" to successfully modify the IP address.
Reopen the "Connect to Controller" window and try connecting to the controller.
03 Differences between DPOS and MPOS
DPOS is the user-defined target position, i.e., the position of the command issued by the controller. The unit is UNITS. The value is equal to the number of pulses actually sent by the controller, divided by the pulse equivalent.
Writing to DPOS will automatically convert to DEFPOS absolute coordinate position offset, without moving the motor.
MPOS stands for User-Measured Axis Position, also known as Actual Position, and is measured in units (UNITS). This value is the actual position of the axis measured by an encoder connected to the servo motor to measure the motor's rotation angle and speed. Normally, the MPOS value follows the DPOS value. The MPOS value is equal to the actual number of pulses measured by the encoder, divided by the pulse equivalent. In the absence of an encoder, the axis's MPOS value is automatically copied from the DPOS value.
Writing to MPOS will automatically convert to DEFPOS absolute coordinate position offset.
Some motors have a certain following error (DPOS-MPOS), which is related to the mechanical and motor rigidity itself. The better the mechanical and motor, and the more rigid the motor is, the smaller the following error will be. However, the following error will always exist and cannot be eliminated. Moreover, it changes in real time. In practical applications, we should try to improve the mechanical and motor rigidity to minimize the following error and make the speed as smooth as possible, so that the MPOS is more accurate.
Additionally, SPEED is the speed given by the controller, and MSPEED is the actual measured feedback speed of the encoder.
As shown in the figure below, the axis type is ATYPE=65, EtherCAT periodic position mode, with encoder feedback. Therefore, both the pulse signal output and the encoder feedback signal are on axis 0. At this time, MPOS is true and follows DPOS.
When ATYPE=4, 65, or 50 mode is used, encoder feedback is included on the axis number.
The OFFPOS instruction modifies all coordinates with relative offset and does not affect movements that have already run or entered the buffer.
The DEFPOS instruction sets the current axis position to a new absolute position value and does not affect motions that have already run or entered the buffer.
Example:
BASE(0,1) 'Selects axis 0 and axis 1
DPOS=100,100 'Sets the current position to 100,100'
?DPOS(0),DPOS(1) 'Print confirmation, current position is 100,100
OFFPOS=10,20 'Multiple calls to the relative position of OFFPOS
OFFPOS=10,20
?DPOS(0),DPOS(1) 'At this point, the current position becomes 120,140
DEFPOS(10,20) 'Sets the current position to 10,20
?DPOS(0),DPOS(1) 'Current position is 10,20
04 EtherCAT Servo Driver
Parameter settings
I. Application of Electronic Gear Ratio
The electronic gear ratio of a servo motor refers to the amplification or reduction of the frequency of pulses received from the controller. One parameter is the numerator, and the other is the denominator. A ratio greater than 1 indicates amplification, a ratio less than 1 indicates reduction, and a ratio equal to 1 indicates that the number of pulses received by the motor equals the number of pulses sent by the controller.
Calculation formula: Actual number of pulses received by the motor = Number of pulses sent by the controller * Electronic gear ratio
For example: if the controller sends 10,000 pulses, the numerator of the electronic gear ratio is set to 1, the denominator is set to 2, and the electronic gear ratio is 0.5, then the servo will actually run based on 5,000 pulses. If the controller sends 10,000 pulses, the numerator of the electronic gear ratio is set to 2, the denominator is set to 1, and the electronic gear ratio is 2, then the servo will actually run based on 20,000 pulses.
The ratio of Panasonic drive electronic gears is effective in the range of 1000-1/1000.
The electronic gear ratio is set using the ratio values of sub-dictionaries 01h and 02h within data dictionary 6091h. 6091h-01h sets the numerator of the electronic gear ratio, and 6091h-02h sets the denominator.
The sub-dictionary 01h of data dictionary 6092h is used to set the number of pulses required for the motor to rotate one revolution. It is generally set according to the encoder resolution. The default value of sub-dictionary 02h of 6092h is 1.
The relevant parameters of the electronic gear ratio and other drives can be modified directly through the drive software, or configured by reading and writing the corresponding data dictionary using the SDO command.
1. Modify the electronic gear ratio in the driver software.
To modify drive parameters, first connect the drive. You can choose to connect the drive via USB cable or WLAN. Use a USB cable to connect the computer to the X1 port on the drive. Power on the drive and open the Panasonic drive software PANATERM. A "Select Communication with Drive" window will pop up. Select to connect to the drive via USB. The drive information will be automatically obtained and displayed in the window. Click OK to connect successfully and you can then configure the drive.
Click "Display" → "Object Editor" in the menu bar to open the following window. Locate the data dictionary you need to set and directly modify the data dictionary content in the "Setting Value" column.
Once the modifications are complete, the parameters are transmitted to the driver and written to the driver's EEPROM. The parameters take effect after the driver is powered on again.
In the diagram, the electronic gear ratio is 1:1, and the number of pulses per revolution of the motor is 10,000.
2. SDO command modifies electronic gear ratio
SDO instructions include SDO_READ and SDO_READ_AXIS for reading the data dictionary and SDO_WRITE and SDO_WRITE_AXIS for writing the data dictionary.
Data dictionary reading syntax:
SDO_READ (slot number, device number, data dictionary number, data dictionary sub-number, data type, location of the data to be read in the TABLE)
SDO_READ_AXIS (axis_number, data_dictionary_number, data_dictionary_sub_number, data_type, table_location_to_read_data_store)
Data dictionary writing syntax:
SDO_WRITE (slot number, device number, data dictionary number, data dictionary sub-number, data type, write data value)
SDO_WRITE_AXIS (axis number, data dictionary number, data dictionary sub-number, data type, write data value)
Example:
SDO_WRITE(Bus_Slot,iNode,$6091,1,7,1) 'Sets the electronic gear ratio numerator to 1
SDO_WRITE(Bus_Slot,iNode,$6091,2,7,1) 'Set the denominator of the electronic gear ratio to 1
SDO_WRITE(Bus_Slot,iNode,$6092,1,7,10000) 'Sets the number of pulses per motor revolution to 10000
SDO_WRITE(Bus_Slot,iNode,$1010,1,7,$65766173) 'Write to EPPROM (the driver needs to be powered on again after writing to EPPROM)
After making the changes using the commands, check the driver parameters as follows:
II. Reading multi-turn encoder values
When the driver is a multi-turn absolute encoder, the ENCORDE instruction can be used to read the raw value of the encoder hardware register, which is the multi-turn absolute value. This parameter is read-only. It can only be read when the encoder's ATYPE is configured to be used.
The ENCORDE value will be cleared to zero after the drive restarts.
?*ENCODER 'Prints encoder values for each axis; the driver's initial value upon power-up is 0.'
?ENCODER(0) 'Print single-axis encoder values
?ENCODER AXIS(0) 'Print single-axis encoder values
As shown in the figure below, using an EtherCAT driver with encoder feedback, the control axis 0 continuously moves forward MOVE(500). At this time, the total number of pulses sent = UNITS*DPOS=100*500=50000.
The ENCORDE instruction reads the value of the multi-turn absolute encoder of the driver, which is equal to the total number of received pulses detected by the encoder, 50000.
Changing DPOS and MPOS at this time will not change the value of ENCORDE because the motor will not move in this coordinate system, and the number of pulses received by the encoder will not change.
Because the reading is the absolute value of multiple rotations, the ENCORDE value decreases in the negative direction and increases in the positive direction.
Panasonic's driver software allows for settings on absolute encoders.
Set via parameter Pr0.15.
Pr0.15 Parameter Selection Instructions: The three settings are explained below. The example above uses the default value of 1, which is used as an incremental encoder.
III. Driver I/O Operations
Reading from the driver's IN input and output from the OP.
The DRIVE_IO instruction maps the starting IO numbers of the 60FDh driver IO input and the 60FEh driver IO output in the driver object dictionary.
After mapping the I/O signals, the driver can control the I/O signals according to their numbers. The I/O signal output can be controlled by OP instructions.
A value of 1 indicates ON, and 0 indicates OFF.
Driver I/O mapping example: mapping positive and negative limit signals
Inputs can only be mapped correctly after setting the correct DRIVE_PROFILEE or PDO. That is to say, the DRIVE_PROFILE drive PDO configuration mode includes two data dictionaries, 60FDh and 60FEh.
DRIVE_PROFILE(iAxis) = 5 'Sets the corresponding PDO mode with I/O mapping.
DRIVE_IO(iAxis) = i_IoNum 'Set the starting I/O number
REV_IN(iAxis) = i_IoNum 'Negative limit should be 60FD BIT0
FWD_IN(iAxis) = i_IoNum + 1 'Positive limit bit first corresponds to 60FD BIT1
DATUM_IN(iAxis) = i_IoNum + 2 'The origin signal corresponds to 60FD BIT2
INVERT_IN(i_IoNum,ON) 'Special signal valid level inversion'
INVERT_IN(i_IoNum + 1,ON)
INVERT_IN(i_IoNum + 2,ON)
Driver I/O output:
DRIVE_PROFILE(iAxis) = 5 'Sets the corresponding PDO mode with I/O mapping.
DRIVE_IO(iAxis) = i_IoNum 'Set the starting I/O number
OP(i_IoNum, ON) 'Open the first OUT port of the driver
In the driver's "Parameters" window, you can find Parameter Category 4, which controls the driver's I/O signals, as shown in the figure below.
IV. Drive return to zero
The EtherCAT bus can use the homing mode DATUM(mode) provided by the controller. The mode value can be found in the DATUM command section of the ZBasic programming manual. The EtherCAT bus can also use the driver's own homing mode.
The driver itself returns to zero using the DATUM(21,mode2) instruction. The mode2 value can be found in the driver manual data dictionary 6098h zero-return mode, as shown in the figure below. Enter the corresponding Value in mode2. The default value of mode2 is 0, which is also the driver's zero-return mode. Note that at this time, the origin limit and other signals must be connected to the driver. Therefore, when using the driver's zero-return mode, the driver's I/O needs to be mapped.
Example:
After initialization is complete, run the driver homing procedure. Following the example in the previous section, map the driver's limit signal and origin signal to the controller's I/O, and then run the following homing procedure.
BASE(iAxis) 'Return to zero one axis at a time according to the drive axis number'
AXIS_STOPREASON = 0
SPEED = 100 'Zeroing speed'
CREEP = 10' Reverse search speed
ACCEL = 1000
DATUM(21,2) 'Driver return-to-zero mode value=2
WAIT IDLE
IF AXIS_STOPREASON = 0 THEN
"Reset to zero successful"
ELSE
"Failed to return to zero", "Stop reason:", AXIS_STOPREASON, "Status word 0X", HEX(DRIVE_STATUS)
ENDIF
V. Real-time Torque Reading
When PDO contains data dictionary 6071h (target torque), ATYPE can be set to 67, in periodic torque mode. In this mode, DAC instructions are used to control the motor to run at the set torque value. The DAC value ranges from 0 to 1000, corresponding to 0 to 100% of the DAC value. For example, if DAC=10, the motor torque is 1% of the torque value.
When controlling torque, the DAC unit is one-thousandth. When it equals 1000, it represents 100% torque. At this time, the value is equal to the value of data dictionary 6072h (set maximum torque).
When switching between speed mode and torque mode, be sure to set DAC to 0 before modifying ATYPE to prevent accidents.
The SDO reads the value of data dictionary 6071h as the target torque magnitude, which is the magnitude of the currently transmitted DAC command. When no DAC command is transmitted, the value of 6071h is 0. Generally, the current torque value of 6071h ranges from the set value of 0 to 6072h.
For example: ATYPE=67 torque mode
DAC=40
SDO_READ(0,0,$6071,0,3,0) reads the target torque of axis 0, and the value of TABLE(0) becomes 40.
The drive torque can be read using the DRIVE_TORQUE instruction if the DRIVE_PROFILE configuration includes data dictionary 6077h, or by directly reading the value of data dictionary 6077h using the SDO_READ instruction. There may be fluctuations between the current torque value and the target torque value; what is read is the real-time value.
Example:
?DRIVE_TORQUE(0) 'Torque of printing axis 0'
Data dictionary 6077h is used to read the current torque value. Example:
SDO_READ(Bus_Slot,iNode,$6077,0,3,0) 'Reads the current torque and saves it to TABLE(0)
VI. Application of Torque Limiting
Torque control is used in printing presses, winding machines, injection molding machines, and other applications. When using the EtherCAT bus, the torque output by the motor is proportional to the value of the DAC command input.
To protect the machine, the output torque can be limited. The maximum torque of the motor is set to 6072h, with a factory default value of 10.
During torque control, the motor torque output is controlled by DAC commands, but the motor speed is not controlled. Therefore, overspeed may occur under light load. In order to protect the machinery, the speed must be limited.
The data dictionary 6072h is used to set the maximum torque of the motor. A value of 1000 for 6072h represents 100% of the rated torque; a value of 500 represents 50% of the rated torque. This is supported in several different EtherCAT modes. For example, in position mode, the maximum allowable torque can be set, and motion commands such as MOVE can be used to control the motor. In this mode, the motor speed follows the SPEED parameter. If the target position is set too high, the speed will be limited when encountering obstacles, and only the set maximum torque will be applied.
Example of reading SDO instructions:
SDO_READ(0,0,$6072,0,3,0) 'Reads data and saves it to TABLE(0), with a value of 5000.
VII. Motor Polarity Setting
The motor polarity (rotation direction) is set through the data dictionary 607Eh, which has 8 bit values that can be set. As shown in the figure below, when the polarity is not reversed, bits 7-5 of 607Eh are all set to 0; when the polarity is reversed, bits 7-4 of 607Eh are all set to 1; and the remaining bits 4-0 are all set to 0.
Setting method: When the value of 607Eh is set to 224, the sign is reversed. When a positive direction command is given, the motor rotation direction is CW (clockwise); when the value of 607Eh is set to 0, the sign is not reversed. When a positive direction command is given, the motor rotation direction is CCW (counterclockwise). See the figure below for the motor rotation direction specification.
Setup example:
Operate the data dictionary 607Eh using the driver software or SDO instructions.
SDO_READ(Bus_Slot,iNode,$607E,0,5,0) 'Reads the polarity and saves it to TABLE(0)
SDO_WRITE(Bus_Slot,iNode,$607E,0,5,$E0) 'Polarity setting
Driver software settings: You can view or modify the settings. When the value is 224, the positive motion parameters are given, and the motor rotates clockwise.
8. Other driver parameter settings
The driver's factory settings generally do not invert the IO level, which will cause the driver limit alarm. After the limit alarm occurs, the limit level must be inverted according to the driver manual. For example, for Panasonic servos, the parameters of Pr4.01 and Pr4.02 should be set to 010101h (65793) and 020202h (131586) respectively.
IO input factory default values (shown in decimal below):
The values of Pr4.01 and Pr4.02 can be modified directly in the driver software, or the positive and negative limit levels can be set by setting the data dictionary 3401h and 3402h through the SDO_write command.
Example of setting positive and negative limits using the SDO command:
SDO_WRITE(Bus_Slot,iNode,$3401,0,4,$10101)' Positive limit level, factory default value $818181
SDO_WRITE(Bus_Slot,iNode,$3402,0,4,$20202)' Negative limit level, factory default value $828282
The modified values can be viewed in the data dictionary or by checking the parameter categories.
Other parameters can be modified directly in the "Object Editor" window or the "Parameters" window. After modification, save to EEPROM and the changes will take effect after the driver is powered on again.
This concludes "Advanced Applications of EtherCAT Bus Motion Controllers, Part 1". For more learning videos and detailed explanations with pictures, please follow our WeChat official account "Zheng Motion Assistant".
This article is original content from Zheng Motion Technology. We welcome everyone to reprint it for mutual learning and to jointly improve China's intelligent manufacturing level. Copyright belongs to Zheng Motion Technology. Please indicate the source if you reprint this article.