diff --git a/README.md b/README.md
index bdb715e..9e493fa 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,103 @@
-# solution-Sensorhub
-海外 vSIM EVB 项目推广 example,硬件选型:EC200UEU + Sense HAT(B)
+# 快速上手
+
+## 硬件准备
+
+Windows电脑一台,建议 `Win10` 系统。
+
+一套[EC200U-EU Quecpython 标准开发板](https://python.quectel.com/doc/Getting_started/zh/evb/ec200x-evb.html)(含天线,Type-C数据线)
+
+一张能够正常使用的SIM卡
+
+## 环境搭建
+
+- 下载并安装EC200EU系列模组驱动:[QuecPython_USB_Driver_Win10_ASR](https://images.quectel.com/python/2023/04/Quectel_Windows_USB_DriverA_Customer_V1.1.13.zip)。
+
+
+- 下载并安装 [VSCode](https://code.visualstudio.com/)。
+- 下载并解压 [QPYCom](https://images.quectel.com/python/2022/12/QPYcom_V3.6.0.zip) 工具到电脑的合适位置。
+- 下载[固件包](../../solutions/SimpliKit/EC200UEUAAR05A01M08_TEST0222.zip )。
+- 下载[实验源码](https://gitee.com/dustin-wei/solution-sensorhub)
+
+## 硬件连接
+
+按照下图硬件连接:
+
+
+
+
+
+1. 将天线连接至标识有 `LTE` 字样的天线连接座上。
+
+2. 使用 Type-C 数据线连接开发板和电脑。
+
+3. 在图示位置SIM1卡槽插入可用的 Nano SIM 卡
+
+
+
+## 设备开发
+
+- ### 开机
+
+完成硬件连接工作后,当PWR,SCK1亮起或电脑设备管理器的端口列表出现包含Quectel USB字样的COM口,表示开机成功
+
+
+
+
+
+- ### 烧录固件包
+
+参考[此章节](https://python.quectel.com/doc/Application_guide/zh/dev-tools/QPYcom/qpycom-dw.html#下载固件),烧录[固件包](../../solutions/SimpliKit/EC200UEUAAR05A01M08_TEST0222.zip )至开发板。
+
+- ### 脚本导入与运行
+
+1.参考[此章节](https://python.quectel.com/doc/Getting_started/zh/first_python.html#PC与模组间的文件传输),将源码目录下的code文件夹中的所有文件按原目录结构导入到模组文件系统中,如下图所示
+
+
+
+2.参考[此章节](https://python.quectel.com/doc/Getting_started/zh/first_python.html#执行脚本文件),执行主程序文件_main.py
+
+3.参考[此章节](https://python.quectel.com/doc/Getting_started/zh/first_python.html#停止程序运行),停止程序运行。
+
+## 业务调试
+
+### 程序启动
+
+执行_main.py脚本后,程序开始运行,会打印拨号信息,包括拨号状态、IP地址、DNS服务器地址,设备号等
+
+
+
+### 🚩 **Warning**
+
+未插入SIM卡时,SCK1灯不会亮起,并且无法打印设备信息,插入SIM卡并重启设备后即可正常运行。
+
+
+
+### 数据检测
+
+开始运行后每1s会打印一次检测到的温度1,湿度,气压,温度2,颜色的三原色的数据,
+
+
+
+### 数据更新
+
+当检测以上4种的任一数据产生大于1或者原色产生大于150的变化时就会尝试上传云端更新数据,当上传成功时返回“send ret:True”,并且会提示是哪些数据发生了变化,APP读取云端最新数据进行数据更新。
+
+
+
+
+
+如果数据没有大于1的变化就会只在pqcom中打印当前检测的数据,不会发起上传云端。
+
+
+
+位置定位更新,当模组位移超过50米时,云端会刷新定位信息,app读取最新定位信息。
+
+
+
+主动刷新APP数据,通过点击APP右上角刷新按键,APP会向服务器发起主动读取数据的指令,用于主动更新面板数据
+
+
+
+温度,湿度,气压,颜色,Lbs数据被获取成功
+
+
\ No newline at end of file
diff --git "a/code/Qth/\344\276\235\350\265\226quecpython module\346\270\205\345\215\225.md" "b/code/Qth/\344\276\235\350\265\226quecpython module\346\270\205\345\215\225.md"
new file mode 100644
index 0000000..4ac7bec
--- /dev/null
+++ "b/code/Qth/\344\276\235\350\265\226quecpython module\346\270\205\345\215\225.md"
@@ -0,0 +1,22 @@
+| module | 描述|
+| --- | --- |
+|uzlib|zlib解压缩|
+|utime|时间相关功能|
+|uos|基本系统服务|
+|ujson|JSON编码和解码|
+|uhashlib|哈希算法|
+|urandom|生成随机数|
+|ubinascii|二进制与ASCLL转换|
+|umqtt|MQTT客户端|
+|_thread|多线程|
+|net|网络相关功能|
+|sim|SIM卡功能|
+|misc.Power|关机以及软件重启功能|
+|ql_fs|高级文件操作|
+|fota|fota升级|
+|app_fota_download|py脚本升级|
+|log|日志输出|
+|modem|设备相关|
+|queue|消息队列|
+|request|http客户端|
+
diff --git a/code/_main.py b/code/_main.py
index 1025680..b2bea24 100644
--- a/code/_main.py
+++ b/code/_main.py
@@ -1,8 +1,5 @@
-import net
import utime
-import checkNet
import dataCall
-from misc import Power
from usr.libs import Application
from usr.libs.logging import getLogger
from usr.extensions import (
@@ -16,23 +13,6 @@
logger = getLogger(__name__)
-def wait_network_ready():
- for _ in range(3):
- logger.info("wait network ready...")
- code = checkNet.waitNetworkReady(300)
- if code == (3, 1):
- logger.info("network has been ready.")
- break
- else:
- logger.warn("network not ready, code: {}".format(code))
- net.setModemFun(0, 0)
- utime.sleep_ms(200)
- net.setModemFun(1, 0)
- else:
- logger.warn("power restart")
- Power.powerRestart()
-
-
def create_app(name="SimpliKit", version="1.0.0", config_path="/usr/config.json"):
_app = Application(name, version)
_app.config.init(config_path)
@@ -46,9 +26,15 @@ def create_app(name="SimpliKit", version="1.0.0", config_path="/usr/config.json"
if __name__ == "__main__":
- wait_network_ready()
+ while True:
+ lte = dataCall.getInfo(1, 0)
+ if lte[2][0] == 1:
+ logger.debug('lte network normal')
+ break
+ logger.debug('wait lte network normal...')
+ utime.sleep(3)
- dataCall.setPDPContext(1, 0, 'BICSAPN', '', '', 0) #激活之前,应该先配置APN,这里配置第1路的APN
+ dataCall.setPDPContext(1, 0, 'BICSAPN', '', '', 0) # 激活之前,应该先配置APN,这里配置第1路的APN
dataCall.activate(1)
app = create_app()
diff --git a/code/config.json b/code/config.json
index e8f4660..3af9d81 100644
--- a/code/config.json
+++ b/code/config.json
@@ -1,4 +1,5 @@
{
"QTH_PRODUCT_KEY": "pe16Db",
- "QTH_PRODUCT_SECRET": "ZGZMQWQ3QkVyN2Jm"
+ "QTH_PRODUCT_SECRET": "ZGZMQWQ3QkVyN2Jm",
+ "QTH_SERVER": "mqtt://iot-south.acceleronix.io:1883"
}
\ No newline at end of file
diff --git a/code/config2.json b/code/config2.json
new file mode 100644
index 0000000..e5aa3b8
--- /dev/null
+++ b/code/config2.json
@@ -0,0 +1,5 @@
+{
+ "QTH_PRODUCT_KEY": "pe17gQ",
+ "QTH_PRODUCT_SECRET": "REdmNmlMRS8yUmNi",
+ "QTH_SERVER": "mqtt://iot-south.quectelcn.com:1883"
+}
\ No newline at end of file
diff --git a/code/extensions/gnss_service.py b/code/extensions/gnss_service.py
index b9d9989..186c6f3 100644
--- a/code/extensions/gnss_service.py
+++ b/code/extensions/gnss_service.py
@@ -3,6 +3,8 @@
from usr.libs import CurrentApp
from usr.libs.threading import Thread
from usr.libs.logging import getLogger
+import _thread
+from .import qth_client
try:
from math import sin, asin, cos, radians, fabs, sqrt
except:
@@ -188,6 +190,7 @@ def start_update(self):
lng = lng_high + lng_low
if nmea_tuple[5] == "W":
lng = -lng
+
break
if nmea_data is not None:
@@ -218,3 +221,5 @@ def start_update(self):
else:
logger.error("send gnss to qth server fail")
utime.sleep(3)
+
+
diff --git a/code/extensions/lbs_service.py b/code/extensions/lbs_service.py
index a776315..8265005 100644
--- a/code/extensions/lbs_service.py
+++ b/code/extensions/lbs_service.py
@@ -3,7 +3,7 @@
from usr.libs import CurrentApp
from usr.libs.threading import Thread
from usr.libs.logging import getLogger
-
+import _thread
logger = getLogger(__name__)
@@ -57,3 +57,25 @@ def start_update(self):
logger.debug("send lbs data to qth server success, next report will be after 1800 seconds")
utime.sleep(1800)
+
+ def put_lbs(self):
+ while True:
+ lbs_data = self.read()
+ if lbs_data is None:
+ utime.sleep(2)
+ continue
+
+ for _ in range(3):
+ with CurrentApp().qth_client:
+ if CurrentApp().qth_client.sendLbs(lbs_data):
+ break
+ else:
+ logger.debug("send lbs data to qth server fail, next report will be after 2 seconds")
+ utime.sleep(2)
+ continue
+
+ logger.debug("send LBS data to qth server success")
+ break
+
+
+
diff --git a/code/extensions/qth_client.py b/code/extensions/qth_client.py
index 62c85d5..1b5b8c1 100644
--- a/code/extensions/qth_client.py
+++ b/code/extensions/qth_client.py
@@ -1,8 +1,8 @@
from usr.libs.threading import Lock
from usr.libs.logging import getLogger
from usr import Qth
-
-
+from usr.libs import CurrentApp
+from . import lbs_service
logger = getLogger(__name__)
@@ -24,7 +24,7 @@ def init_app(self, app):
app.register("qth_client", self)
Qth.init()
Qth.setProductInfo(app.config["QTH_PRODUCT_KEY"], app.config["QTH_PRODUCT_SECRET"])
- Qth.setServer('mqtt://iot-south.acceleronix.io:1883')
+ Qth.setServer(app.config["QTH_SERVER"])
Qth.setEventCb(
{
"devEvent": self.eventCallback,
@@ -47,7 +47,6 @@ def start(self):
def stop(self):
Qth.stop()
-
def sendTsl(self, mode, value):
return Qth.sendTsl(mode, value)
@@ -76,15 +75,38 @@ def recvTslCallback(self, value):
def readTslCallback(self, ids, pkgId):
logger.info("readTsl ids:{} pkgId:{}".format(ids, pkgId))
value=dict()
+
+ temp1, humi =CurrentApp().sensor_service.get_temp1_and_humi()
+ press, temp2 = CurrentApp().sensor_service.get_press_and_temp2()
+ r,g,b = CurrentApp().sensor_service.get_rgb888()
+
+ value={
+ 3:temp1,
+ 4:humi,
+ 5:temp2,
+ 6:press,
+ 7:{1:r, 2:g, 3:b},
+
+ }
+ lbs=lbs_service.LbsService()
+ lbs.put_lbs()
+
+
+
for id in ids:
- if 1 == id:
- value[1]=180.25
- elif 2 == id:
- value[2]=30
- elif 3 == id:
- value[3]=True
+ if 3 == id:
+ value[3]=temp1
+ elif 4 == id:
+ value[4]=humi
+ elif 5 == id:
+ value[5]=temp2
+ elif 6 == id:
+ value[6]=press
+ elif 7 == id:
+ value[7]={1:r, 2:g, 3:b}
Qth.ackTsl(1, value, pkgId)
-
+
+
def recvTslServerCallback(self, serverId, value, pkgId):
logger.info("recvTslServer serverId:{} value:{} pkgId:{}".format(serverId, value, pkgId))
Qth.ackTslServer(1, serverId, value, pkgId)
diff --git a/code/extensions/sensor_service.py b/code/extensions/sensor_service.py
index 2ada41e..014e583 100644
--- a/code/extensions/sensor_service.py
+++ b/code/extensions/sensor_service.py
@@ -40,6 +40,20 @@ def load(self):
Thread(target=self.start_update).start()
+ def get_temp1_and_humi(self):
+ return self.shtc3.getTempAndHumi()
+
+ def get_press_and_temp2(self):
+ return self.lps22hb.getTempAndPressure()
+ def get_rgb888(self):
+ rgb888 = self.tcs34725.getRGBValue()
+ logger.debug("R: {}, G: {}, B: {}".format((rgb888 >> 16) & 0xFF, (rgb888 >> 8) & 0xFF, rgb888 & 0xFF))
+
+ r = (rgb888 >> 16) & 0xFF
+ g = (rgb888 >> 8) & 0xFF
+ b = rgb888 & 0xFF
+ return r, g, b
+
def start_update(self):
prev_temp1 = None
prev_humi = None
diff --git a/media/1.png b/media/1.png
new file mode 100644
index 0000000..5091e34
Binary files /dev/null and b/media/1.png differ
diff --git a/media/EVB_link1.png b/media/EVB_link1.png
new file mode 100644
index 0000000..a7acd0b
Binary files /dev/null and b/media/EVB_link1.png differ
diff --git a/media/EVB_link2.png b/media/EVB_link2.png
new file mode 100644
index 0000000..fc704b0
Binary files /dev/null and b/media/EVB_link2.png differ
diff --git a/media/Qpycom.png b/media/Qpycom.png
new file mode 100644
index 0000000..4f6ab07
Binary files /dev/null and b/media/Qpycom.png differ
diff --git a/media/USB.png b/media/USB.png
new file mode 100644
index 0000000..575a020
Binary files /dev/null and b/media/USB.png differ
diff --git a/media/app.png b/media/app.png
new file mode 100644
index 0000000..c0ef5a4
Binary files /dev/null and b/media/app.png differ
diff --git a/media/app_ui.png b/media/app_ui.png
new file mode 100644
index 0000000..4f86efa
Binary files /dev/null and b/media/app_ui.png differ
diff --git a/media/data.png b/media/data.png
new file mode 100644
index 0000000..21a2671
Binary files /dev/null and b/media/data.png differ
diff --git a/media/data1.png b/media/data1.png
new file mode 100644
index 0000000..24ba2a9
Binary files /dev/null and b/media/data1.png differ
diff --git a/media/data_get.png b/media/data_get.png
new file mode 100644
index 0000000..97a77a9
Binary files /dev/null and b/media/data_get.png differ
diff --git a/media/data_up.png b/media/data_up.png
new file mode 100644
index 0000000..e0b98d9
Binary files /dev/null and b/media/data_up.png differ
diff --git a/media/drivers_data.png b/media/drivers_data.png
new file mode 100644
index 0000000..2e39646
Binary files /dev/null and b/media/drivers_data.png differ
diff --git a/media/gnss.png b/media/gnss.png
new file mode 100644
index 0000000..e356ec1
Binary files /dev/null and b/media/gnss.png differ
diff --git a/media/service_model.png b/media/service_model.png
new file mode 100644
index 0000000..8dbe278
Binary files /dev/null and b/media/service_model.png differ
diff --git a/media/sim_erro.png b/media/sim_erro.png
new file mode 100644
index 0000000..609d9a7
Binary files /dev/null and b/media/sim_erro.png differ
diff --git a/media/software1.png b/media/software1.png
new file mode 100644
index 0000000..a3e6e48
Binary files /dev/null and b/media/software1.png differ
diff --git a/media/software2.png b/media/software2.png
new file mode 100644
index 0000000..5ceccb6
Binary files /dev/null and b/media/software2.png differ
diff --git a/media/yun.png b/media/yun.png
new file mode 100644
index 0000000..78359c1
Binary files /dev/null and b/media/yun.png differ
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: