On modern high-speed and high-precision manufacturing lines, line scanning cameras have become an ideal choice for detecting long materials, cylindrical surfaces, or large workpieces on conveyor belts due to their ability to image objects line by line during continuous motion. The Keyence XG-8000 series machine vision system, with its multi-core DSP, line scan camera (XG-HL08M) supporting up to 8192 pixels, and flexible I/O and communication expansion capabilities, provides engineers with a complete solution from hardware installation to image correction. This article will delve into the key steps of system integration, common causes of image distortion, trigger synchronization settings, light source control, and troubleshooting methods for the XG-8000 series (including the XG-8702L/8502L controller and XG-HL series line scan camera), helping on-site engineers quickly build a stable and reliable visual inspection system.
System composition and hardware installation points
1.1 Standard kits and selection confirmation
The XG-8000 controller (taking XG-8702L as an example) that leaves the factory includes:
Host unit x 1
SD card (CA-SD1G 1GB or OP-87133 512MB, must be inserted into SD1 slot to boot)
RS-422 ferrite magnetic ring (ZCAT2035-0930A)
Terminal label group
The optional line scan camera is available in three resolutions:
XG-HL02M: 2048 pixels, pixel size 7 × 7 μ m, minimum row scanning period 24 μ s
XG-HL04M: 4096 pixels, pixel size 3.5 × 3.5 μ m, minimum row scanning period 24 μ s
XG-HL08M: 8192 pixels, pixel size 3.5 × 3.5 μ m, minimum line scanning period 45 μ s (requires M40 interface lens)
1.2 Installation taboos for controllers and cameras
Heat dissipation requirements: Leave a ventilation gap of at least 50mm above and below the controller, and 50mm on both sides. If multiple units are installed side by side, the spacing should not be less than 50mm. The front panel needs to leave 90mm for cable insertion and removal.
Installation direction: It can only be installed in the "upward" direction as shown in the bottom diagram, and cannot be inverted or placed on the side.
Insulation treatment: The camera casing is isolated from the equipment through a plastic mounting bracket. The accompanying plastic mounting plate and screws must be used, otherwise the camera circuit may be damaged due to live or noise interference from the mounting base.
Lens installation: Do not touch the internal photosensitive surface of the camera before installation; Tightening torque ≤ 0.5 N · m to avoid lens loosening caused by vibration (thread locking adhesive can be used).
1.3 Connection sequence of expansion units
Camera Expansion Unit XG-E800: Connected to Expansion Unit Connector 1 on the right side of the controller, used to connect a second camera (up to two, requiring XG-EC80L).
CC Link Unit CA NCL10E: Connected to the left Expansion Unit Connector 2. If you need to use the CA-DC21E lighting expansion unit simultaneously, you must first install the CC Link unit tightly against the controller, and then install the lighting unit on the left side of the CC Link unit. It is prohibited to install CC Link units on the outside of lighting units.
Lighting Expansion Unit CA-DC21E: Up to 4 units can be connected in series, controlling up to 8 LED light sources. When connecting, it is necessary to install the accompanying gasket first.
All expansion units must be loaded and unloaded while the controller is powered off, otherwise the interface may be burned.
Anti interference measures for power supply, grounding, and cables
2.1 Power terminal wiring
The power supply terminals of the controller are A1 (+24V), A2 (0V), and FG (protective ground). AWG14~22 wire must be used, with a terminal screw torque of 0.8 N · m. Power requirements:
Rated 24 V DC, allowable fluctuation -15%~+10% (i.e. 20.4~26.4 V)
Recommend using switch mode power supplies with double insulation or reinforced insulation (such as CA-U3)
The A2 terminal must be grounded (Class D grounding, grounding resistance ≤ 100 Ω), otherwise it may cause program abnormalities due to electromagnetic interference.
2.2 Encoder connection (RS-422 with open collector)
XG-8000 supports connecting rotary encoders through IN2 terminal blocks to achieve image line acquisition and object motion synchronization.
RS-422 line drive output: Connect the A+, B - and other signals of the encoder to the corresponding terminal of IN2. The accompanying ferrite magnetic ring must be fitted within 300mm of the controller side cable. The 5V OUT terminal can supply power to the encoder, but the current is ≤ 150 mA; if it exceeds the limit, an external 5V power supply is required. The shielding layer is connected to FG.
Open collector output (24V DC type): can be directly connected to the universal input terminal of IN1 or parallel I/O (24V level). Note that 5V open collector encoders are not supported.
After connection, the encoder needs to be enabled in the system configuration:
System configuration → Communication&I/O → Terminal blocks¶llel ports → Input allocation → Encoder settings, select "Encoder 1" and match the output type (Open Collector or RS-422). After activation, some universal input terminals (such as F_IN1~3) will be occupied.
2.3 Light source connection and voltage selection
The CA-DC21E lighting expansion unit provides two LED output ports (LIGHT 1, LIGHT 2). Maximum load of output terminal: 24 V DC or 12 V DC, selected through the DIP switch (8-bit) on the right side of the unit:
Position 1-4 controls LIGHT 1 (all OFF=12V, all ON=24V)
Position 5-8 controls LIGHT 2 (all OFF=12V, all ON=24V)
Danger warning: If a 12V light is connected to a 24V output, it will immediately burn out and may cause a fire. The default voltage at the factory is 12V. Before making any changes, be sure to check the lamp nameplate.
The IN terminal block provides a forced light off input (LOFF), and when the terminal is ON, all LED outputs are turned off, which can be used for safety interlocking.

Image acquisition mode and parameter calculation
The line scan camera has two core acquisition modes: "Fixed" and "Continuous".
3.1 Fixed frame mode (suitable for shooting a rectangular image with a single trigger)
Used for detecting workpieces with limited length, collect one frame (consisting of N rows) per trigger.
Key parameters:
Shutter Speed: Exposure time per line (μ s). It must be at least 3 μ s smaller than the Line Trigger Cycle.
Number of Lines: Frame height (number of lines). Calculation formula:
Rows=vertical field of view (mm)/horizontal pixel resolution (mm/pixel)
For example, with a 2048 pixel camera and a horizontal field of view of 150 mm, the resolution is 0.073 mm/pixel. To shoot a 100mm long workpiece, 100/0.073 ≈ 1370 lines are required.
Line Trigger Cycle: The time interval (μ s/line) between two adjacent lines of data collection, determined by the speed of object movement
Cycle (μ s)=(vertical movement time (μ s))/number of rows
Movement time=Vertical field of view length (mm)/Movement speed (mm/s).
For example, if the speed is 200 mm/s, the vertical length is 100 mm, and the movement time is 0.5 s=500000 μ s, then the period is approximately 500000/1370 ≈ 365 μ s/line.
Trigger method:
Timed trigger: Select "Method"="Time" in Capture Options and trigger internally according to the set cycle.
Encoder trigger: Select "Encoder" and trigger each line of acquisition through external pulses. The unit of Line trigger cycle needs to be set in "Parameters" as the number of pulses per line. For example, if the total number of pulses for the workpiece is 4110 and 1370 rows are required, then set 3 pulses per row.
3.2 Continuous mode (suitable for infinite length material detection)
The camera continues to capture, and the image buffer adopts a "overlay" mode. Additional Overlapping Lines need to be set to create overlapping areas between adjacent frames to avoid frame loss.
Note: The continuous mode forces the number of image buffers to be set to 3, and the operation type is' overwrite '. If the original settings do not match, the system will automatically make changes.
3.3 Correction of vertical stretching/compression of images
If the displayed image is stretched or flattened in the vertical direction, it indicates that the Line Trigger Cycle does not match the actual motion speed:
The image is stretched downwards → the triggering period of the row is too large → the period value should be reduced.
Image compression upwards → line trigger cycle too small → cycle value should be increased.
When adjusting, you can simultaneously observe the Brightness and Sharpness LED indicators on the back of the camera. Default threshold: Brightness LEDs 1/2/3 correspond to maximum grayscale values of 64/128/192 respectively; The sharpness LED corresponds to a maximum differential value of 10/20/30.
Lens selection and working distance determination
The XG-HL02M/04M uses a C-mount lens (such as the CA-LHW series), while the XG-HL08M uses an M40 P0.75 special interface lens (such as the CA-LHL series).
Check FOV chart: Taking CA-LHW16 (16mm lens) as an example, if a horizontal field of view of 200mm is required, the chart should display a working distance (WD) of 200mm and a 0.5mm extension ring should be added.
Note:
Ordinary C-mount lenses (non CA-LHW) may not be able to cover the wide image plane of line scan cameras, resulting in dark corners at the edges.
When using macro lenses (CA-LM0210, CA-LML0210), the lens must be directly fixed to the device using a dedicated mounting bracket (OP-87337), otherwise the weight of the lens may damage the camera interface.
Lighting Technology and Shadow Correction
5.1 Selection of Lighting Modes
Mirror reflection: used to detect dents, scratches (scattered light, defects in dark areas) on flat surfaces.
Diffuse reflection: used to detect protrusions and burrs (light directly reflects back to the camera, bright areas display defects).
Transmitting illumination: used for foreign object detection on transparent/semi transparent films, where foreign objects obstruct light and present dark spots.
5.2 Shading Correction
When the brightness within the field of view is uneven (such as dark edges and bright centers), shadow correction must be performed.
Operation steps:
Open the Linescan Calibration tool in Flow Editor.
Click Shading Correction to display the intensity curves before and after correction.
Set Correction Region: X center, width, and average number of lines in the Y direction (it is recommended to take the average of multiple lines).
Set Smooth Range: A narrower range is suitable for local brightness changes, while a wider range is suitable for overall gradients.
Click Execute, and the calibration values will be automatically written into the camera's internal system.
The correction values can be saved to the SD card (default path SD2: xg linecam ) and restored through Load Correction Values.
Note: The maximum correction magnification is 5 times. If adjustments are still needed after calibration, please perform calibration again and do not manually modify the gain.
5.3 LED Threshold Customization
The brightness/sharpness LED threshold on the back of the camera can be modified in Linescan Calibration. For example, changing the threshold of Brightness LED 3 from 192 to 240, so that only very bright areas trigger the third light, is suitable for high reflective materials.

Communication interface configuration and PC software connection
XG-8000 provides five communication methods, and engineers need to choose according to the requirements of the on-site PLC or upper computer.
6.1 RS-232C (Port 1: RJ-11, Port 2: D-sub 9-pin)
Default usage: Port 1 is used for data output/command control, and Port 2 is used for touch screens (CA series).
Parameters can be set: baud rate (9600~230400 bps), data bits of 8, stop bits of 1/2, parity check of none/odd/even.
Wiring: Use OP-26487 (2.5m direct connection) or self-made crossover wire. Pay attention to the signal GND and power GND being grounded together to avoid voltage differences.
6.2 Ethernet
Connection method: Supports 1:1 crossover (recommended OP-66843 Gigabit crossover) or direct connection through a switch (Category 5e or above STP shielded wire).
Protocol: TCP/IP (ASCII commands), PLC Link, EtherNet/IP, and FTP client.
Settings: IP address, subnet mask, and default gateway are set in the system configuration. When using 1000BASE-T, it is necessary to use Category 5e or higher.
6.3 USB (for dedicated software only)
Usage: Only for connecting XG VisionEditor/VisionEerminal, does not support ordinary USB devices such as mice and USB drives.
Driver installation: The first connection requires installing the USB driver from the CD (located in driver USB). Under Win7, drivers need to be manually updated through the Device Manager.
Limitation: Only one controller can be connected to the same PC; Excessive cable length or the use of extension cords can cause instability.
6.4 CC-Link(CA-NCL10E)
Station type: Ver.1.10 or Ver.2.00 remote device station.
Communication speed: 156 kbps~10 Mbps, total extension distance is rate dependent (≤ 100 m at 10 Mbps).
Terminal resistor: Select the matching terminal resistor according to the cable model and install it between the DA and DB ends of the network.
Settings: Set the number of occupied stations (1-4) and loop settings (1x/2x/4x/8x) in the system configuration. After changing the settings, the controller and main station must be restarted.
6.5 Parallel I/O (40 pin flat cable)
Expand 22 universal inputs and 22 universal outputs (partially high-speed output F_OUT) using OP-51657 (3-meter ribbon cable).
Default allocation: IN0-IN15, OUT0-OUT21. Functions can be redefined through system variables such as Trg1Ready and CMDReady.
Attention: COMOUT2 terminals 17 and 40 are connected internally, ensuring that both have the same potential.
Handheld controller and special start combination key
The handheld controller OP-84231 provides the following core functions:
8-way joystick: Move the cursor and confirm in the center.
TRIGGER (No.3): Trigger all cameras at once; Long press to enter continuous triggering.
Function (No.1): Call out function menu.
RUN/STOP switch: Switch between run/edit mode.
Special startup combination key (for fault recovery):
Combination key function
No.2+Power ON initializes the controller to default settings and formats the SD1 card (all data will be lost)
No.1+Power ON forced display of initial startup screen (language/resolution selection)
No.1+8-way joystick+power ON forced offline mode start
No.6+Power on, obtain network settings through BOOTP
Runtime key combination (default):
No.1+No.5 (or No.7+No.5): Save the screenshot to SD2.
No.1+No.2 (or No.7+No.2): Send a reset signal in operation mode.
No.1+No.4 (or No.7+No.4): Switch screen display type (raw/filtered, etc.).
Common fault diagnosis and troubleshooting
8.1 No display after power on
Check if the 24V power supply is connected to A1/A2 and the polarity is correct.
Confirm that the monitor supports SVGA (800 × 600) or XGA (1024 × 768) with a vertical frequency of 60 Hz.
Check if the SD1 card is inserted and functioning properly (the controller cannot start without the SD1 card).
If the screen is still black, press and hold the No.1 key while powering on to force entry into the initial settings screen.
8.2 The image is completely black (but triggers normally)
Check if the aperture is open and if the lens cover is removed.
Confirm if the lighting power is turned on (the PWR LED of CA-DC21E should be on).
Adjust shutter time: If the shutter speed is ≤ 3 μ s but the Line Trigger Cycle is smaller, the shutter cannot complete the exposure (the 3 μ s difference must be followed).
Check 'Lighting Expansion Unit' in Capture Options and specify the correct light number.
8.3 Vertical displacement or skipping rows in the image
Encoder pulse counting abnormality: Use an oscilloscope to check the A/B phase signals and ensure a phase difference of 90 °. Adjust the Sampling Mode (1x/2x/4x) in Encoder Settings to match the encoder resolution.
Direction error: If the actual motion direction causes the image to reverse, you can set it to CW (clockwise counting only) in the Encoder Direction or enable Reverse Detection for reverse counting at the same time.
8.4 Communication Error (RS-232C or Ethernet)
Check if the port settings are consistent with external devices (baud rate, parity).
When using XG VisionTerminal, ensure that the firewall is not blocking UDP ports.
For USB connections, if frequently interrupted, investigate nearby sources of interference such as frequency converters and solenoid valves. Plug and unplug the USB cable and restart the software.
8.5 SD card error
Green indicator light: normal; Red: Accessing (cannot be unplugged); Extinguish: Can be safely removed.
Before removing the SD2 card, you must first select Stop SD2 Operation from the function menu, click OK, the indicator light will turn off, and then unplug it.
The SD1 slot cover plate is fixed with screws to prevent accidental removal during operation.
Debugging tools: Linescan Intensity Calibration and Edge Graph
Linescan Calibration: Real time display of the grayscale curve and differential curve of the selected row. Can be used for precise focusing (making the differential peak steepest), adjusting the angle of the light source to obtain a flat grayscale distribution.
Edge Graph: In running mode, selecting the edge detection tool can dynamically display the edge intensity change curve to assist in determining whether the threshold setting is reasonable.
Trend Edge Profile: displays the average, maximum, and minimum values of segmented edge positions, suitable for detecting changes in width or translation.
