Before beginning

In order to acquire accurate 2D images with line sensor, the movement speed of the object and the scan rate must be synced perfectly.

※Scan rate: Time to capture 1 line

In case the camera’s scan rate is fixed as programmed and the object moves faster or slower than the scan rate, the captured image is going to be shrunken or stretched. To resolve this problem, it is required to sync the encoder at the precise timing.

What is called as “Encoder sync capture” is the method to synchronize the timing between moving object and the scan rate using a rotary encoder (hereafter “encoder”).

Various information about encoder sync acquisition and problems frequently experienced when using the encoder with AIP Tool is described in this manual.

 

Overview of Encoder

An encoder is the sensor that detects a shaft’s angular motion, position, and the angle. When it detects the motion, it generates the pulses called phase-A or phase-B, then moving speed of the object can be detected by counting the pulses. So, you can capture the image of moving object with the encoder by synchronizing the scan rate and the speed of moving object.

There are two main types of encoder: incremental encoder and absolute encoder

Please note that Avaldata’s frame grabber is working with the incremental encoder only.

An incremental encoder provides the specific amount of pulses when the shaft is rotating, and output can be three types of signals: A phase, B phase, and Z phase.
※Incremental encoder has three types of outputs: [A phase], [A,B phase], and [A,B,Z phase].

Avaldata’s frame grabber works with the encoder with line driver(RS422 output) only.

 

Devices working with the encoder

The following is an example of the installed diagram to capture the image by using the encoder and CC signal.

  1. As the encoder is rotating the object on the conveyor belt moves.
  2. Signal output called A, B, Z phase is manufactured as the encoder rotates.
  3. The signals on A,B,Z phase are transmitted to the frame grabber through the cables
  4. The frame grabber receives the signals(A,B,Z phase) and CC signal is generated accordingly.
  5. Camera receives CC signal and capture 1 line.

The signal is manufactured depending on the belt speed in conveyor, the scan rate can be adjustable.
So, even if the belt is moving at random speed, correct image can be captured, not being distorted.

 

Encoder Signal and Operation of the Frame Grabber

Before explaining how to configure the frame grabber, it is describing briefly about the operation of the frame grabber when the encoder’s signal is entered in this chapter.
When the frame grabber detects the pulse signal from the encoder, it starts to count the number of pulses up to ※the arbitrary value.

※This arbitrary value is called the Starting Point or the Sampling Interval.
→For a detailed description of Starting Point or Sampling Interval, please refer to the following section about Settings of Starting Point and Sampling Interval.
When the count value reaches to the arbitrary value, a※sync pulse” is generated and starts to capture (output CC signal or acquiring 1 line).

※Sync pulse : The signal generated internally by the frame grabber
→For a detailed description of the sync pulse, please also refer to the section about Settings of Starting Point and Sampling Interval.

The user needs to set the parameters of the frame grabber correctly depending on the circumstance.
Let’s learn how to set the parameters in the next page.

 

Frame Grabber Settings

The parameters of Avaldata’s frame grabber is able to be configured by AIPTool.
Open the Setup screen in AIPTool, and the 8 parameters marked in red box below are able to be set for the encoder.

 

Encoder Enable or Disable

User can choose to use or do not use the encoder, and in case of using the encoder, user can also choose the counting mode of the encoder between Relative or Absolute.

◆Relative Count Mode

The following is the description of settings on relative count mode.

  • Starting Point         = 100
  • Sampling Interval  = 4

The following process is a description of the above image.

  1. Sending trigger signal for “Start counting”
  2. Start to count
  3. When counting reaches 100(starting point), the sync pulse is generated.
  4. Count is reset
  5. Count to start
  6. When counting reaches 4(sampling interval), the sync pulse is generated.
  7. Count is reset
  8. After then, repeating process from 5 to 7

 

◆Absolute Count Mode

The following is the description of settings on absolute count mode.

  • Starting Point         = 100
  • Sampling Interval  = 4

The following process is a description of the above image.

  1. Sending trigger signal for “Start counting”
  2. Absolute count starts to count.
  3. When Absolute count reaches 100(starting point), the sync pulse is generated.
  4. Absolute count continues counting.
  5. Relative count starts to count.
  6. When Relative count reaches 4(sampling interval), the sync pulse is generated.
  7. Relative count is reset.
  8. After then, repeating the process from 5 to 7

※The counter is reset by the encoder signal “stop counting → start counting”.

 

Type of Pulse Output from Encoder

Select the pulse output type from the encoder from between a single line of pulses (the A phase) and two line of pulses(the A and B phase).

 

◆Encoder’s counting method

In general, pulses are counted at the timing both of the rising edge and the falling edge.

・A phase

・A and B phase

 

Select the Direction of Rotation of the Encoder

Select the direction of the rotation of the Encoder : CW(Clockwise), CCW(Counter-Clockwise)

In case the pulses in B-phase are 90 degree slower than the pulses in A-phase, it rotates as CW.
In case the pulses in A-phase are 90 degree slower than the pulses in B-phase, it rotates as CCW.

 

Settings of the Starting Point and the Sampling Interval

When the encoder counts reach to the value of starting point or sampling interval, Sync pulse is generated.

  • Starting Point: The number of counted encoder pulses until sync pulse is generated
  • Sampling Interval: Interval(the number of encoder pulse) of sync pulse generation after the first sync pulse

When the sync pulse is generated, the frame grabber performs one of the following actions.

  1. Sending CC signal
  2. Acquiring 1 line of the image

The frame grabber performs one of the above actions depending on the setting.

[NOTE] Depending on the setting, the counter may be reset when the sync pulse is generated.

 

Enable or Disable Z phase

Select Z phase you want to enable or disable.
Unlike A phase or B phase, Z phase is output one pulse only at 1 cycle of the rotation of the encoder.
In case of enabled, you can use the pulse in Z phase as a trigger to start counting the pulses.

 

Select Start Counting Trigger

You can select the parameter specifying the trigger source to start counting the encoder pulse in below set.

You can also set the pulse in Z phase as the start counting trigger.

In case you select the mode to CC 1Shot, the sync pulse is generated by an external trigger, not by the encoder pulse.

So, the sync pulse is generated at the timing the external trigger is generated.
You can consider External trigger = Sync pulse.

 

Select Operation Mode

Encoder input mode can be selected between Encoder scan mode and Encoder line mode.

◆Encoder Scan Mode
In this mode, Generating CC signal at the time the sync pulse is generated.
It is selected if you want to control the image acquisition timing by the encoder.
Make sure to set the camera to the random shutter mode(control by CC signal).

Following is the timing chart of generating the sync pulse and data output.

This timing chart can be visualized is shown in next page.

In encoder scan mode, as shown above, the camera is not running until receiving CC signal and the frame grabber is not sending the CC signal until the sync pulse is generated.

In encoder scan mode, the image data read out from the camera is transferred to the frame grabber.

◆Encoder Line Mode
In this mode, a camera outputs the first line data(LVAL, line valid) after detecting a sync pulse.
This mode is suggested to the case the exposure is implemented regardless of the encoder signals and controlling the timing of receiving data by the encoder.
Following is the timing chart from generation of the sync pulse to the data(image) output.

This timing chart can be visualized is shown in next page.

<In case the camera is working in free run mode>

Although the camera is working in free run mode, the frame grabber does not receive data until the sync pulse is generated.

<In case the camera is set to exposure control mode (CC signal sync mode)>

The camera is only acquiring data synchronized to the CC signal, but the frame grabber does not receive the data until the sync pulse is generated.

 

FAQ

Frequently asked questions about using the encoder in this chapter. This chapter presents how to resolve the trouble frequently experienced as shown in blue below when using the encoder.

・Having a Trouble for Synchronizing to the Encoder Signal

・Line rate is lower than I expected value.

・Captured image is stretched or shrunken than I expected.

・Captured image is blurry.               

・Brightness of image keeps changing whenever the object moves at different speed.

・I don’t see the change on the number of counting the pulses in relative count mode.

 

◆Having a Trouble for Synchronizing to the Encoder Signal
Check) Isn’t the camera set to Free run mode?

  • Frame Grabber : Encoder scan mode
  • Camera : Free run mode

In case of the camera and the frame grabber are set as above, the camera runs continuously not waiting for CC signal generated from the frame grabber. And the frame grabber gets all images transferred from the camera. Therefore, these devices are working regardless with the encoder signal.
If you want to capture the board synchronizing with the encoder signal, make sure the camera is running in CC signal sync mode.

◆Line rate is below the expected value.
Check) Isn’t the cycle of CC signal shorter than the sync pulse period?

In case of operation in encoder scan mode, user sets the cycle and pulse width of CC signal to the frame grabber. Occasionally depends how to be set the value of CC signal and frequency of the encoder there might be the loss of sync pulses.

As you can see above, in case sync pulse cycle is shorter than CC cycle, some sync pulses are ignored.
If you want to use encoder scan mode, line rate is not able to be set higher than CC cycle. 

※AIPTool provides the functionality to check sync pulse cycle and CC cycle and user can check the cycle is set appropriately or not. See below to read how to check it.

Open the Setup button and go down to Step5 on the screen, and you will see the setting box as below.
You can enter the values for the encoder setup

If entered value is not valid, it is not completed to set and appears in red as shown below.
When you move your mouse cursor to the red box, you can check the pop up message for guidance.

If you want to remove the popup message, try to do one of followings.

  1. Entering the lower value to Encoder Frequency
  2. Increasing the value of Sampling Interval
  3.  Making the Cycle of CC Signal longer

※To check the frequency of the encoder set on the frame grabber, enable I/O status indicator in AIPTool.

You can check the latest status of I/O by clicking the update board information button found top left on the GUI.

※The reason to set the cycle of CC signal to the frame grabber is

If the frequency of the encoder signal sets fast, the cycle of CC signal gets also faster.
What if the CC cycle is greater than the camera’s limitation, the camera may not work properly.
Therefore, this kind of problems can be prevented by setting the limit of CC cycle to the frame grabber.

 

◆Captured image is stretched or shrunken than I expected.
Check) Is the moving speed of the object and the image acquisition timing is matched?

It can occur when the cycle of the encoder does not match with the moving speed of the object.

  • In case stretched: the object moves slow to the frame period.
    → Increase the value of Sampling Interval
  • In case shrunken: the object moves fast to the frame period.
    → Decrease the value of Sampling Interval

◆Captured image is blurry.
Check) Are you using a TDI camera?

TDI camera is that captures the line data synchronizing with the movement of the object and accumulates multiple exposures of the object.

So, the velocity mismatch (scan rate and the speed of the object) causes the image becomes blurry and this is because of the misalignment of the pixels.
In addition, the same thing can happen when the camera and the object are positioned not vertically.

 

◆Brightness of image keeps changing whenever the object moves at different speed.
Check) Isn’t the setting of the camera set to daylight time=CC signal cycle?

Some camera exposes to the light for the time of 1Cycle of CC signal.
In this case, depending on object moving speed, the exposure time is changed as shown below

・ The object moves slow → CC Cycle becomes shorter → Exposure time becomes longer

The object moves fast → CC cycle becomes longer → Exposure time becomes shorter

When the exposure time is changed synchronized with the object’s speed, the deviation of the brightness occurs to the image. So, preventing this one of following actions is required.

  1. Do not set as Exposure Time=CC signal Interval.
  2. Set the operation of the frame grabber to Encoder Line Mode.

◆I don’t see the change on the number of counting the pulses in relative count mode.
Check) Is image acquisition still on going?

Counting is not started if the image acquisition (Snap or Grab) is not implemented in the relative count mode. So, if you want to check if counting works, start snap or grab.
See below to check the encoder counts.

<Relative count mode>

 

<Absolute count mode>