Recommend this page to a friend! |
Classes of Marco Sillano | Arduino PHP Serial Linux | README.md | Download |
|
DownloadArduinoLinuxSerialThis is an helper class for php-Arduino communications on Linux After a week of googling and tests, i build this Class to communicate from php running on Linux (master) to an Arduino board via serial USB. The master message max length is 60 char (serial Arduino rx buffer limit), the response (from Arduino) as no limits. The '\n' char is used internally as terminator. The protocol uses CRC8 to insure correctness. In case of error the message is resended 3 times before exit in error state. A Bash script (serialArduino.sh) is used to setup the USB device on Linux, after startup or USB connection. The serial communication is open for every message: in the Bash script the DTR pin is disabled to avoid the Arduino auto reset. (see: https://playground.arduino.cc/Main/DisablingAutoResetOnSerialConnection) TROUBLESHOOTING - ERROR LCRC: bad CRC Linux -> Arduino - ERROR ACRC: bad CRC Arduino -> Linux - ERROR CODE: sended a command code not implemented in Arduino - ERROR SERIAL: USB not plugged, Arduino not running or php fail in open the serial device.
SETUP see ArduinoLinuxSerial.php file. CONCLUSIONS
## see also I am very interested in using TVboxes (like MXQ) as dedicated WEB servers with Arduino extensions: so about (Linux + Android)-Arduino USB serial communication I tested many solutions:
|