ArduinoLinuxSerial
1.0.0
這是用於Linux上PHP-Arduino通信的助手課程
經過一周的谷歌搜索和測試後,我構建了此類課程,可以通過串行USB在Linux(Master)上運行的PHP通信到Arduino董事會。
主消息最大長度為60個字符(串行Arduino RX緩衝區限制),響應(來自Arduino)是沒有限制的。 “ n” char在內部用作終結者。該協議使用CRC8確保正確性。如果出錯,則在以錯誤狀態退出之前將消息延遲3次。
Bash腳本(SerialArduino.SH)用於在Linux上,啟動或USB(RE)連接後設置USB設備。每條消息都打開了串行通信:在BASH腳本中,DTR PIN被禁用,以避免Arduino自動重置。 (請參閱:https://playground.arduino.cc/main/disablingautoresetonserialconnection)
故障排除
設定
請參閱arduinolinuxserial.php文件。
結論
Now you can develop MySQL and web enabled Arduino applications only working on Arduino and PHP.
To keep ligth the Arduino Sketch, you can port all not realtime logic to PHP side.
At the end your application will works on MXQ+Arduino UNO even 24/7 with only 20 Watt AC power, and can
be controlled by smartphone via WiFi.
What more?
Enjoy.
我對使用TVBoxes(例如MXQ)作為具有Arduino擴展名的專用Web服務器非常感興趣:So Airo(Linux + Android)-Arduino USB序列通信我測試了許多解決方案:
Using ArduinoLinuxSerial (https://github.com/msillano/ArduinoLinuxSerial) the Master is php, and you need the
serial driver (uses devices like /dev/ACMx or /dev/USBx). It is blocking the master and the php->Arduino message
is limited to 60 char. Fast and robust (CRC and repetions). Useful with simple and fast Arduino responses.
Using USBphpTunnel (https://github.com/msillano/USBphpTunnel) the master is Arduino, and the Android app uses
ports like /dev/bus/dev/00X/00Y, so you don't need the serial driver. It is blocking the master (arduino) and
it allows big messages. It works in background of the main php program. Useful for data logging and RT.
Using USBphpTunnel_Fifo (https://github.com/msillano/USBphpTunnel_fifo) the master is php. It is NOT blocking the
master, allows payload up to 4k, allows concurrence (many users via WIFI). Works in background, and it is no fast
(depending from polling Arduno frequence, 5-15 sec. plus processing time). Well placed for long Arduino processes
(like waiting user actions).