linuxatmelphp-socket

PHP Socket programming to read data from MCU


Quick question, I am new to socket, so I was wondering is there a way to read data from a MCU (Atmel)? I'm running a Linux and I can connect an Atmel through RS232, or USB to my computer(server). Is there a way that I can directly read the data that is coming from MCU (USB/COM) to my computer and process them?


Solution

  • Sockets are a concept of network communication (IP), so you would need network interfaces on both devices, plus an IP protocol stack on your Atmel (which may be the case for larger boards running a real operating system, e.g. embedded Linux).

    If your Atmel has an USB interface, and if it implements a USB storage device, you can probably mount the Atmel to your server.

    Otherwise (i.e. with a bare naked processor + peripherals, but no O/S) you really need to architect a solution from scratch - then a serial interface using the Atmel's UART function would be quickest to implement.

    On the (Unix/Linux) server side you simply can use a character device to read in the data from serial or USB - e.g. cat < /dev/ttySxx >> SerPort.txt