那曲檬骨新材料有限公司

電子發(fā)燒友App

硬聲App

0
  • 聊天消息
  • 系統(tǒng)消息
  • 評論與回復(fù)
登錄后你可以
  • 下載海量資料
  • 學(xué)習(xí)在線課程
  • 觀看技術(shù)視頻
  • 寫文章/發(fā)帖/加入社區(qū)
會員中心
創(chuàng)作中心

完善資料讓更多小伙伴認(rèn)識你,還能領(lǐng)取20積分哦,立即完善>

3天內(nèi)不再提示
創(chuàng)作
電子發(fā)燒友網(wǎng)>電子資料下載>電子資料>使用WisBlock生態(tài)系統(tǒng)向Ubidots發(fā)送數(shù)據(jù)

使用WisBlock生態(tài)系統(tǒng)向Ubidots發(fā)送數(shù)據(jù)

2023-02-03 | zip | 0.19 MB | 次下載 | 免費(fèi)

資料介紹

描述

項目概況

在本教程中,我們將使用 RAK1906 開發(fā)一個應(yīng)用程序,這是一個可以測量溫度、濕度、壓力和氣體的傳感器我們還將使用RAK13101,它是Quectel mc20 無線通信模塊,允許使用SIM 卡通過TCP/UDP 協(xié)議將數(shù)據(jù)發(fā)送到云端,因此我們可以將數(shù)據(jù)存儲在Ubidots 平臺中。

什么是TCP/UDP?

TCP 代表傳輸控制協(xié)議它是 Internet 最重要的協(xié)議之一,由 Vint Cerf 和 Robert Kahn 在 70 年代開發(fā)。與UDP(User Datagram Protocol )一樣,它是對應(yīng)于OSI模型傳輸層的協(xié)議,其主要目的是在數(shù)據(jù)網(wǎng)絡(luò)中建立連接以交換數(shù)據(jù)。它最重要的特性之一是它保證數(shù)據(jù)的傳遞沒有錯誤并且按照它們發(fā)送的相同順序。

產(chǎn)品列表

  • WisBlock 底板 | RAK5005-O
  • 用于帶有 LoRa SX1262 的 LoRaWAN 的 Nordic nRF52840 BLE 核心模塊 | RAK4631 / RAK4631-R
  • 環(huán)境傳感器BOSCH BME680 | RAK1906
  • GSM移遠(yuǎn)MC20CE | RAK13101
  • 電池連接器電纜/5 根電池線
  • –0.3V 至 4.3V 電池
  • SIM卡

一步步

智慧模塊

物聯(lián)網(wǎng)硬件項目所需的WisBlock 模塊由底座、核心、無線和傳感器組成。首先,讓我們深入了解每個模塊的作用及其工作原理

RAK5005-O,也稱為WisBlock底板

基板為所有 WisBlock 模塊提供電源和數(shù)據(jù)。它支持核心、顯示器連接和傳感器本身。稍后我們將看到一切看起來如何。

image_Gd9EacQQKa.png?auto=compress%2Cformat&w=740&h=555&fit=max
RAK5005-O
?

RAK4631,也稱為WisBlock LPWAN模塊

基于超低功耗 MCU Nordic nRF52840,這是該項目的核心,包含 SX1262 Semtech LoRa ? IC 和 BLE(低功耗藍(lán)牙)。

image_jaHYzFmmbw.png?auto=compress%2Cformat&w=740&h=555&fit=max
Nordic nRF52840 BLE Core Module for LoRaWAN? with LoRa? SX1262 - RAK4631
?

RAK1906,又稱WisBlock環(huán)境傳感器

該傳感器基于 Bosch? BME680 模塊,可以同時測量多個量級,例如:

  • 溫度
  • 濕度
  • 高度
  • IAQ(室內(nèi)空氣質(zhì)量)
  • 氣體:二氧化碳
image_6OC90QvtzO.png?auto=compress%2Cformat&w=740&h=555&fit=max
環(huán)境傳感器 BOSCH BME680 - RAK1906
?

RAK13101,也稱為GSM/GPRS模塊

該模塊通過使用 Quectel MC20CE 蜂窩模塊在 WisBlock 平臺上提供 GSM/GPRS 功能。

image_MelykhWYyZ.png?auto=compress%2Cformat&w=740&h=555&fit=max
GSM移遠(yuǎn)MC20CE
?

如何連接一切

現(xiàn)在您知道您需要什么模塊以及它們?nèi)绾喂ぷ鳎屛覀儗?RAK4631 Core 連接到 CPU 插槽。

image_oufPkOdKiY.png?auto=compress%2Cformat&w=740&h=555&fit=max
?

然后,RAK5005-O底座的Slot A中的RAK1906傳感器,均使用M1.2x3螺絲。

image_SfagAPXTk1.png?auto=compress%2Cformat&w=740&h=555&fit=max
?

接下來,使用 M1.2x3 螺釘將 RAK13101 連接到 IO 插槽。

image_Ryg9y1qm53.png?auto=compress%2Cformat&w=740&h=555&fit=max
?

對于此模塊,將天線連接到正確的位置:GPS 天線連接到 GNSS 連接器,LTE 天線連接到 GSM 連接器,就像這樣。

image_MFWKHu81Es.png?auto=compress%2Cformat&w=740&h=555&fit=max
?

最后,將SIM卡插入RAK13101模塊的背面,往里推,直到聽到咔噠一聲。

image_pmRwdmHMTo.png?auto=compress%2Cformat&w=740&h=555&fit=max
?

這是查看連接方式的示意圖。

image_HmnRjA6rMN.png?auto=compress%2Cformat&w=740&h=555&fit=max
?

上傳固件

Arduino BSP安裝

對于此步驟,您可以參考我們的文檔,因為我們需要 RAK4631 內(nèi)核的 BSP。安裝 BSP 后,我們需要一些額外的庫。轉(zhuǎn)到工具 > 管理庫以打開庫管理器。然后,使用名稱搜索它們并安裝我們在下圖中突出顯示的那些,或者您也可以在代碼中找到它們。

檢查由 Bosch Sensortec 制作的庫名稱“BSEC Software Library”。

image_TX90pgiBSJ.png?auto=compress%2Cformat&w=740&h=555&fit=max
?

創(chuàng)建 Ubidots 帳戶

現(xiàn)在,讓我們在Ubidots平臺創(chuàng)建賬戶,您可以在這里注冊。

image_F7WTn0mJHw.png?auto=compress%2Cformat&w=740&h=555&fit=max
?

創(chuàng)建帳戶后,您將看到入職頁面。

image_EiOxEmp8z4.png?auto=compress%2Cformat&w=740&h=555&fit=max
?

入職后單擊“轉(zhuǎn)到我的儀表板”按鈕。

image_2jS1tM3ZEw.png?auto=compress%2Cformat&w=740&h=555&fit=max
?

現(xiàn)在您將看到一個演示儀表板,單擊頂部的設(shè)備,然后再次單擊設(shè)備。

image_H2U16r3wRX.png?auto=compress%2Cformat&w=740&h=555&fit=max
?

之后,您將看到演示設(shè)備。單擊屏幕右側(cè)的+按鈕和添加新設(shè)備選項。

image_irxgWFz28A.png?auto=compress%2Cformat&w=740&h=555&fit=max
?

單擊空白設(shè)備按鈕。

image_FbhWbkV40A.png?auto=compress%2Cformat&w=740&h=555&fit=max
?

然后鍵入您的設(shè)備名稱,在本例中為RAK13101。稍后單擊窗口右下角的復(fù)選標(biāo)記。

image_SC5t6v2b9f.png?auto=compress%2Cformat&w=740&h=555&fit=max
?

新設(shè)備將以給定名稱出現(xiàn)在屏幕上,單擊它。

image_aNjDXu1Cyi.png?auto=compress%2Cformat&w=740&h=555&fit=max
?

您將看到您的設(shè)備沒有數(shù)據(jù),現(xiàn)在您需要保存默認(rèn)令牌以供稍后在固件中使用。

image_Hg4DAYyB9F.png?auto=compress%2Cformat&w=740&h=555&fit=max
?

單擊您的用戶圖片,然后單擊 API 憑據(jù)選項。

image_jEcz6SQzu0.png?auto=compress%2Cformat&w=740&h=555&fit=max
?

API 密鑰 wl 和默認(rèn)令牌將出現(xiàn)。單擊它以顯示它,或者只需單擊復(fù)制按鈕,稍后您將需要該令牌。

image_AjMSZosAM2.png?auto=compress%2Cformat&w=740&h=555&fit=max
?

創(chuàng)建草圖

復(fù)制此項目的固件并將其粘貼到新的 Arduino 草圖中。為此,請單擊“文件”>“新建”,然后粘貼以下代碼(您也可以在我們的GitHub 上找到它)

在粘貼新代碼之前考慮刪除 Void Loop 和 Void Setup

/**
   @file RAK13101_TCP_Ubidots_example.ino
   @author harold.duarte@rakwireless.com
   @brief example of the use of the RAK13101 with the TCP protocol and the ubidots platform
   @version 0.1
   @date 2022-07-19
   @copyright Copyright (c) 2022
**/
#include 
#define POWER_KEY WB_IO5 //powerkey for the GPRS module
#include  //RAK1906 
#include  //RAK1906 
Adafruit_BME680 bme;
// Might need adjustments
#define SEALEVELPRESSURE_HPA (1008.76) //Barometric Pressure in mbar

void bme680_init()
{
  Wire.begin();

  if (!bme.begin(0x76)) {
    Serial.println("Could not find a valid BME680 sensor, check wiring!");
    return;
  }

  // Set up oversampling and filter initialization
  bme.setTemperatureOversampling(BME680_OS_8X);
  bme.setHumidityOversampling(BME680_OS_2X);
  bme.setPressureOversampling(BME680_OS_4X);
  bme.setIIRFilterSize(BME680_FILTER_SIZE_3);
  bme.setGasHeater(320, 150); // 320*C for 150 ms
}


void setup() {

  Serial.println("MC20 power up!");
  Serial1.begin(115200); // GPRS shield baud rate
  Serial.begin(115200); //RAK4631 BR
  delay(100);

  // Initialize the built in LED
  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, LOW);

  time_t timeout = millis();
  bool moduleSleeps = true;
  if (moduleSleeps)
  {
    // Module slept, wake it up
    pinMode(POWER_KEY, OUTPUT);
    digitalWrite(POWER_KEY, 0);
    delay(200);
    digitalWrite(POWER_KEY, 1);
    delay(2000);
    digitalWrite(POWER_KEY, 0);
    delay(1000);
    while (!Serial)
    {
      if ((millis() - timeout) < 5000)
      {
        delay(100);
        digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
      }
      else
      {
        break;
      }
    }
    bme680_init();

  }
}

void loop() {

  if (! bme.performReading()) {
    Serial.println("Failed to perform reading :(");
    return;
  }

  delay(15000); //waits 15 seconds to send data again
  tcp();
}


void tcp()
{
  Serial1.println("AT+QIMODE=0");  //Use AT+QIMODE command to select TCPIP Stack mode, it is non-transparent mode when AT+QIMODE=0, and AT+QIMODE=1 is transparent
  delay(200);
  ShowSerialData();
  Serial1.println("AT+QICSGP=1,"internet.movistar.com.co","movistar","movistar",0"); //Use AT+QICSGP=1,internet.movistar.com.co,movistar,movistar,0 to set APN as internet.movistar.com.co,user name as movistar,password as movistar
  delay(500);
  ShowSerialData();
  Serial1.println("AT+QIREGAPP");  //Start TCPIP task
  delay(200);
  ShowSerialData();
  Serial1.println("AT+QICSGP?");  //Check the current connecting mode(1: GPRS connecting mode£?0: CSD connecting mode)
  delay(200);
  ShowSerialData();
  Serial1.println("AT+QIACT");  //The current connecting mode is GPRS connecting mode
  delay(200);
  ShowSerialData();
  Serial1.println("AT+QILOCIP");  //Get the local IP address
  delay(400);
  ShowSerialData();
  Serial1.println("ATV1");  //Use ATV1 to set the response format
  delay(200);
  ShowSerialData();
  Serial1.println("AT+QIHEAD=1");  //Use AT+QIHEAD=1 to add the header information when receive data
  delay(200);
  ShowSerialData();
  Serial1.println("AT+QIDNSIP=1");  //Use AT+QIDNSIP=0 to use the IP address to establish TCP/UDP session, while AT+QIDNSIP=1 is use the domain name to establish TCP/UDP session
  delay(200);
  ShowSerialData();
  Serial1.println("AT+QIOPEN="TCP","industrial.api.ubidots.com","9012"");  //Use AT+QIOPEN=TCP,industrial.api.ubidots.com,9012 to connect to a TCP server (IP address: industrial.api.ubidots.com:9012) If return CONNECT OK means successfully connected to the remote server
  delay(5000);
  ShowSerialData();
  Serial1.println("AT+QISEND");  //AT+QISEND, send data to server, ">" from the UART indicates the following input data is considered as data to be send. After receiving ">", input data (TEST), the maximum length of the data is 1460, the data beyond 1460 will be omitted. Then use to send data. When receive SEND OK means the data has been sent+z>
  delay(2000);
  ShowSerialData();
  Serial1.println(">");
  delay(200);
  ShowSerialData();
  double temp = bme.temperature;
  double hum = bme.humidity;
  double pres = bme.pressure / 100.0;
  double co2 = bme.gas_resistance / 1000.0;
  String token = "BBFF-5mRERLy7jMPS9G0vHoAoTIoPz99IEQ"; //Default token from your ubidots account
  String device_name = "RAK13101"; //your device name on the ubidots platform 
  String StrThree = "ubidots/1.0|POST|" + token + "|" + device_name + "=>Temperature:" + temp + ",Humidity:" + hum + ",Pressure:" + pres + ",Gas:" + co2 + "|end" ;
  Serial1.println(StrThree);//send message
  delay(1000);
  ShowSerialData();
  Serial1.println((char)26); // Ctrl+z
  Serial1.println();
  delay(200);
  ShowSerialData();
  Serial1.println("AT+QICLOSE"); //Use AT+QICLOSE to close the connecting of TCP/UDP
  delay(1000);
  ShowSerialData();
  Serial1.println("AT+QIDEACT"); //Use AT+QIDEACT to deactivate GPRS context
  delay(1000);
  ShowSerialData();

}


void ShowSerialData()// if you want to see the AT commands on the Serial Monitor
{
  while (Serial1.available() != 0)
    Serial.write(Serial1.read());
}

您之前復(fù)制的令牌需要在第 129 行進(jìn)行更改,在第 130 行您還需要復(fù)制您在 Ubidots 平臺上使用的設(shè)備名稱,它應(yīng)該如下所示:

String token = "BBFF-5mRERLy7jMPS9G0vHoAoTIoPz99IEQ"; //Default token from your ubidots account
  String device_name = "RAK13101"; //your device name on the ubidots platform 
  String StrThree = "ubidots/1.0|POST|" + token + "|" + device_name + "=>Temperature:" + temp + ",Humidity:" + hum + ",Pressure:" + pres + ",Gas:" + co2 + "|end" ;

上傳固件并在上傳后使用重置按鈕重置設(shè)備一次。28秒后,您將在Ubidots平臺上看到您的信息

image_Fw7bcr5dht.png?auto=compress%2Cformat&w=740&h=555&fit=max
?

您可以打開每個變量并查看帶有多個選項的圖形,例如 RAW 數(shù)據(jù)、平均值、最小值、最大值、求和和計數(shù)、樣本日期以及每個變量的更多信息

image_QKqZKK2LrD.png?auto=compress%2Cformat&w=740&h=555&fit=max
?

結(jié)論

我們完成了!您可以使用 Sim 卡通過 GPRS 網(wǎng)絡(luò)成功發(fā)送數(shù)據(jù),并使用 WisBlock 模塊連接到 Ubidots 等云服務(wù)。此外,您將能夠一次讀取許多變量,例如溫度、濕度、壓力和二氧化碳水平。您甚至可以將它連接到您的手機(jī)并讀取世界任何地方的數(shù)據(jù)!正如我們常說的#IoTMadeEasy。

此外,請關(guān)注我們的Hackster Hub 并成為我們社區(qū)的一員,以了解更多 DIY IoT 項目和新聞。

如果您想購買我們的產(chǎn)品,請訪問我們的商店

歡迎與我們分享,寫下你的疑惑,在評論區(qū)與我們互動。


下載該資料的人也在下載 下載該資料的人還在閱讀
更多 >

評論

查看更多

下載排行

本周

  1. 1山景DSP芯片AP8248A2數(shù)據(jù)手冊
  2. 1.06 MB  |  532次下載  |  免費(fèi)
  3. 2RK3399完整板原理圖(支持平板,盒子VR)
  4. 3.28 MB  |  339次下載  |  免費(fèi)
  5. 3TC358743XBG評估板參考手冊
  6. 1.36 MB  |  330次下載  |  免費(fèi)
  7. 4DFM軟件使用教程
  8. 0.84 MB  |  295次下載  |  免費(fèi)
  9. 5元宇宙深度解析—未來的未來-風(fēng)口還是泡沫
  10. 6.40 MB  |  227次下載  |  免費(fèi)
  11. 6迪文DGUS開發(fā)指南
  12. 31.67 MB  |  194次下載  |  免費(fèi)
  13. 7元宇宙底層硬件系列報告
  14. 13.42 MB  |  182次下載  |  免費(fèi)
  15. 8FP5207XR-G1中文應(yīng)用手冊
  16. 1.09 MB  |  178次下載  |  免費(fèi)

本月

  1. 1OrCAD10.5下載OrCAD10.5中文版軟件
  2. 0.00 MB  |  234315次下載  |  免費(fèi)
  3. 2555集成電路應(yīng)用800例(新編版)
  4. 0.00 MB  |  33566次下載  |  免費(fèi)
  5. 3接口電路圖大全
  6. 未知  |  30323次下載  |  免費(fèi)
  7. 4開關(guān)電源設(shè)計實例指南
  8. 未知  |  21549次下載  |  免費(fèi)
  9. 5電氣工程師手冊免費(fèi)下載(新編第二版pdf電子書)
  10. 0.00 MB  |  15349次下載  |  免費(fèi)
  11. 6數(shù)字電路基礎(chǔ)pdf(下載)
  12. 未知  |  13750次下載  |  免費(fèi)
  13. 7電子制作實例集錦 下載
  14. 未知  |  8113次下載  |  免費(fèi)
  15. 8《LED驅(qū)動電路設(shè)計》 溫德爾著
  16. 0.00 MB  |  6656次下載  |  免費(fèi)

總榜

  1. 1matlab軟件下載入口
  2. 未知  |  935054次下載  |  免費(fèi)
  3. 2protel99se軟件下載(可英文版轉(zhuǎn)中文版)
  4. 78.1 MB  |  537798次下載  |  免費(fèi)
  5. 3MATLAB 7.1 下載 (含軟件介紹)
  6. 未知  |  420027次下載  |  免費(fèi)
  7. 4OrCAD10.5下載OrCAD10.5中文版軟件
  8. 0.00 MB  |  234315次下載  |  免費(fèi)
  9. 5Altium DXP2002下載入口
  10. 未知  |  233046次下載  |  免費(fèi)
  11. 6電路仿真軟件multisim 10.0免費(fèi)下載
  12. 340992  |  191187次下載  |  免費(fèi)
  13. 7十天學(xué)會AVR單片機(jī)與C語言視頻教程 下載
  14. 158M  |  183279次下載  |  免費(fèi)
  15. 8proe5.0野火版下載(中文版免費(fèi)下載)
  16. 未知  |  138040次下載  |  免費(fèi)
六合彩即时开奖| 百家乐官网二十一点| 百家乐怎么样玩| 大发888充值500| 百家乐官网最新投注方法| 百家乐桌台布| 皇家金堡娱乐| 百家乐官网唯一能长期赢钱的方法 | 美国百家乐官网怎么玩| 澳门百家乐心得玩博| 赌博网站| 三元玄空24山坐向开门| 一二博网| 24山向山摆设| 鸿发| 百家乐分析软件骗人| 晋江市| 澳门百家乐路子分析| 真人百家乐官网出千| 百家乐群1188999| 利记百家乐官网现金网| 百家乐有诈吗| 网络百家乐官网游戏机怎么破解| 百家乐开和几率| 百家乐官网现金网平台排行榜| 申博太阳城娱乐网| 皇马百家乐官网的玩法技巧和规则| 亲朋棋牌官网| 百家乐代理商博彩e族| 百家乐官网玩法的秘诀| 冠军百家乐现金网| 百家乐官网娱乐城送分| 百家乐网络游戏信誉怎么样| 678百家乐官网博彩娱乐平台 | 职业百家乐的玩法技巧和规则| 百家乐官网双筹码怎么出千| 大发888蜜月旅行| 百家乐太阳城球讯网| 菲律宾百家乐官网试玩| sz新全讯网xb112| 属鼠和属虎的人能在一起做生意吗|