🛠 Interfacing Industrial Peripherals on the MS-U320

BIOSTAR EdgeComp MS-U320: Fanless Intel Wildcat Lake Industrial Mini PC · avance · Configurez les ports série et GPIO pour connecter des capteurs et afficheurs via Linux sur le EdgeComp MS-U320.

Objectives

This advanced tutorial aims to master the input/output interfaces of the BIOSTAR EdgeComp MS-U320. Unlike standard development boards, this industrial mini PC does not expose physical GPIO pins directly on the PCB. The goal is to leverage the four COM ports (RS232/422/485) to communicate with PLCs, industrial sensors, or serial displays. We will learn to configure line parameters (baudrate, parity) and send commands via Python scripts under Ubuntu 24.04.

Required Hardware

Steps

Connect via SSH. Physical COM ports are typically mapped to /dev/ttyS0 to /dev/ttyS3. Verify their presence: ``bash ls -l /dev/ttyS* `` If ports do not appear, install specific BIOSTAR drivers for the virtual or physical serial chipset.

  1. Identify Serial Ports

By default, only root can access serial ports. Add your user to the dialout group: ``bash sudo usermod -aG dialout $USER `` Log out and log back in to apply changes.

  1. Configure Permissions

Install pyserial to handle serial ports in Python: ``bash sudo apt update sudo apt install python3-pip pip3 install pyserial ``

  1. Install Communication Libraries

Create a send_data.py file to send a command to a device connected to COM1 (/dev/ttyS0). Example for a simple display or sensor: ```python import serial import time

  1. Data Transmission Script

# Serial port configuration (standard RS232) ser = serial.Serial( port='/dev/ttyS0', baudrate=9600, bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, timeout=1 )

if ser.is_open: print("Serial port opened") # Send ASCII command (e.g., display 'Hello Industrial') command = b"Hello Industrial\r\n" ser.write(command)

# Read response if device sends data time.sleep(0.5) if ser.in_waiting > 0: response = ser.read(ser.in_waiting) print(f"Response: {response.decode('utf-8', errors='ignore')}")

ser.close() else: print("Cannot open port") ```

Run the script: ``bash python3 send_data.py `` Observe the communication. For RS485, ensure the converter is in Half-Duplex mode if necessary.

  1. Execution and Test

Verification

The script should run without permission errors. If the device responds, the "Response:" message appears in the terminal. If it fails, check the wiring (TX/RX crossed for RS232) and the baudrate matching the device's setting.

Further Reading

Explore the Modbus RTU protocol on serial ports to communicate with Programmable Logic Controllers (PLCs). Use the pymodbus library to read sensor registers. Note that the lack of native GPIO requires using I/O modules connected via USB or serial ports for relay or LED control.

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials