How to access AT commands from PHP in Rasspberry Pi3?
How to access AT commands from PHP in Rasspberry Pi3?
I've tried from Raspberry Pi3 use minicom command and it works.
SIM module is SIM7600CE.
Just could not execute that command from PHP.
<?php
include '../src/PhpSerial.php';
$serial = new PhpSerial;
$serial->deviceSet("/dev/ttyUSB2");
$serial->confBaudRate(115200);
$serial->confParity("none");
$serial->confCharacterLength(8);
$serial->confStopBits(1);
$serial->confFlowControl("none");
$serial->deviceOpen();
$serial->sendMessage('AT+CMGF=1');
$serial->sendMessage(chr(13));
$serial->sendMessage('AT+CMGS="09xxxxxxxx"');
$serial->sendMessage(chr(13));
$serial->sendMessage("THIS IS TEST");
$serial->sendMessage(chr(26));
sleep(6);
$read = $serial->readPort();
echo $read;
$serial->deviceClose();
The code will return very strange words
AT+CMGF=1AT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+
CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+
CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT+CAT ERROR AT+CMGS="09xxxxxxxx"AT+CMGS="09AT+CMGS="09AT+CMGS="09AT+CMGS="09AT+CMGS="09 AT+CMGS="09AT+CMGS="09AT+CMGS="09AT+CMGS="09AT+CMGS="09AT+CMGS="09AT+CMGS="09
AT+CMGS="09AT+CMGS="09AT+CMGS="09AT+CMGS="09AT+CMGS="09AT+CMGS="09AT+CMGS="09
AT+CMGS="09AT+CMGS="09AT+CMGS="09AT+CMGS="09AT+CMGS="09AT+CMGS="09AT+CMGS="09
AT+CMGS="09AT+CMGS="09AT+CMGS="09AT+CMGS="09AT+CMGS="09AT+CMGS="09AT+CMGS="09AT
+CMGS"09AT+CMGS"09AT+CMGS"09AT+CMGS"09AT+CMGS"09AT+CMGS"09AT+CMGS"09AT+CMGS"09AT
+CMGS"09AT+CMGS09AT+CMGS09AT+CMGS09AT+CMGS09 ERROR AT+CMGS09 ERROR AT+09
ERROR
if I send
$serial->sendMessage("AT+CPSI?" . chr(13));
result will get some info, and still got very strange words
AT OK AT OK AT OK AT OK AT OK AT OK AT OK AT OK AT OK AT OK AT OK AT OK AT OK
AT OK AT OK AT OK AT OK AT OK AT OK AT OK AT OK AT OK AT OK AT OK AT OK AT
OK AT OK AT OK AT OK AT OK AT OK AT OK AT OK AT OK AT OK AT OK AT OK AT OK
AT OK AT OK AT OK AT OK AT OK AT OK AT OK AT OK AT OK AT OK AT OK AT OK AT OK
AT OK AT OK AT OK AT OK AT OK AT OK AT OK AT OK AT OK AT+CPSI? +CPSI:
LTE,Online,466-01,0xC185,130679308,485,EUTRAN-
BAND3,1550,5,5,-77,-1035,-759,13 OK AT OK AT+CPSI? +CPSI: LTE,Online,466-
01,0xC185,130679308,485,EUTRAN-BAND3,1550,5,5,-77,-1035,-759,13 OK AT+CPSI?
+CPSI: LTE,Online,466-01,0xC185,130679308,485,EUTRAN-
BAND3,1550,5,5,-77,-1035,-759,13 OK AT+CPSI? +CPSI: LTE,Online,466-
01,0xC185,130679308,485,EUTRAN-BAND3,1550,5,5,-77,-1035,-759,13 OK
How can this be done?
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.