> ## Documentation Index
> Fetch the complete documentation index at: https://docs.atomscale.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# kSA 400

> Upload RHEED frames from k-Space kSA 400's Image Streamer to Atomscale

The **kSA 400** integration uploads the frames that k-Space kSA 400 sends from one **Image Streamer** filter. They arrive in Atomscale as RHEED data items named after their start time, for example **kSA 400 @ 4:15 PM, Oct 23, 2026**. It is separate from [RHEED Camera (GenTL)](https://docs.atomscale.ai/gateway/rheed.md). It reads only what kSA 400 streams, never opens the camera, and never starts, stops, or changes an acquisition.

## Before You Start

* **The image stream's frame rate.** Note the rate kSA 400 sends, including any filters that change it. It must be at most 120 FPS.
* **kSAComm, if you want one data item per kSA 400 acquisition** (the **kSA Acquisition Status** boundary mode). In kSA 400, open **Options > General > Chamber Interface** and select **kSAComm** (port 1800). Make sure **Save settings at program exit** is enabled, then restart kSA 400. kSAComm accepts connections only after the restart.
* **A network path, if the gateway runs on another computer.** The gateway connects over TCP to the kSA 400 computer on the Image Streamer port and, with kSAComm, on port 1800. On the kSA 400 computer itself, no network setup is needed.

Supported pixel formats are mono at 1, 2, or 4 bytes per pixel and 8-bit BGR or BGRX color. Frames are converted to 8-bit grayscale before upload.

## Set Up

Once you've added an Image Streamer filter in kSA 400, you can ask the [Gateway assistant](https://docs.atomscale.ai/gateway/assistant.md#set-up-an-integration) to install and configure the Atomscale integration. Give it the kSA 400 computer's address, the Image Streamer port, and the frame rate.

**1. Add an Image Streamer filter in kSA 400**

Open the camera's **Live Video** window and open its properties. On the **Filters** tab, choose
**Image Streamer** in a filter slot. A streamer in slot 1 sends unprocessed camera frames; later
slots send frames after the filters before them. Click **Properties** and note the TCP port
(4000 by default).

**2. Add the integration**

On the **Integrations** page, click Add Integration, then
Add on **kSA 400**. See [Working with Integrations](https://docs.atomscale.ai/gateway/integrations.md).

**3. Configure the connection**

* **kSA 400 Computer**: leave `127.0.0.1` when the gateway runs on the kSA 400 computer.
  Otherwise enter its host name or IP address, without a port or protocol.
* **Image Streamer Port**: the port shown in the Image Streamer filter's properties.
* **Frame Rate (FPS)**: required. Enter the stream rate configured in kSA 400. The integration
  trusts this value and does not detect a mismatch, so update it whenever the stream rate changes.

**4. Choose the data item boundary**

Set **Data Item Boundary Mode**. See [Choose a Boundary Mode](#choose-a-boundary-mode).

**5. Apply and start**

Click Apply Configuration, then
Start Integration.

**6. Confirm it works**

Open **Activity Logs**. Image stream connected means the integration reached the Image
Streamer. Data item opened: kSA 400 @ … means frames are uploading.

To group recordings with the tool log from the same growth, [link the integration to its Growth Instrument](https://docs.atomscale.ai/gateway/data.md).

## Choose a Boundary Mode

kSA 400's live video streams whether or not kSA 400 is acquiring, so the mode decides which frames upload. In every mode, a change in frame size or pixel encoding closes the current data item.

| Mode | A data item opens and closes | Use it when |
| - | - | - |
| **Adapter Enabled** (default) | Opens at the first frame after you start the integration. Closes when you stop it, change its settings, or no frame arrives for **Image Stream Idle Timeout**. | You start and stop the integration around each growth. Everything in between uploads, including idle time. |
| **Frame Activity** | Opens at the first frame at least as bright as **Minimum Mean Intensity**. Closes after **Session Gap** without such a frame. | You blank the electron beam between growths. Set **Minimum Mean Intensity** just above the blank-frame background. |
| **kSA Acquisition Status** | Polls kSAComm. Frames upload while kSA 400 is acquiring or paused; the item closes when kSA 400 goes idle or its acquire dialog closes. | You want one data item per kSA 400 acquisition. Requires kSAComm. |

In kSA Acquisition Status mode, boundaries are accurate to **kSA Status Poll Interval**, so a stop and restart shorter than one poll ends up in one data item. If kSAComm stops answering, the integration keeps the last status it confirmed. After **kSA Status Timeout** it closes the open item and uploads nothing until kSA 400 answers again. When kSA 400 reports a stable stage rotation as an item opens, the item records it; otherwise Atomscale detects rotation from the video.

## Settings

Settings marked **Advanced** appear only with Show advanced settings turned on. Mode-specific settings appear only in their mode.

| Field | Default | Description |
| - | - | - |
| **kSA 400 Computer** | `127.0.0.1` | Host name or IP address of the computer running kSA 400. |
| **Image Streamer Port** | 4000 | TCP port of the Image Streamer filter, 1 to 65535. |
| **Image Stream Idle Timeout** (advanced) | 30 seconds | How long the stream may send nothing before the integration reconnects, 5 to 3600. In Adapter Enabled mode, also closes the data item. Raise it for long exposures or when live video is often stopped. |
| **Data Item Boundary Mode** | Adapter Enabled | **Adapter Enabled**, **Frame Activity**, or **kSA Acquisition Status**. |
| **Session Gap** | 120 seconds | Frame Activity only. Seconds without an active frame before the item closes, 0.1 to 86400. |
| **Minimum Mean Intensity** | 0 (every frame active) | Frame Activity only. Minimum mean 8-bit brightness, 0 to 255, for a frame to count as active. Darker frames stay in an open item but don't extend it. |
| **kSAComm Port** (advanced) | 1800 | kSA Acquisition Status only. Change it only to match kSA 400. Must differ from **Image Streamer Port**. |
| **kSA Status Poll Interval** (advanced) | 1 second | kSA Acquisition Status only. How often to ask kSA 400 for its status, 0.5 to 60. |
| **kSA Status Timeout** (advanced) | 10 minutes | kSA Acquisition Status only. How long kSA 400 may stay unreachable before the open item closes, 1 to 1440. |
| **Frame Rate (FPS)** | None (required) | The kSA 400 stream rate, greater than 0 and at most 120. Sets recording timing and frames per chunk; it doesn't change the camera or limit uploads. |
| **Chunk Interval** (advanced) | 2 seconds | Seconds of frames per uploaded chunk, 0.1 to 10. Frames still pending when an item ends are discarded, so a shorter interval lowers delay and the discarded tail. |
| **Upload Backlog Size Limit**, **Free Disk Space To Keep** (advanced) | Auto, 1 GB | See [Disk Buffering](https://docs.atomscale.ai/gateway/uploads.md#disk-buffering). |

## Troubleshooting

| Message | Cause and fix |
| - | - |
| Image stream unavailable; reconnecting | The integration can't reach the Image Streamer, or the stream closed. Check that the Image Streamer filter is set up, that **kSA 400 Computer** and **Image Streamer Port** match it, and that the network path is open. It retries automatically, logging this at most once a minute. |
| no frame arrived within the …-second idle timeout (in the reconnect warning) | The connection is open but kSA 400 sent nothing, for example because live video is stopped. Start live video, or raise **Image Stream Idle Timeout** for long exposures. |
| Image stream format not supported | kSA 400 sends a pixel format the integration can't convert. Use mono or 8-bit BGR/BGRX color output. |
| Image stream record is shorter than a header | The stream doesn't have the expected record layout, and no frames upload. Copy the configuration and the log entry for Atomscale support. |
| Frames dropped: the acquisition queue is full | The computer can't keep up with the stream. Lower the stream rate in kSA 400, then update **Frame Rate (FPS)**. |
| kSA status polling failed | kSAComm doesn't answer. Check that kSAComm is selected and kSA 400 was restarted, and that **kSA 400 Computer** and **kSAComm Port** are correct. Until the first reply, No acquisition status is confirmed yet, so no frames are uploaded. |
| kSA status lost; closing the open data item | kSAComm stayed unreachable for **kSA Status Timeout**. Uploads resume when kSA 400 answers (kSA status polling recovered). |
| kSA reported an unrecognized acquisition status | kSA 400 sent a status this version doesn't know. The integration keeps the last confirmed status. |
| Validation: Image Streamer port must differ from the kSAComm port. | The two ports match. Enter the port from the Image Streamer filter's properties. |
| Validation: Frame rate must be greater than zero and at most 120 FPS. | Enter the stream rate configured in kSA 400, and keep it at 120 FPS or less. |

Status changes appear in the activity log as kSA acquisition started, kSA acquisition paused, kSA acquisition resumed, and kSA acquisition stopped. Each closed item logs Data item closed: kSA 400 @ … with the reason.

> [!NOTE]
>
> This page describes kSA 400 version 0.2.6.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.