# Data Logging

YuDash data loggers support periodic data logging to an onboard microSD card. This feature is essential for applications requiring offline storage, regulatory audit trails. The files in the microSD card can be downloaded in laptop or it cane be accessed through YuDash interface.

## Data Logger Configuration

### 1. Enabling Data Logging

To enable the SD card logging feature:

1. Navigate to the **LYNX Settings** section from the side menu.
2. In the **Feature Settings** block, check the box labeled **Data Logging**.
3. Click **Write LYNX Config** to save the changes.

<figure><img src="https://1858257737-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FToww5EM1cml3ouN6fvnJ%2Fuploads%2F2WBHokwcjE0AEAUrWWQm%2F1.png?alt=media&#x26;token=3ac570a4-31c5-4c73-93aa-afc501467d22" alt=""><figcaption></figcaption></figure>

4. SD Card logging requires both the **SD Card** and **RTC (Real-Time Clock)** features to be enabled in the configuration. If either is disabled, the logger will not function. Make sure both checkboxes are selected before setting up the data logger.

<figure><img src="https://1858257737-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FToww5EM1cml3ouN6fvnJ%2Fuploads%2FDQQjHMnyoYi2IAH4gh0q%2F2.png?alt=media&#x26;token=00a2a66c-6d09-4e88-89d0-723e1b00ee79" alt=""><figcaption></figcaption></figure>

### 2. Data Logging Section

* **Navigate** to the **Data Logger Settings** tab from the sidebar.
* Click **Read Data Logger Settings** to load the current configuration from the device.
* Modify the necessary fields such as:
  * Logging interval
  * File cycle and naming
  * Encoder pattern or custom header
* After making changes, click **Update Data Logger Settings** to save the configuration to the device.
* There is an option to tick **Use Default Settings**. When this is enabled, the data logger uses its internal default configuration and other blocks can be blank. As soon as you provide any **custom entry** — like a header text or an encoder format — the corresponding default is overridden. Only fields left blank will fall back to default behavior.

<figure><img src="https://1858257737-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FToww5EM1cml3ouN6fvnJ%2Fuploads%2FuCB7acQ60U2GrGtTS7Ll%2FYuDash_Datalogging.png?alt=media&#x26;token=e3ec174d-c1c1-4813-bb67-1d2ff0b162a4" alt=""><figcaption></figcaption></figure>

### 3. File directory and name

In this section, you configure where and how the data logger files will be stored:

<figure><img src="https://1858257737-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FToww5EM1cml3ouN6fvnJ%2Fuploads%2F2qnw91uZz33YUrzGVp0a%2F4.png?alt=media&#x26;token=b631c51d-08a5-4132-b6c0-751ad2205b91" alt=""><figcaption></figcaption></figure>

1. **Logger Directory**: Specifies the folder path on the SD card where log files will be created. Points to note:

   1. The path must begin with a forward slash `/` (root directory).
   2. Use `/` as the folder separator (like in Unix/Linux), **not** the Windows-style backslash `\`.
   3. **Do not** add a trailing slash at the end of the path.\
      ✅ `/logger_dir`   ❌ `/logger_dir/` or `\logger_dir\`
   4. The directory will be **automatically created** if it does not already exist on the SD card.

2. **File Name**

YuDash provides flexible file naming by allowing a customizable **prefix**, dynamic **timestamp insertion** (based on selected cycle), and optional **suffix**.\
This makes it easy to:

* Align with existing file naming conventions in your systems
* Simplify automated file parsing or importing on downstream software
* Organize logs by project, device, or department

The file name is constructed using a **prefix**, the **cycle-based timestamp**, and a **suffix**. The suffix is typically `.csv`, `.txt`, or any other extension as per your application's needs.

**File Name**: Define a custom file name using a **prefix** and **suffix**. The actual file name is generated dynamically using the selected **File Cycle:**

**file\_name = Prefix + Cycle + Suffix.**

**File Naming Examples for different Cylcles**

* **Prefix**: `log_`  **Suffix:** `.csv`
* **File Cycle Options**

| File Cycle               | Description                   | Example File Name          |
| ------------------------ | ----------------------------- | -------------------------- |
| **None**                 | Single file                   | `log_.csv`                 |
| **YYYY**                 | Yearly                        | `log_2025.csv`             |
| **YYYY\_MM**             | Monthly                       | `log_2025_06.csv`          |
| **YYYY\_MM\_DD**         | Daily                         | `log_2025_04_18.csv`       |
| **YYYY\_MM\_DD\_HH**     | Hourly                        | `log_2025_04_15_05.csv`    |
| **YYYY\_MM\_DD\_HH\_NN** | Per minute (for testing only) | `log_2025_04_15_05_03.csv` |

### 4. File content

In this section, you define the **format of each line** in the log file, including optional header text, timestamp placement, and variable encoding using a flexible text template.

1. **Optional File Header**
   * A one-time header line is added at the top **only when a new file is created** (e.g., on a new day or month depending on the file cycle).
   * Useful for column labels or unit information.
   * Can be left blank if not needed.
2. **Timestamp Format Selection**
   * Select the **TimeStamp format** from the dropdown. This determines the format that will be used when `#TS` is inserted into the encoder.
   * You can choose from UTC or Local time formats such as:
     * `YYYY-MM-DD HH:MM:SS`
     * `DD-MM-YYYY HH:MM:SS`
     * `UNIX_EPOCH`
     * `ISO 8601`
   * For a full list of available timestamp formats and codes (`TS_50` to `TS_66`), refer to the[ Time Stamp formats](https://docs.yudash.com/device-to-cloud-api/payload-formats/json-payloads#h.t8n8abq6601b_l).&#x20;
3. **Logger Text Encoder**
   * This is a simple, text-based encoder that defines how each line in the log file is written. This is of format TEXT\_FORMAT\_20 of [YuTGT](https://docs.yudash.com/device-to-cloud-api/payload-formats/yutgt-yudash-text-generator#yudash-text-generator-for-payload)
   * You can use:
     * **Single-character separators** such as `,`, `:`, `|`, , etc.
     * **Variable names** (e.g., `bod`, `tss`, `cod`) as defined in earlier configuration flows. These are replaced with their actual values during logging.
     * **Special `#` tags** to insert system-defined fields:
       * `#TS` → Timestamp (as per the selected format)
       * `#NL` → New line (typically added at the end of each encoder string to ensure proper row formatting)
       * Other #tags as per YuTGT
   * This flexible approach allows you to generate well-structured `.csv` or `.txt` files tailored to any downstream system.

## Example: Logging 4 Analog Channels with YuDash LYNX

This example shows how to configure YuDash LYNX to log data from 4 analog input channels to the SD card using default settings. No Modbus devices or cloud connection is required. You’ll get one `.csv` file per day, which can be opened directly in Excel. &#x20;

### Step 1: Load Example Configuration File

To get started quickly, you can **load the ready-made lynx configuration json file:**

{% file src="<https://1858257737-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FToww5EM1cml3ouN6fvnJ%2Fuploads%2FB9nzJpulZmoNcDEWjOuz%2Floger_default_json.json?alt=media&token=d44bf95b-a257-4cd0-b0a8-c8ab9e458fcf>" %}

Simply download above json file and load into YuDash device.&#x20;

#### Step-by-Step Review of Settings

Now let’s review what’s inside this file — based on screenshots and setting blocks:

***

**✅ 1. Enabled Features**

<figure><img src="https://1858257737-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FToww5EM1cml3ouN6fvnJ%2Fuploads%2FYqPS1CKK8YdO14o8S7hK%2F10.png?alt=media&#x26;token=4827ee5c-9c5d-418e-8252-e2742e71328d" alt=""><figcaption></figcaption></figure>

In **LYNX Settings**:

* `Analog Inputs`: ✔️ Enabled
* `Data Logging`: ✔️ Enabled
* `Ethernet/LAN`: ✔️ Enabled (for accessing logs via LAN browser)
* Cloud/Network Server is set to "Offline"&#x20;

***

**✅ 2. Logging Frequency and RTC Settings**

<figure><img src="https://1858257737-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FToww5EM1cml3ouN6fvnJ%2Fuploads%2Fx83mlN9A0LmASgSYgRtg%2F11.png?alt=media&#x26;token=1a960c94-b0c6-4020-abb5-4f68f88f75fc" alt=""><figcaption></figcaption></figure>

In **Advance Feature Settings**:

* `TimeSync Run (Minute)`: `1`\
  → This tells the logger to save data every 1 minute
* `Enable RTC`: ✔️ Checked
* `Enable SDCard`: ✔️ Checked

***

**✅ 3. Logger Settings (Default Mode)**

*(See Screenshot 112)*

<figure><img src="https://1858257737-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FToww5EM1cml3ouN6fvnJ%2Fuploads%2FkUqJiluhelJxlrtI4Kyr%2F12.png?alt=media&#x26;token=75e686a4-905b-4796-a4e5-3a5cdc8f1b2e" alt=""><figcaption></figcaption></figure>

In **Data Logger Settings**:

* `Use Default Settings`: ✔️ Enabled
* All other fields: left empty

> In this mode, the logger automatically:
>
> * Logs **all available analog inputs** (e.g., analog1 to analog4)
> * Adds a **timestamp** at the beginning
> * Uses **comma-separated CSV** format
> * Saves one file per day in `/logger_dir`

### Step 2: Run LYNX with uploaded lynx.json

Start by powering up the YuDash LYNX device with a microSD card inserted.

* You **do not need to connect any analog sensors** at this stage.
* LYNX will still log the 4 analog channels with default values (typically zero raw ADC readings).
* Let the device run for a few minutes so it can generate at least 2–3 log entries.

### Step 3: View the File Created on SD Card

After a few minutes of running, a log file will be created automatically on the SD card by the LYNX.

* **Folder Path:** `/logger_dir`
* **File Name Format:**

  ```
  logger_file_YYYY_MM_DD.csv
  ```

  For example: `logger_file_2025_06_12.csv`
* **Sample File Content (this example has analog inputs connected, with 5,10,15,20mA at inputs):**

{% file src="<https://1858257737-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FToww5EM1cml3ouN6fvnJ%2Fuploads%2Fv8EkMCBOmmnekRfvURpS%2F_logger_dir_log_file_2025_06_12.csv?alt=media&token=41788324-5ee0-4972-b718-370c39afa1e9>" %}

## Retrieval of data logger files in laptop/PC

<figure><img src="https://1858257737-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FToww5EM1cml3ouN6fvnJ%2Fuploads%2FQnx84BySeJk7biYmdYMG%2Fpage7.png?alt=media&#x26;token=49150715-52ea-442a-8d1e-5c842b3fa127" alt=""><figcaption></figcaption></figure>

The data files created by the YuDash logger on the SD card can be easily accessed using a laptop or desktop system. Follow the steps below (also illustrated in the image):

1. **Remove the SD Card from the Logger**
   * Gently push the SD card using a non-metal tool (e.g., plastic tweezer) to release it from the slot on the YuDash device.
2. **Insert SD Card into Laptop**
   * Use the built-in SD card slot (if available), or a USB card reader as shown in the example.
3. **Browse the Logger Directory**
   * Once inserted, the SD card appears as a removable drive.
   * Navigate to the configured **logger directory** (e.g., `/loggerDir`) to view the generated log files.
4. **Open Files in Excel or a Text Editor**
   * The files (typically `.csv` or `.txt`) can be opened in applications like Microsoft Excel, Notepad, or any spreadsheet/data analysis software for review and further processing.

> 📎 Tip: Ensure the logging cycle has completed (e.g., file has closed properly) before removing the SD card for reliable file reads.

SD card file access&#x20;
