树莓派实战GPRS

来自Jack's Lab
(版本间的差异)
跳转到: 导航, 搜索
(AT命令)
(SIM800 树莓派扩展板)
第1行: 第1行:
==SIM800 树莓派扩展板==
+
==SIM800 GPRS/GSM==
  
 +
老牌GPRS芯片, 所以兼容性好. Arduino 都有很好的支持, 更不用说数梅派这种Linux操作系统的.
  
===AT命令===
+
==树梅派串口环回==
  
---does not work
+
数梅派上使用SIM800的主要问题是串口经常被占用. 而且系统很复杂, 多种渠道会占用唯一的硬件串口资源. 一旦串口能正常工作, 在数梅派上使用SIM800是一件很轻松的事情.
  
<code>
+
 
 +
==简单AT命令==
 +
 
 +
=== 查询SIM卡状态===
 +
at+cpin?
 +
 
 +
===查询网络状态===
 +
At+cops?
 +
 
 +
+cops 0,0,“Chian mobile”
 +
 
 +
===读取国际识别码===
 +
 
 +
AT+CIMI
 +
 
 +
 
 +
===发送短消息===
 +
> AT+CMGF=1                                                 
 +
OK
 +
> AT+CMGS="+861533xxxx3"                                                 
 +
> test sms                                                               
 +
> ctl+z                                                                       
 +
+CMGS: 0         
 +
 
 +
 
 +
=== TCP 连接===
 +
<source>
 
at+cipstart="tcp","api.thingspeak.com","443"
 
at+cipstart="tcp","api.thingspeak.com","443"
  
第18行: 第45行:
  
 
at-cipshut
 
at-cipshut
</code>
+
</source>
  
 
[https://github.com/carrascoacd/ArduinoSIM800L  sim800 Arduino HTTP]
 
[https://github.com/carrascoacd/ArduinoSIM800L  sim800 Arduino HTTP]
第24行: 第51行:
  
 
[https://www.rhydolabz.com/wiki/?p=16325  PPP Via Sim800 modem]
 
[https://www.rhydolabz.com/wiki/?p=16325  PPP Via Sim800 modem]
 +
 +
 +
==串口拨号==
 +
 +
[https://www.rhydolabz.com/wiki/?p=16325  教程]
 +
 +
<source lang="bash">
 +
sudo apt-get install ppp screen elinks
 +
 +
ls /etc/ppp/peers/
 +
 +
sudo vim /etc/ppp/peers/gprs
 +
</source>
 +
 +
 +
 +
 +
==默认路由==
 +
 +
ppp 已经设置了默认路由.
 +
 +
<source lang="bash">
 +
 +
<source>
 +
 +
==启动deamon程序==
 +
 +
<source lang="bash">
 +
 +
#Start daemon
 +
sudo start-stop-daemon --start -b --pidfile /run/ppp --startas /usr/bin/pon gprs
 +
 +
#More easy and dirty way
 +
sudo setsid ./start-lora > /dev/null 2>&1 < /dev/null &
 +
 +
cat start-lora
 +
#!/bin/bash
 +
cd /home/pi/loraGW/
 +
./lora_gateway_pi2 --mode=2|python ./post_processing_gw.py >>/var/log/lora
 +
 +
</source>

2017年10月24日 (二) 16:41的版本

目录

1 SIM800 GPRS/GSM

老牌GPRS芯片, 所以兼容性好. Arduino 都有很好的支持, 更不用说数梅派这种Linux操作系统的.

2 树梅派串口环回

数梅派上使用SIM800的主要问题是串口经常被占用. 而且系统很复杂, 多种渠道会占用唯一的硬件串口资源. 一旦串口能正常工作, 在数梅派上使用SIM800是一件很轻松的事情.


3 简单AT命令

3.1 查询SIM卡状态

at+cpin?

3.2 查询网络状态

At+cops?
+cops 0,0,“Chian mobile”

3.3 读取国际识别码

AT+CIMI


3.4 发送短消息

> AT+CMGF=1                                                   	 
OK
> AT+CMGS="+861533xxxx3"                                                   	 
> test sms                                                                 	 
> ctl+z                                                                         	 
+CMGS: 0          


3.5 TCP 连接

at+cipstart="tcp","api.thingspeak.com","443"

AT+cipDI=0

at+cipsend

>  POST /update?api_key=5J9GD27HXIMASDRC&field1=5000&headers=false  HTTP/1.1

>GET /update?api_key=

at-cipshut

sim800 Arduino HTTP


PPP Via Sim800 modem


4 串口拨号

教程

sudo apt-get install ppp screen elinks

ls /etc/ppp/peers/

sudo vim /etc/ppp/peers/gprs



5 默认路由

ppp 已经设置了默认路由.


<source>

==启动deamon程序==

<source lang="bash">

#Start daemon
sudo start-stop-daemon --start -b --pidfile /run/ppp --startas /usr/bin/pon gprs

#More easy and dirty way
sudo setsid ./start-lora > /dev/null 2>&1 < /dev/null &

cat start-lora
#!/bin/bash
cd /home/pi/loraGW/
./lora_gateway_pi2 --mode=2|python ./post_processing_gw.py >>/var/log/lora

个人工具
名字空间

变换
操作
导航
工具箱