Skip to content

Technical Knowledge

Guide to Environmental Monitoring Data Transmission to DONRE via FTP/sFTP: .txt File Format Under Circular 10/2021

Comprehensive technical guide for transmitting continuous environmental monitoring data to provincial DONRE servers via FTP/sFTP: .txt file structure, naming conventions, and store-and-forward mechanisms under Circular 10/2021/TT-BTNMT.

Circular 10 Datalogger & EMS →
Guide to Environmental Monitoring Data Transmission to DONRE via FTP/sFTP: .txt File Format Under Circular 10/2021

According to Article 39 of Circular No. 10/2021/TT-BTNMT issued by the Ministry of Natural Resources and Environment (MONRE), automated continuous environmental monitoring data (industrial wastewater and CEMS continuous emission monitoring) must be transmitted directly from field data loggers (Dataloggers) to the servers of provincial Departments of Natural Resources and Environment (DONRE) via FTP or sFTP protocols in plain text (.txt) file format, with a transmission cycle no slower than once every 5 minutes and a local buffering capacity at the station of at least 60 days.

This technical guide is part of DeviceLab's comprehensive engineering handbook on environmental monitoring datalogger compliant with Circular 10.

Partner Protection & B2B Distribution Policy: DeviceLab strictly does not sell directly to end-user factory owners. We are a specialized hardware R&D and OEM/ODM manufacturer catering to Environmental EPC Contractors, Monitoring System Integrators (SIs), and Electrical Panel Builders. All our devices support white-label OEM branding, complete technical dossier packages, sample configuration files, and direct on-site commissioning and acceptance support.

📌 Circular 10/2021/TT-BTNMT Technical Summary (Key Takeaways):

  • Compliant Transmission Protocols: FTP (Port 21) or sFTP (SSH File Transfer Protocol - Port 22). Major provincial DONRE authorities (including Hanoi, Ho Chi Minh City, Binh Duong, and Bac Ninh) strictly mandate sFTP to prevent packet spoofing and tampering.
  • File Naming Architecture: Mandatorily structured as [Station_ID]_[YYYY][MM][DD]_[HH][mm][ss].txt. Field delimiters must strictly be Tab characters (t) or commas (,).
  • Data Frequency: Periodically once every 5 minutes for automated wastewater and industrial stack gas emissions; once every 1 hour for auxiliary meteorological parameters.
  • Store-and-Forward Mechanism: During cellular 4G outages or DONRE server maintenance windows, the datalogger must buffer records locally into non-volatile Flash and automatically backfill missing files in chronological order as soon as connectivity restores.
  • CCTV Camera Streams: Live RTSP video stream with a minimum resolution of HD 720p monitoring the discharge outfall and the automated refrigerated sampler chamber.
Environmental monitoring station centralized dashboard showing FTP push status to DONRE
Figure 1: Centralized monitoring dashboard continuously displaying telemetry parameters and FTP/sFTP transmission logs to municipal environmental authorities.

The Dreaded Administrative Penalties for Telemetry Interruption

In automated environmental monitoring projects, the greatest operational anxiety for EPC contractors and factory plant managers is not purchasing sensors, but rather maintaining uninterrupted data telemetry to provincial DONRE servers. Under Government Decree No. 45/2022/ND-CP on administrative penalties in environmental protection, failure to transmit monitoring data or suffering connection downtime beyond permitted thresholds incurs fines from 50,000,000 VNĐ to 250,000,000 VNĐ, along with potential suspension of wastewater discharge licenses.

Field audits across major industrial parks reveal that over 75% of telemetry interruption incidents stem from elementary technical shortcomings:

  • Deploying Windows-based Industrial PCs (IPCs) as Dataloggers: The Windows operating system triggers unprompted automatic updates (Windows Update) and reboots at midnight; cooling fans draw in corrosive chemical fumes that deteriorate PCBs; and SSD storage suffers file system corruption during abrupt power brownouts.
  • Formatting Discrepancies in File Names or Delimiters: A single extraneous space character instead of a Tab, or saving UTF-8 with Byte Order Mark (BOM), causes DONRE ingestion engines to automatically reject the packet and flag the station as "Offline".
  • Lack of Throttled Backfill in Buffering Engines: Following a 2-day 4G cellular outage, an IPC software accumulated 576 pending files. Upon reconnection, it dumped all 576 files simultaneously, saturating the DONRE FTP server bandwidth and triggering an automated IP block due to suspected Denial-of-Service (DDoS) behavior.

Detailed Structure of the Standard .txt File Mandated by Circular 10

Article 39 of Circular 10/2021/TT-BTNMT strictly defines the contents of each data file. A compliant transmission file comprises two primary sections: the Header (identifying the station and parameter list) and the Data Body (containing measured values accompanied by operational status flags).

# Standard file naming: [STATION_CODE]_[YYYYMMDD]_[HHMMSS].txt
# Example: KCN_QUANGMINH_NT01_20261012_143000.txt

# File body content (Delimited strictly by TAB t characters):
Station_ID DateTime pH TSS COD NH4 Temp Flow_Out Status
KCN_QUANGMINH_NT01 2026-10-12 14:30:00 7.35 28.4 45.2 2.15 29.8 120.5 00

Significance of Information Fields in the Transmission Record:

Field Name Standard Format Technical Description & Requirements
Station_ID ASCII String Unique station identifier assigned by provincial DONRE in the official commissioning permit. Must never be altered arbitrarily.
DateTime YYYY-MM-DD HH:mm:ss Timestamp of the recorded sample in Indochina Time (UTC+7). The datalogger must maintain clock accuracy via internet NTP synchronization.
Measured Parameters Float (2 decimal places) Standard parameters: pH (7.35), TSS (28.4 mg/L), COD (45.2 mg/L), NH4+ (2.15 mg/L), Instantaneous Outfall Discharge (Flow_Out m3/h).
Status Flag 2-digit Code / Hex Operating condition flag: 00 (Normal), 01 (Sensor Calibration), 02 (Maintenance), 03 (Hardware Error), 04 (Threshold Exceeded).
Field Engineer Warning: Multiple Windows-based software tools default to exporting UTF-8 text with a Byte Order Mark (BOM: EF BB BF) prepended to the file stream. DONRE receiving servers parse this as corrupted byte sequences and discard the entire data packet. DeviceLab's dedicated DL-ENV10 hardware generates pure ANSI ASCII files, eradicating 100% of character encoding and BOM errors.
DIN rail terminal blocks and optical isolation circuitry for environmental monitoring stations
Figure 2: DIN rail terminal block assemblies integrating surge protection devices and galvanic optical isolation for sensor instrumentation lines.

Traditional Plaintext FTP vs. SSH-Encrypted sFTP Protocols

Prior to 2021, most provinces accepted legacy plaintext FTP over port 21. However, under national cybersecurity compliance directives, nearly all provincial DONRE authorities have transitioned or strictly mandated sFTP (SSH File Transfer Protocol) operating over port 22.

Comparison Dimension Legacy FTP (Port 21) sFTP via SSH (Port 22)
Payload Encryption Unencrypted plaintext. Credentials and measurements transmitted exposed across public cellular networks. End-to-end SSH encryption (AES-256). Immune to packet sniffing and man-in-the-middle tampering.
Authentication Method Basic Username & Password. Supports Username/Password credentials and RSA 4096-bit SSH Key Pair authentication.
Firewall & NAT Traversal Dual-channel (Control port 21 and dynamic passive data ports), frequently blocked by industrial cellular routers. Single multiplexed port (Port 22), effortlessly navigating carrier-grade NAT (CGNAT) and enterprise firewalls.
Embedded Compatibility Minimal footprint; can run on basic 8-bit microcontrollers. Demands 32-bit MCUs (ARM Cortex-M4/M7) with sufficient RAM to handle cryptographic suites like mbedTLS.

Resilient Store-and-Forward Buffering Architecture

An automated continuous monitoring station, regardless of how costly its analyzers are, is fundamentally flawed without an autonomous recovery mechanism following cellular dropouts. When telecom carriers perform base station maintenance or industrial fiber lines are severed, the datalogger must transition seamlessly into Autonomous Mode.

+-----------------------------------------------------------------------------------+
| STORE-AND-FORWARD EXECUTION FLOW ON DL-ENV10 DATALOGGER |
+-----------------------------------------------------------------------------------+
| [Poll Modbus / 4-20mA Sensors] ---> [Generate TT10-compliant .txt File] |
| | |
| v |
| [Verify sFTP Handshake] |
| / |
| (Success) (Failure / No Signal) |
| / |
| v v |
| [Push file to DONRE] [Commit to Industrial NOR Flash] |
| [Clear pending queue] [Flag record as PENDING_BACKFILL] |
| | |
| v |
| [4G Cellular Link Restored] |
| | |
| v |
| [Sequential Chronological Backfill] <+ |
| (Throttled at 2-sec intervals to prevent server congestion) |
+-----------------------------------------------------------------------------------+

On DeviceLab's DL-ENV10 series datalogger, 32MB of onboard industrial NOR Flash delivers local buffering capacity for over 180 continuous days (equivalent to ~52,000 .txt records). The device employs the power-safe LittleFS embedded file system, featuring wear leveling and dynamic copy-on-write architecture to guarantee absolute data integrity even during sudden blackout events mid-write.

Python Test Script Simulating TT10 sFTP Client Transmission

To assist commissioning engineers in validating connectivity from their engineering workstations prior to field deployment, the following Python script leverages the paramiko library to format and dispatch sample test packets to the DONRE receiving endpoint:

import paramiko
import datetime
import os

STATION_CODE = "NT_KCN_VSIP1_01"
SFTP_HOST = "sftp.sotnmt.binhduong.gov.vn"
SFTP_PORT = 22
SFTP_USER = "kcn_vsip1_user"
SFTP_PASS = "SecretPass2026@"
REMOTE_DIR = "/data_receive/"

# 1. Format timestamped filename: YYYYMMDD_HHmmss.txt
now = datetime.datetime.now()
filename = f"{STATION_CODE}_{now.strftime('%Y%m%d_%H%M%S')}.txt"

# 2. Construct Tab-delimited body payload
header = "Station_IDtDateTimetpHtTSStCODtNH4tTemptFlowtStatusn"
data_line = f"{STATION_CODE}t{now.strftime('%Y-%m-%d %H:%M:%S')}t7.42t25.1t41.8t1.85t30.2t115.4t00n"

with open(filename, "w", encoding="ascii") as f:
f.write(header)
f.write(data_line)

# 3. Establish secure sFTP session over port 22
try:
transport = paramiko.Transport((SFTP_HOST, SFTP_PORT))
transport.connect(username=SFTP_USER, password=SFTP_PASS)
sftp = paramiko.SFTPClient.from_transport(transport)

remote_path = os.path.join(REMOTE_DIR, filename)
sftp.put(filename, remote_path)
print(f"Successfully transmitted record: {filename}")

sftp.close()
transport.close()
os.remove(filename) # Clean up local cache upon successful transmission
except Exception as e:
print(f"sFTP dispatch error: {e}. Initiating local Flash buffering routine!")

Pre-Commissioning Checklist Before Formal DONRE Station Handover

Before issuing an official invitation for provincial DONRE inspection delegations to verify station compliance, field engineers must methodically audit the following 6 technical criteria:

Pre-Commissioning SOP Technical Checklist:

  1. [ ] NTP Time Synchronization: Time skew between the Datalogger internal RTC and the DONRE reference NTP server must not exceed ±30 seconds.
  2. [ ] Mains Blackout Simulation: Trip the primary 220VAC breaker; verify that the onboard backup lithium UPS maintains continuous operation for a minimum of 4 hours while transmitting a power failure alarm event.
  3. [ ] Cellular Network Dropout Test: Disconnect the 4G antenna for 30 minutes (equivalent to 6 transmission cycles), then reattach; verify that the datalogger backfills all 6 missing files in strict chronological sequence.
  4. [ ] Automated Sampler Trigger Verification: Simulate an elevated COD or TSS threshold condition via analog/Modbus inputs; confirm the datalogger DO relay contacts pulse to actuate the refrigerated sampler into drawing reference retention aliquots.
  5. [ ] File Formatting Inspection: Download transmitted files directly from the DONRE server and inspect in Notepad++; ensure absolute absence of UTF-8 BOM bytes and verify that all column dividers are ASCII Tab characters.
  6. [ ] Outfall CCTV RTSP Stream: Validate that the IP camera stream targeting the discharge weir and sampler intake is stably streaming over RTSP to the provincial monitoring console.
Cable tray system isolating instrumentation wiring from high-voltage motor cables
Figure 3: Industrial cable tray infrastructure segregating high-voltage pump power lines from low-level sensor instrumentation wiring to eliminate electromagnetic interference.
Dedicated Hardware for Circular 10

DeviceLab DL-ENV10 Environmental Datalogger

Engineered with an ARM Cortex-M4 running deterministic FreeRTOS. Zero Windows OS vulnerabilities, zero virus vulnerabilities, onboard 6-8 hour lithium UPS, dual 2.5kV optically isolated RS485 ports, and industrial 4G module for secure sFTP telemetry.

  • Native plug-and-play drivers for Hach, Endress+Hauser, Yokogawa, WTW, and Meinsberger analyzers.
  • Full OEM white-label branding support for system integrators and EPC tenders.
Explore DL-ENV10 Hardware →

Technical Hotline: (+84) 982.503.355

About the author

Written by

✓ E-E-A-T Verified Engineer

Thao Dinh – Lead Embedded Systems Engineer

Lead Embedded Systems & Hardware R&D, DeviceLab

🎓 Kỹ sư Điện tử - Viễn thông (ĐHBK Hà Nội) · 12+ năm R&D Phần cứng Nhúng & IoT

Technical Review

DeviceLab Engineering Team

Peer-reviewed for circuit schematic topology, bus signal integrity, and compliance standards (QCVN / TT10 BTNMT).

Last updated: 17/10/2026

Specialization: Hardware · PCB · Embedded · Prototype

View DeviceLab engineered projects & case studies →

Related Technical Articles & Engineering Guides

Deepen your engineering knowledge with practical guides from DeviceLab engineers:

Recommended Industrial IoT Hardware & OEM Solutions

Standardized industrial-grade devices engineered and mass-produced by DeviceLab Vietnam:

ĐIỀU 39 TT10 · FTPS 5 PHÚT DL-ENV10: datalogger quan trắc môi trường thông tư 10 Đạt chuẩn quy chuẩn datalogger điều 39 thông tư 10, lưu đệm Flash > 180 ngày, pin UPS 6–8h. CÁCH LY 3.0kV · DIN-RAIL DL-RS485: RS485 sang Ethernet Chuyển đổi Modbus RTU sang Modbus TCP, chống nhiễu biến tần 24/7. MQTT · CLOUD API · 4G DL-GW200: Industrial IoT Gateway Thu thập Modbus RS485 đẩy MQTT/API, bộ nhớ đệm Flash 100k bản ghi. 4 CỔNG RS485 · THÔNG TƯ 10 DL-GW400: Edge Gateway & Datalogger Bộ tập trung 4 cổng RS485 độc lập cho quan trắc môi trường và năng lượng.
Explore Solutions: Custom PCB & Circuit Design • PCBA & SMT Assembly • Embedded Firmware Engineering • Turnkey IoT Device R&D • Circular 10 Environmental Datalogger • Machinery IoT Modules • OEM Gateways for SIs • Factory Energy Telemetry • White-Label IoT Platform • Batch Manufacturing & QC • Hardware R&D Partner • Why DeviceLab

Need custom Industrial IoT gateways or telemetry hardware?

Describe your field machinery, PLC signals, and required data streams. DeviceLab will determine the right path: COTS, Hybrid, or custom gateway development.

Submit Project Requirements

Start from PoC scope and architecture — no need to lock gateway models beforehand.