sms_gateway
Table of Contents
PC Engines APU - SMS Gateway
Documentation
- PC Engines APU1 system board.
- PC Engines APU1c schematics.
- Huawei MU609 miniPCIe Hardware guide.
- Huawei MU609 miniPCIe AT command spec.
- Huawei MU609 miniPCIe Application guide.
Suppliers
- PC Engines APU: Varia Store
- Huawei MU609 miniPCIe: WM Ocean
Prepare hardware
- Install mSATA SSD.
- Install Huawei MU609 miniPCIe. NOTE: Use mPCIe 2 slot, SIM wil not be recognized in slot 1.
- Install U.FL to SMA pigtail.
- Install GSM antenna.
Install and configure CentOS 6.5
Note: i've had a problem with the stock 2.6 kernel and installed 3.14 kernel-ml from elrepo.
- Connect via serial with screen (or minicom).
screen /dev/cu.usbserial-A7022UE0 115200
- Install CentOS 6.5 x86_64, using PXE and Kickstart.
- Configure networking.
- Load EPEL repository.
- Load ELRepo repository.
- Configure hostname, mail relayhost and install k10temp module and lm_sensors: CentOS 6.5 on APU - post install.
- Configure NTPd.
yum install ntp # vi /etc/ntp.conf # update servers chkconfig ntpd on ntpdate ntp1.polaire.nl service ntpd start
Configure Huawei MU609 miniPCIe
- Install minicom.
yum install minicom
- Check to see if device is recognized.
# dmesg |grep -i huawei usb 1-2: Product: HUAWEI Mobile usb 1-2: Manufacturer: Huawei Technologies dmesg |grep CDC cdc_ether 2-1:2.0 eth3: register 'cdc_ether' at usb-0000:00:13.2-1, CDC Ethernet Device, 00:a0:c6:41:37:70
- Determine USB tty's.
# ls /dev |grep -i ttyusb ttyUSB0 ttyUSB1 ttyUSB2 ttyUSB3 ttyUSB4
- ttyUSB0: MODEM port: simulated using USB, for AT command interaction and establishing data connection.
- ttyUSB1: DIAG port: simulated using USB, for DIAG (diagnostic) command interaction (mainly used to debug modules at present).
- ttyUSB2: PCUI port: simulated using USB, for AT command interaction only.
- ttyUSB3: GPS NMEA port: simulated using USB, sending unsolicited indications for NMEA positioning data only.
- ttyUSB4: GPS Control port: simulated using USB, for GPS AT command interaction only.
- eth3: ECM port: for establishing communication connection.
- Connect to the gsm module.
minicom -s
- Go to 'Serial port setup' →
- Serial Device: /dev/ttyUSB2
- Bps/Par/Bits: 115200 8N1
- Go back and then to 'Modem and dialing parameter setup'
- Clear init string and reset string.
- Select 'Save setup as dfl'.
- Select 'Exit'.
- Check SIM.
AT+CREG? +CME ERROR: SIM PIN required
- If you see +CME ERROR: SIM failure check if the SIM card is inserted and the module is in mPCIe 2 slot.
- enter SIM PIN.
AT+CPIN="1234" OK ^SIMST: 1 ^SRVST: 2 AT+CPIN? +CPIN: READY OK
- Check status operator selection. In this case; 0=automatic, 0=long alfanumeric, string, 2=current.
AT+COPS? +COPS: 0,0,"simyo",2 OK
- Check network status. 0=report off, 1=registered
AT+CREG? +CREG: 0,1 OK
- Query signal strength. Good signal strength here: -79 dBm (17 * 2 – 113).
AT+CSQ +CSQ: 17,99 OK
Install and configure SMS Server tools 3
- Install smstools package.
yum install smstools
- Auto-start smsd.
chkconfig smsd on
- Edit /etc/smsd.conf.
[GSM1] device = /dev/ttyUSB2 incoming = yes pin = 1234 # disable unsolicited results (like ^RSSI) init = AT^CURC=0
- View log /var/log/smsd/.
2014-05-30 10:27:23,2, smsd: Smsd v3.1.15 started. 2014-05-30 10:27:23,2, smsd: Running as smstools:smstools. 2014-05-30 10:27:23,7, smsd: Running startup_check (shell): /var/spool/sms/incoming/smsd_script.a7tj8n /tmp/smsd_data.4OfwfP 2014-05-30 10:27:23,7, smsd: Done: startup_check (shell), execution time 0 sec., status: 0 (0) 2014-05-30 10:27:23,4, smsd: File mode creation mask: 022 (0644, rw-r--r--). 2014-05-30 10:27:23,5, smsd: Outgoing file checker has started. PID: 1273. 2014-05-30 10:27:23,7, smsd: All PID's: 1273,1274 2014-05-30 10:27:23,5, GSM1: Modem handler 0 has started. PID: 1274. 2014-05-30 10:27:23,5, GSM1: Using check_memory_method 1: CPMS is used. 2014-05-30 10:27:23,6, GSM1: Checking device for incoming SMS 2014-05-30 10:27:23,6, GSM1: Checking if modem is ready 2014-05-30 10:27:23,7, GSM1: -> AT 2014-05-30 10:27:23,7, GSM1: Command is sent, waiting for the answer 2014-05-30 10:27:23,7, GSM1: <- AT OK 2014-05-30 10:27:23,6, GSM1: Pre-initializing modem 2014-05-30 10:27:24,7, GSM1: -> ATE0+CMEE=1;+CREG=2 2014-05-30 10:27:24,7, GSM1: Command is sent, waiting for the answer 2014-05-30 10:27:24,7, GSM1: <- ATE0+CMEE=1;+CREG=2 OK 2014-05-30 10:27:24,6, GSM1: Checking if modem needs PIN 2014-05-30 10:27:24,7, GSM1: -> AT+CPIN? 2014-05-30 10:27:24,7, GSM1: Command is sent, waiting for the answer 2014-05-30 10:27:24,7, GSM1: <- +CPIN: READY OK 2014-05-30 10:27:25,7, GSM1: -> AT+CSQ ...
- Send test SMS
- switch so smstools user.
su - smstools
- Create a script:
#!/bin/bash OUT=$(mktemp /var/spool/sms/outgoing/sms.XXXXXXXXXX) || { echo "Failed to create temp file"; exit 1; } echo -n "To: 31612345678\n\nHello, this is the sms." >> $OUT
- chmod +x yourscript, and run it… The smsd.log will show:
2014-05-30 10:44:55,6, GSM1: I have to send 1 short message for /var/spool/sms/checked/sms.XNBpdjgPIL 2014-05-30 10:44:55,6, GSM1: Sending SMS from to 31612345678 2014-05-30 10:44:55,6, GSM1: Checking if modem is ready ...
- Reduce logging, edit /etc/smsd.conf and reload.
loglevel = 5 service smsd restart
- Received SMS's wil be placed in /var/spool/sms/incoming.
Example: execute script upon receiving SMS
If you want the APU speaker to beep, see: PC Engines APU - speaker CentOS 6.5 And if you want other users than root to use beep, set the setuid bit.
chmod 4755 /usr/bin/beep
- Create /usr/local/bin/smsevent
#!/bin/sh if [ "$1" == "RECEIVED" ]; then beep -f700 -l100 -d100 -r3 -n -f1 -l300 -n -f700 -l300 -r2 -n -f1 -l300 -n -f700 -l100 -d100 -r3 fi
chmod +x /usr/local/bin/smsevent
- Edit /etc/smsd.conf.
eventhandler = /usr/local/bin/smsevent
- Restart smsd.
service smsd restart
AT Commands
AT Command | Description |
---|---|
AT+CPIN=“1234” | Enter PIN |
AT+CPIN? | Request PIN info |
AT+COPS? | Check status operator selection |
AT+CREG? | Check network status |
AT+CSQ | Query signal strength |
ATI | Information, manufacturer, product, version, etc.. |
AT+GMI | Manufacturer |
AT+GMM | Product model |
AT+GMR | Software version |
AT+GSN | ESN/IMEI |
AT+GCAP | Capability list |
AT+CCLK=“2014/05/30,16:12:30” | Set time/date |
AT+CCLK? | Read clock |
sms_gateway.txt · Last modified: 2021/10/09 15:14 by 127.0.0.1