博文

目前显示的是标签为“remote computer”的博文

How to transmit and receive raw data from a microcontroller to a remote computer?

图片
 Here’s a practical, no-fluff roadmap for sending raw bytes between a microcontroller and a remote computer (over the internet). 1) Pick your transport Direct IP from the MCU: MCU with Ethernet/Wi-Fi (e.g., ESP32, W5500, NINA) → TCP or UDP sockets to a public server. Via a gateway: MCU talks UART/USB to a Raspberry Pi (or similar), and the Pi forwards data over TCP/UDP/SSH/VPN. Cellular/LPWAN: Use LTE-M/NB-IoT modem (PPP/AT or built-in sockets). Same socket idea, just different link. Tip: Inbound connections to a device behind NAT are painful. Easiest: host a public server (cloud VM) and have the MCU dial out to it. 2) Frame your “raw” bytes Raw ≠ structureless. Use a tiny frame so both sides can parse: [0xAA 0x55] [LEN(2B)] [PAYLOAD (LEN bytes)] [CRC16(2B)] Or simpler: [LEN][PAYLOAD] . If you stream without length, at least add a delimiter (e.g., '\n') and escape it when it appears in data. 3) Reliability & security TCP gives ordered...