Il SMEL-BPI-6204-485-BRIDGE è un gateway industriale basato sulla piattaforma BananaPi BPI-6202/6204, progettato da SM Electronics per acquisizione dati, bridge Modbus RTU/TCP e accesso remoto a dispositivi seriali.
Basato sul SoC Rockchip RK3568 (quad-core ARM Cortex-A55 @ 2.0 GHz, GPU Mali-G52, NPU 0.8 TOPS), con 4 porte RS485, 1 RS232, doppia Ethernet Gigabit, VPN IKEv2, e pannello web integrato. Fanless, guida DIN, DC 12-48V, -20°C ~ +70°C.
| Processore | |
|---|---|
| SoC | Rockchip RK3568, Quad-core Cortex-A55 @ 2.0 GHz |
| GPU | Mali-G52 |
| RAM | 2 GB DDR4 |
| Storage | 16 GB eMMC + MicroSD |
| Connettività | |
|---|---|
| Ethernet | 2× Gigabit (eth0: WAN, eth1: LAN) |
| RS485 | 4× half-duplex, isolate, morsettiera |
| RS232 | 1× full-duplex (TX/RX/GND) |
| USB | 1× USB 3.0 + 1× USB 2.0 |
| Alimentazione e ambiente | |
|---|---|
| Tensione | DC 12–48V |
| Consumo | ≤ 10W |
| Temperatura | -20°C ~ +70°C |
| Montaggio | Guida DIN 35mm / parete |








| Etichetta | Tipo | Device | Pinout |
|---|---|---|---|
| RS485-1 | RS485 | /dev/ttyS2 | A+ / B− / GND |
| RS485-2 | RS485 | /dev/ttyS1 | A+ / B− / GND |
| RS485-3 | RS485 | /dev/ttyS3 | A+ / B− / GND |
| RS485-4 | RS485 | /dev/ttyS4 | A+ / B− / GND |
| RS232 | RS232 | /dev/ttyS0 | TX / RX / GND |
In modalità bridge il gateway collega un datalogger/master RTU ai dispositivi slave RTU, permettendo accesso TCP simultaneo da SCADA/HMI.
TX del gateway → RX del dispositivo e viceversa. GND sempre collegato. Distanza max 15m.
Due uscite GPIO a 3,3 V del connettore interno CON10 (2×10) comandano un modulo relè esterno, acceso o spento oppure a impulso dal server di monitoraggio (scheda Bottoni, collegamento “MQTT” o “API gateway SMEL-BPI”). Usare un modulo relè con ingresso optoisolato pilotabile a 3,3 V: le uscite non sono isolate e non reggono la bobina di un relè.
| CON10 | Segnale | Collegamento |
|---|---|---|
| pin 12 | PG6 = GPIO 198 | IN1 del modulo (relè 1) |
| pin 9 | PG7 = GPIO 199 | IN2 del modulo (relè 2) |
| pin 17 / 18 | GND | GND del modulo (lato ingressi) |
Sul connettore non ci sono 5 V (i pin 19/20 sono ACIN, i pin 1–4 portano i 24 V: non usarli): alimentare il modulo a parte. Il pin 1 è quello segnato sulla serigrafia; i dispari stanno su una fila, i pari sull'altra.
Le GPIO comandabili sono quelle di RELAYS in gateway.conf (/etc/default/em-relays); all'avvio partono spente oppure, con RELAYS_RESTORE=yes, tornano com'erano prima del riavvio (un impulso non riparte). Per i moduli attivi a livello basso impostare RELAYS_ACTIVE_LOW=yes. I comandi arrivano via MQTT dal server attraverso il broker locale, oppure via HTTP dall'API contatori (porta 5000, token dell'impianto); in entrambi i casi li esegue l'API contatori, che deve essere installata. Un comando arrivato con più di 60 secondi di ritardo (gateway scollegato) viene scartato.
Collegare DC 12-48V ai morsetti V+/V−. Protezione inversione polarità inclusa.
Il software si installa in un solo passaggio dal repository del sistema di monitoraggio (cartelle gateway/, gateway_setup/, gateway_api/): copiare gateway/gateway.conf.example in gateway.conf, compilarlo (hostname, password del pannello, VPN, indirizzo del server di monitoraggio, modalità delle porte, CCI) ed eseguire sudo gateway/install.sh -c gateway.conf. Lo script installa pacchetti, mbusd, servizi, pannello, Telegraf con il broker locale (tiene in coda le letture quando il server non è raggiungibile), API contatori, VPN e salva lo snapshot di fabbrica. A fine installazione mostra seriale e codice di abbinamento del gateway (vedi sez. 10). Si può rilanciare; la modalità di rete non viene cambiata.
http://<IP-DISPOSITIVO>

| Campo | Default |
|---|---|
| Username | admin |
| Password | admin (o quella di gateway.conf) |
Hostname, machine-id, device-id e chiavi SSH del dispositivo. Dopo aver installato la stessa immagine su più dispositivi, per ciascuno: impostare un hostname univoco, rigenerare machine-id, device-id e chiavi SSH, poi riavviare.


| Modalità | Funzionamento |
|---|---|
| Bridge | eth0 ed eth1 unite nel bridge br0 (L2): il gateway è un nodo della rete d'impianto, IP in DHCP o statico. |
| Router (default di fabbrica) | eth1 = WAN (DHCP o statico), eth0 = LAN 192.168.10.1/24 con NAT e server DHCP (dnsmasq) per i dispositivi d'impianto. |
Le porte formano due coppie: RS485-1 ↔ RS485-3 e RS485-2 ↔ RS485-4. Il CCI (Controllore Centrale d'Impianto, delibera ARERA 385/2025) si collega in Modbus TCP: sulle porte in monitoraggio alla porta 500 + N della seriale ttySN (501…504), nel bridge alla 503 (coppia 1/3) o 504 (coppia 2/4). Il CCI ha sempre la priorità sul bus. Su ogni coppia si indica se il CCI è collegato (di solito una sola coppia).
| Modalità | Servizio | Descrizione |
|---|---|---|
| Bridge | socat + proxy CCI | Datalogger esterno sulla porta 1/2 collegato direttamente agli inverter della porta 3/4. Quando il CCI si collega il bridge si ferma e il bus passa al CCI; riparte dopo il tempo di rilascio. |
| Monitoraggio | proxy CCI | Come per le porte 3 e 4 (sez. 8.2), sulla propria seriale: Telegraf su 127.0.0.1:1502 (porta 1) o 1501 (porta 2), CCI su TCP 502 o 501. |
| Slave | mbusd | Server Modbus TCP sulla seriale |
| Raw TCP | socat | Passthrough trasparente TCP ↔ seriale |
| Contatore | API contatori | Porta libera per la lettura DLMS/IEC dei contatori fiscali da parte del server (vedi sez. 10) |
| BMS Seplos | mbusd | Porta dedicata alle batterie con BMS Seplos V3 (su qualsiasi RS485, una sola per gateway, mai attiva di default): 19200 8N1 fissi, letta dal monitoraggio su 127.0.0.1:502x e inviata al server via MQTT; il server può anche scrivere i parametri del BMS. Sul bus della porta il CCI viene disattivato e il bridge non è disponibile. Sulla porta vanno solo i BMS Seplos. |
| Off | — | Nessun servizio: la porta può essere letta direttamente da Telegraf |

| Modalità | Servizio | Descrizione |
|---|---|---|
| Monitoraggio | proxy CCI | Gli inverter vengono letti dal nostro sistema di monitoraggio (Telegraf) tramite la porta locale 127.0.0.1:1503 (o 1504), a bassa priorità: Telegraf non apre mai la seriale. Con la spunta Priorità CCI il CCI si collega su TCP 503 (o 504): a ogni sua richiesta Telegraf riceve "occupato" (eccezione Modbus 06) e salta la lettura, fino a 30 secondi (tempo di rilascio) dopo l'ultima richiesta del CCI. Il CCI aspetta al massimo la fine della singola lettura di Telegraf già in corso. |
| Slave / Raw TCP / BMS Seplos / Off | mbusd / socat / mbusd / — | Come per le porte 1 e 2 |
Con la porta 1 (o 2) in Bridge, la porta 3 (o 4) è gestita dal bridge e non si può cambiare: datalogger esterno e monitoraggio non condividono mai la stessa coppia.

Baudrate e modo (es. 8N1, 8E1) devono coincidere con quelli dei dispositivi sulla linea. Salvando i parametri il servizio attivo viene riavviato.
| Porta | mbusd | socat | CCI | Monitoraggio (locale) |
|---|---|---|---|---|
| RS485-1 (ttyS2) | 5021 | 5001 | 502 (monitoraggio) · 503 (bridge) | 127.0.0.1:1502 |
| RS485-2 (ttyS1) | 5022 | 5002 | 501 (monitoraggio) · 504 (bridge) | 127.0.0.1:1501 |
| RS485-3 (ttyS3) | 5023 | 5003 | 503 | 127.0.0.1:1503 |
| RS485-4 (ttyS4) | 5024 | 5004 | 504 | 127.0.0.1:1504 |

La porta RS232 (/dev/ttyS0) funziona in raw TCP tramite socat (default 9600 8N1, porta TCP 5005; la 5000 è dell'API contatori). Per collegarvi un contatore fermare il servizio con ■ Ferma: la porta resta libera per l'API contatori.
Il tab Monitoraggio collega il gateway al server di monitoraggio.
Il gateway si registra da solo sul server indicato in Indirizzo del server (via VPN) e mostra seriale e codice di abbinamento (8 caratteri, valido 24 ore, rigenerabile). Nella scheda impianto del server, sezione Abbinamento gateway, scegliere il seriale tra i gateway in attesa e inserire il codice. Entro 5 minuti (o subito con Sincronizza ora) il gateway riceve credenziali MQTT, token API contatori e configurazione di Telegraf, cifrati con una chiave che esiste solo su questo dispositivo, e li riceve di nuovo a ogni modifica fatta sul server. Con il gateway abbinato il bundle e il token manuale sono disattivati.

Dopo l'abbinamento la scheda mostra l'impianto, l'ultimo contatto e l'ultimo aggiornamento della configurazione; il codice non serve più.

.tar.gz) e caricarlo qui. Vengono installati telegraf.conf, il certificato del broker, le credenziali MQTT ed eventualmente meter-api.env; Telegraf e il broker locale vengono riavviati.127.0.0.1:1503/1504 per le porte in Monitoraggio, porta seriale /dev/ttySx per contatori e porte libere.Dalla stessa scheda si avviano, fermano e riavviano Telegraf e l'API contatori e si vedono le ultime righe del log di Telegraf.

Connessione IPsec (strongSwan) verso il server VPN, per l'accesso remoto e l'invio dei dati.

| Campo | Significato |
|---|---|
| Left ID | Identità di questo dispositivo, come configurata sul server VPN |
| Right ID | Identità del server VPN |
| Indirizzo server | Hostname o IP del server VPN |
| Username / Password EAP | Credenziali assegnate dall'amministratore della VPN (password vuota = invariata) |
Caricare il certificato CA (.pem) fornito dall'amministratore e, dopo ogni modifica, cliccare ⟳ Riavvia. Il servizio vpncheck controlla ogni 5 minuti che il server VPN risponda e, se non risponde, riavvia strongSwan.
Nella scheda Inoltro porte si rende raggiungibile dalla VPN un dispositivo della rete locale (es. la pagina web di un inverter o di un datalogger): chi si collega all'indirizzo VPN del gateway sulla porta scelta arriva all'IP e alla porta del dispositivo. Solo TCP; dalla rete locale le porte non sono esposte.
| Campo | Significato |
|---|---|
| Porta del gateway (VPN) | Tra 1024 e 65535, libera e non usata dal gateway (CCI 503/504, monitor 1503/1504, mbusd 502x, API contatori 5000, MQTT) |
| IP del dispositivo | Indirizzo IPv4 privato della rete locale (non il gateway) |
| Porta del dispositivo | Es. 80 per la pagina web, 502 per Modbus TCP |
Ogni regola è un servizio em-port-forward@<porta>: si può attivare, disattivare, eliminare e provare (Prova verifica che il dispositivo risponda). Senza VPN la regola resta in attesa e si attiva appena il gateway ha l'indirizzo VPN; se l'indirizzo cambia, il servizio riparte da solo. Esempio: porta 8000 → 192.168.10.98:80, poi dal PC in VPN http://<indirizzo VPN del gateway>:8000/.

Un solo account, admin. La password (minimo 8 caratteri) è salvata con PBKDF2. La sessione dura 8 ore e sopravvive al riavvio del pannello; Esci e il cambio password chiudono tutte le sessioni aperte.
Password dimenticata: via SSH sudo python3 /opt/bpi-config/app.py set-password <nuova>, oppure sudo rm /opt/bpi-config/credentials.json && sudo systemctl restart bpi-config per tornare ad admin/admin.

.zip con update.sh; lo script viene eseguito e il log è consultabile.admin/admin) e riavvia. Si attiva anche tenendo premuto il tasto KEY per 10 secondi (GPIO 227 = PH3, con RESET_GPIO in gateway.conf; per ora disattivato: vuoto di default).| Problema | Soluzione |
|---|---|
| Pannello non accessibile | Attendere 60s, verificare rete, provare entrambe le ETH (router: 192.168.10.1 su eth0) |
| Password dimenticata | Reset via SSH (sez. 12) |
| VPN sempre inattiva | Caricare CA cert, verificare credenziali, riavviare |
| Nessuna comunicazione Modbus | Verificare baudrate, modo, cablaggio A+/B− |
| Buchi nei dati di monitoraggio | Normali durante le sessioni del CCI (priorità al CCI). Log: journalctl -u socat-modbus-proxy@ttyS3 |
| Telegraf non invia dati | Tab Monitoraggio: bundle installato, servizio attivo, log |
| Il server non legge il contatore | Porta in modalità Contatore, token uguale a quello del server, API attiva |
The SMEL-BPI-6204-485-BRIDGE is an industrial gateway by SM Electronics. Rockchip RK3568 SoC, 4 RS485, 1 RS232, dual GbE, IKEv2 VPN, web panel. Fanless, DIN rail, DC 12-48V, -20°C to +70°C.
| Processor | |
|---|---|
| SoC | Rockchip RK3568, Quad-core Cortex-A55 @ 2.0 GHz |
| RAM | 2 GB DDR4 |
| Storage | 16 GB eMMC + MicroSD |
| Connectivity | |
|---|---|
| Ethernet | 2× Gigabit |
| RS485 | 4× half-duplex, isolated |
| RS232 | 1× full-duplex |
| USB | 1× USB 3.0 + 1× USB 2.0 |
| Power | |
|---|---|
| Voltage | DC 12–48V |
| Temperature | -20°C to +70°C |
| Mounting | DIN rail / wall |





| Label | Type | Device | Pinout |
|---|---|---|---|
| RS485-1 | RS485 | /dev/ttyS2 | A+ / B− / GND |
| RS485-2 | RS485 | /dev/ttyS1 | A+ / B− / GND |
| RS485-3 | RS485 | /dev/ttyS3 | A+ / B− / GND |
| RS485-4 | RS485 | /dev/ttyS4 | A+ / B− / GND |
| RS232 | RS232 | /dev/ttyS0 | TX / RX / GND |
Two 3.3 V GPIO outputs on the internal connector CON10 (2×10) drive an external relay module, on/off or pulse, from the monitoring server (Buttons, connection “MQTT” or “SMEL-BPI gateway API”). Use a relay module with an opto-isolated input that works at 3.3 V: the outputs are not isolated and cannot drive a relay coil.
| CON10 | Signal | Connect to |
|---|---|---|
| pin 12 | PG6 = GPIO 198 | module IN1 (relay 1) |
| pin 9 | PG7 = GPIO 199 | module IN2 (relay 2) |
| pin 17 / 18 | GND | module GND (input side) |
There is no 5 V on the connector (pins 19/20 are ACIN, pins 1–4 carry 24 V: do not use them): power the module separately. Pin 1 is the one marked on the silkscreen; odd pins are on one row, even pins on the other.
Only the GPIOs in RELAYS (gateway.conf, /etc/default/em-relays) can be driven; they start off at boot or, with RELAYS_RESTORE=yes, go back to their state before the reboot (a pulse does not restart). Set RELAYS_ACTIVE_LOW=yes for active-low modules. Commands come from the server over MQTT through the local broker, or over HTTP through the meter API (port 5000, plant token); the meter API runs them either way and must be installed. A command arriving more than 60 seconds late (gateway offline) is discarded.
Connect 12-48V DC and wait 60s. Software: fill gateway/gateway.conf.example as gateway.conf and run sudo gateway/install.sh -c gateway.conf (packages, mbusd, services, panel, Telegraf with the local broker that queues readings while the server is unreachable, meter API, VPN, factory snapshot). Re-runnable; the network mode is not changed.
http://<DEVICE-IP> — Default: admin/admin. Change password on first login. 5 failed attempts lock login for 5 minutes.
View/change hostname, machine-id, device-id, SSH keys. Regenerate after cloning.
Bridge (eth0+eth1 in br0, DHCP or static) or Router (eth1 WAN, eth0 LAN 192.168.10.1/24 with NAT and DHCP server — factory default).
Pairs: RS485-1 ↔ RS485-3 and RS485-2 ↔ RS485-4. Ports 3/4 are the inverter side, where the plant controller (CCI, ARERA 385/2025) connects via Modbus TCP on 503 (pair 1/3) or 504 (pair 2/4). The CCI always has priority; enable it on the pair(s) it uses.
| Mode | Ports | Description |
|---|---|---|
| Bridge | 1/2 | External datalogger on port 1/2 bridged to inverters on 3/4; the CCI pre-empts the bridge |
| Monitor | 3/4 | Our Telegraf reads via 127.0.0.1:1503/1504 at low priority; "busy" (exception 06) while the CCI is active |
| Meter | 1/2 | Port reserved to the DLMS/IEC meter API |
| BMS Seplos | any (one per gateway) | Dedicated port for Seplos V3 BMS, never on by default: mbusd at 19200 8N1 on 127.0.0.1:502x, read by Telegraf and sent over MQTT; CCI and bridge are disabled on that bus |
| Slave / Raw TCP / Off | all | mbusd (502x) / socat (500x) / disabled |
/dev/ttyS0, raw TCP via socat. Default: 9600, 8N1, port 5005. Stop it to use the port for a meter.
Automatic pairing (recommended): the gateway registers itself on the server (set Server address, reachable through the VPN) and shows its serial and an 8-character pairing code (valid 24 h). In the plant page on the server (section Abbinamento gateway) pick the serial and enter the code: MQTT credentials, meter API token and Telegraf configuration then arrive automatically, encrypted for this device only, and are updated after every change on the server.
Without pairing: upload the gateway bundle (.tar.gz) from the server admin and paste the meter API token generated here into the plant page on the server. The tab also shows per-port hints and the Telegraf log.

| Field | Meaning |
|---|---|
| Left ID | Device identity |
| Right ID | VPN server identity |
| Server address | VPN hostname/IP |
| EAP credentials | Username + password |
Upload CA cert (.pem), then restart. vpncheck restarts strongSwan if the server stops answering.
The Inoltro porte tab makes a LAN device reachable from the VPN (e.g. an inverter's web page): connecting to the gateway's VPN address on the chosen port reaches the device's IP and port. TCP only; the ports are not exposed on the LAN. Gateway port 1024–65535, free and not used by the gateway; device IP must be a private LAN address. Each rule is an em-port-forward@<port> service (enable, disable, delete, test); without VPN it waits and starts as soon as the VPN address exists.
Change password (min 8 chars, stored with PBKDF2). Logout and password change close all sessions. Reset: sudo python3 /opt/bpi-config/app.py set-password <new>
Update (.zip with update.sh), reboot, factory reset (also the KEY button held 10s: GPIO 227 = PH3, RESET_GPIO in gateway.conf; disabled for now: empty by default).
| Issue | Solution |
|---|---|
| Can't access panel | Wait 60s, check network, try both ETH |
| VPN inactive | Check CA cert, credentials, restart |
| No Modbus data | Check baudrate, mode, A+/B− |
| Monitoring gaps | Expected during CCI sessions |