{"id":5425,"date":"2024-07-24T14:43:07","date_gmt":"2024-07-24T05:43:07","guid":{"rendered":"https:\/\/blog.smartlight.co.jp\/?p=5425"},"modified":"2024-07-25T10:08:01","modified_gmt":"2024-07-25T01:08:01","slug":"m5stack%e3%81%a8catmgnss%e3%83%a2%e3%82%b8%e3%83%a5%e3%83%bc%e3%83%ab%e3%81%a7%e5%8f%96%e5%be%97%e3%81%97%e3%81%9f%e4%bd%8d%e7%bd%ae%e6%83%85%e5%a0%b1%e3%82%92mqtt%e3%81%a7node-red%e3%81%ab%e9%80%81","status":"publish","type":"post","link":"https:\/\/blog.smartlight.co.jp\/?p=5425","title":{"rendered":"M5Stack\u3068CatM+GNSS\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u53d6\u5f97\u3057\u305f\u4f4d\u7f6e\u60c5\u5831\u3092MQTT\u3067Node-RED\u306b\u9001\u308b"},"content":{"rendered":"\n<div class=\"wp-block-jin-gb-block-box-with-headline kaisetsu-box5\"><div class=\"kaisetsu-box5-title\">\u76ee\u6b21<\/div>\n<p>\u30fb<a href=\"#a\">\u306f\u3058\u3081\u306b<\/a><\/p>\n\n\n\n<p>\u30fb<a href=\"#a1\">\u4f7f\u7528\u30c7\u30d0\u30a4\u30b9<\/a><\/p>\n\n\n\n<p>\u30fb<a href=\"#a2\">\u63a5\u7d9a\u65b9\u6cd5<\/a><\/p>\n\n\n\n<p>\u30fb<a href=\"#a4\">Node-RED\u306e\u30d5\u30ed\u30fc<\/a><\/p>\n\n\n\n<p>\u30fb<a href=\"#a3\">\u5b9f\u884c\u7d50\u679c<\/a><\/p>\n\n\n\n<p><\/p>\n<\/div>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"a\">\u306f\u3058\u3081\u306b<\/h2>\n\n\n\n<p>\u3000\u4eca\u56de\u306f\u300cM5Stack Basic V2.7\u300d\u3068\u300cCatM + GNSS\u300d\u3092\u4f7f\u7528\u3057\u3066\u53d6\u5f97\u3057\u305fGPS(\u4f4d\u7f6e\u60c5\u5831)\u3092MQTT\u3067Node-RED\u306b\u9001\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3059\u308b<\/p>\n\n\n\n<p>\u3000\u30fbM5Stack\u3092Arduino IDE\u3067\u52d5\u304b\u3059\u65b9\u6cd5\u306b\u3064\u3044\u3066\u306f\u904e\u53bb\u306e\u8a18\u4e8b\u3092\u53c2\u7167<\/p>\n\n\n\nhttps:\/\/blog.smartlight.co.jp\/?p=5327\n\n\n\nhttps:\/\/blog.smartlight.co.jp\/?p=5360\n\n\n\n<p><\/p>\n\n\n\n<p>\u3000\u30fbM5Stack\u5185\u90e8\u304b\u3089\u53d6\u5f97\u3057\u305f\u52a0\u901f\u5ea6\u30c7\u30fc\u30bf\u3092MQTT\u3067Node-RED\u306b\u9001\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u306f\u904e\u53bb\u306e\u8a18\u4e8b\u3092\u53c2\u7167<\/p>\n\n\n\nhttps:\/\/blog.smartlight.co.jp\/?p=5362\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"a1\">\u4f7f\u7528\u30c7\u30d0\u30a4\u30b9<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u3000M5Stack Basic V2.7<\/h3>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"701\" src=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-424-1024x701.png\" alt=\"\" class=\"wp-image-5400\" style=\"width:501px;height:auto\" srcset=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-424-1024x701.png 1024w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-424-300x205.png 300w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-424-768x526.png 768w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-424.png 1044w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-424-1024x701.png 856w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p>\u3000\u30fbM5Stack\u306e2.7\u30d0\u30fc\u30b8\u30e7\u30f3\u3001CatM+GNSS\u30e2\u30b8\u30e5\u30fc\u30eb\u3068\u306e\u901a\u4fe1\u3092\u7ba1\u7406\u3057\u3001\u53d6\u5f97\u3057\u305fGPS\u30c7\u30fc\u30bf\u3092\u51e6\u7406\u30fb\u8868\u793a\u3059\u308b\u4e2d\u5fc3\u7684\u306a\u5f79\u5272\u3092\u62c5\u3046\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u3000CatM + GNSS\u30e2\u30b8\u30e5\u30fc\u30eb<\/h3>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"796\" src=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-426-1024x796.png\" alt=\"\" class=\"wp-image-5402\" style=\"width:556px;height:auto\" srcset=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-426-1024x796.png 1024w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-426-300x233.png 300w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-426-768x597.png 768w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-426.png 1125w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-426-1024x796.png 856w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p>\u3000\u30fbCatM+GNSS\u30e2\u30b8\u30e5\u30fc\u30eb\u306f\u3001LTE Cat-M1\u901a\u4fe1\u3068GNSS\uff08GPS\uff09\u6a5f\u80fd\u3092\u7d71\u5408\u3057\u305f\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u3042\u308a\u3001\u4f4e\u6d88\u8cbb\u96fb\u529b\u3067\u5e83\u57df\u901a\u4fe1\u304c\u53ef\u80fd\u306a\u305f\u3081\u3001IoT\u30c7\u30d0\u30a4\u30b9\u306b\u6700\u9069\u306a\u30e2\u30b8\u30e5\u30fc\u30eb\u3068\u306a\u3063\u3066\u3044\u308b\u3002\u4eca\u56de\u306fGPS\u885b\u661f\u304b\u3089\u4f4d\u7f6e\u60c5\u5831\u3092\u53d6\u5f97\u3057\u3001\u305d\u306e\u30c7\u30fc\u30bf\u3092M5Stack\u306b\u9001\u4fe1\u3059\u308b\u5f79\u5272\u3092\u62c5\u3046\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"a2\">\u63a5\u7d9a\u65b9\u6cd5<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u3000\u5168\u4f53\u69cb\u6210<\/h3>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"949\" src=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-428-1024x949.png\" alt=\"\" class=\"wp-image-5406\" style=\"width:529px;height:auto\" srcset=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-428-1024x949.png 1024w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-428-300x278.png 300w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-428-768x712.png 768w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-428.png 1047w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-428-1024x949.png 856w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<h3 class=\"wp-block-heading\">\u3000\u30cf\u30fc\u30c9\u30a6\u30a7\u30a2\u63a5\u7d9a<\/h3>\n\n\n\n<p>\u30001. PC\u3068M5Stack\u3092TypeC-USB\u3067\u63a5\u7d9a<\/p>\n\n\n\n<p>\u30002. GROVE\u30aa\u30b9-\u30e1\u30b9\u30b1\u30fc\u30d6\u30eb\u3092\u4f7f\u7528\u3057\u3066M5Stack\u3068Cat\uff2d+GNSS\u3092\u63a5\u7d9a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"735\" height=\"242\" src=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-429.png\" alt=\"\" class=\"wp-image-5407\" \/><\/figure>\n\n\n\n<p>\u30003. Cat\uff2d+GNSS\u306b9\uff5e24V\u306e\u96fb\u6e90\u30fbGPS\u30a2\u30f3\u30c6\u30ca\u30fbLTE\u30a2\u30f3\u30c6\u30ca\u3092\u7e4b\u3052\u308b<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u3000\u30e9\u30a4\u30d6\u30e9\u30ea\u30de\u30cd\u30b8\u30e3\u30fc\u306e\u8a2d\u5b9a<\/h3>\n\n\n\n<p>\u3000\u30fb\u30e9\u30a4\u30d6\u30e9\u30ea\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u3067\u300cPubSubClient\u300d\u3092\u691c\u7d22\uff06\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"477\" src=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-441-1024x477.png\" alt=\"\" class=\"wp-image-5427\" srcset=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-441-1024x477.png 1024w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-441-300x140.png 300w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-441-768x358.png 768w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-441.png 1195w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-441-1024x477.png 856w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u3000\u30b3\u30fc\u30c9\u6982\u8981<\/h3>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>#include &lt;M5Stack.h&gt;\n#include &lt;WiFi.h&gt;\n#include &lt;PubSubClient.h&gt;\n\n\/\/ WiFi\u8a2d\u5b9a\nconst char* ssid = &quot;****&quot;;  \/\/ WiFi\u306eSSID\nconst char* password = &quot;****&quot;;  \/\/ WiFi\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\n\n\/\/ MQTT\u30d6\u30ed\u30fc\u30ab\u30fc\u306e\u8a2d\u5b9a\nconst char* mqtt_server = &quot;****&quot;;  \/\/ \u30db\u30b9\u30c8\u30de\u30b7\u30f3\u306eIP\u30a2\u30c9\u30ec\u30b9\nconst char* mqtt_topic = &quot;\/m5stack\/gps&quot;;  \/\/ MQTT\u30c8\u30d4\u30c3\u30af\n\nWiFiClient espClient;\nPubSubClient client(espClient);\n\n\/\/ GPS\u30e2\u30b8\u30e5\u30fc\u30eb\u3068\u306e\u30b7\u30ea\u30a2\u30eb\u63a5\u7d9a\u3092\u5b9a\u7fa9\n#define SerialGPS Serial2\n\nvoid setup_wifi() {\n  delay(10);\n  Serial.println();\n  Serial.print(&quot;Connecting to &quot;);\n  Serial.println(ssid);\n\n  WiFi.begin(ssid, password);\n\n  while (WiFi.status() != WL_CONNECTED) {\n    delay(500);\n    Serial.print(&quot;.&quot;);\n  }\n\n  Serial.println(&quot;&quot;);\n  Serial.println(&quot;WiFi connected&quot;);\n  Serial.print(&quot;IP address: &quot;);\n  Serial.println(WiFi.localIP());\n}\n\nvoid reconnect() {\n  \/\/ \u518d\u63a5\u7d9a\u30eb\u30fc\u30d7\n  while (!client.connected()) {\n    Serial.print(&quot;Attempting MQTT connection...&quot;);\n    \/\/ \u63a5\u7d9a\u3092\u8a66\u307f\u308b\n    if (client.connect(&quot;M5StackClient&quot;)) {\n      Serial.println(&quot;connected&quot;);\n    } else {\n      Serial.print(&quot;failed, rc=&quot;);\n      Serial.print(client.state());\n      Serial.println(&quot; try again in 5 seconds&quot;);\n      \/\/ \u518d\u8a66\u884c\u307e\u30675\u79d2\u5f85\u6a5f\n      delay(5000);\n    }\n  }\n}\n\nvoid setup() {\n  M5.begin();\n  Serial.begin(115200); \/\/ \u30c7\u30d0\u30c3\u30b0\u7528\u30b7\u30ea\u30a2\u30eb\u901a\u4fe1\n  SerialGPS.begin(9600, SERIAL_8N1, 16, 17); \/\/ GPS\u30e2\u30b8\u30e5\u30fc\u30eb\u3068\u306e\u30b7\u30ea\u30a2\u30eb\u63a5\u7d9a\u8a2d\u5b9a\n\n  Serial.println(&quot;Initializing GPS module...&quot;);\n\n  \/\/ GPS\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u521d\u671f\u5316\n  SerialGPS.println(&quot;AT+CGNSPWR=1&quot;); \/\/ GNSS\u96fb\u6e90\u3092\u30aa\u30f3\u306b\u3059\u308b\n  delay(1000);\n  while (SerialGPS.available()) {\n    char c = SerialGPS.read();\n    Serial.print(c);\n  }\n  Serial.println();\n\n  SerialGPS.println(&quot;AT+CGNSSEQ=\\&quot;RMC\\&quot;&quot;); \/\/ GNSS\u51fa\u529b\u30b7\u30fc\u30b1\u30f3\u30b9\u3092\u8a2d\u5b9a\n  delay(1000);\n  while (SerialGPS.available()) {\n    char c = SerialGPS.read();\n    Serial.print(c);\n  }\n  Serial.println();\n\n  Serial.println(&quot;GPS initialized&quot;);\n\n  setup_wifi();\n  client.setServer(mqtt_server, 1883);\n}\n\nvoid loop() {\n  if (!client.connected()) {\n    reconnect();\n  }\n  client.loop();\n\n  SerialGPS.println(&quot;AT+CGNSINF&quot;); \/\/ GNSS\u60c5\u5831\u3092\u7167\u4f1a\n  delay(1000);\n\n  String gpsData = &quot;&quot;;\n  while (SerialGPS.available()) {\n    char c = SerialGPS.read();\n    gpsData += c;\n  }\n\n  if (gpsData.length() &gt; 0) {\n    Serial.println(&quot;Data received:&quot;);\n    Serial.println(gpsData);\n\n    \/\/ \u53d7\u4fe1\u30c7\u30fc\u30bf\u306e\u89e3\u6790\n    if (gpsData.startsWith(&quot;AT+CGNSINF&quot;)) {\n      int index = gpsData.indexOf(&quot;:&quot;);\n      if (index != -1) {\n        String gpsInfo = gpsData.substring(index + 1);\n        String jsonPayload = parseGPSData(gpsInfo);\n\n        \/\/ MQTT\u30e1\u30c3\u30bb\u30fc\u30b8\u306e\u9001\u4fe1\n        client.publish(mqtt_topic, jsonPayload.c_str());\n\n        \/\/ \u30c7\u30d0\u30c3\u30b0\u7528\u306b\u30b7\u30ea\u30a2\u30eb\u51fa\u529b\n        Serial.println(&quot;Published GPS data:&quot;);\n        Serial.println(jsonPayload);\n      }\n    } else {\n      Serial.println(&quot;No valid GPS data&quot;);\n    }\n  }\n  delay(5000); \/\/ 5\u79d2\u5f85\u6a5f\u5f8c\u3001\u518d\u5ea6\u7167\u4f1a\n}\n\nString parseGPSData(String gpsInfo) {\n  gpsInfo.trim();\n  String data[20];\n  int index = 0;\n\n  while (gpsInfo.length() &gt; 0 &amp;&amp; index &lt; 20) {\n    int commaIndex = gpsInfo.indexOf(&quot;,&quot;);\n    if (commaIndex == -1) {\n      data[index++] = gpsInfo;\n      break;\n    } else {\n      data[index++] = gpsInfo.substring(0, commaIndex);\n      gpsInfo = gpsInfo.substring(commaIndex + 1);\n    }\n  }\n\n  String jsonPayload = &quot;{&quot;;\n  jsonPayload += &quot;\\&quot;latitude\\&quot;: &quot; + data<img decoding=\"async\" class=\"ranking-number\" src=\"https:\/\/blog.smartlight.co.jp\/wp-content\/themes\/jin\/img\/rank03.png\" \/> + &quot;,&quot;;\n  jsonPayload += &quot;\\&quot;longitude\\&quot;: &quot; + data<img decoding=\"async\" class=\"ranking-number\" src=\"https:\/\/blog.smartlight.co.jp\/wp-content\/themes\/jin\/img\/rank04.png\" \/> + &quot;,&quot;;\n  jsonPayload += &quot;\\&quot;altitude\\&quot;: &quot; + data[5] + &quot;,&quot;;\n  jsonPayload += &quot;\\&quot;speed\\&quot;: &quot; + data[6];\n  jsonPayload += &quot;}&quot;;\n\n  return jsonPayload;\n}\n<\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u3000\u30b3\u30fc\u30c9\u306e\u8aac\u660e<\/h3>\n\n\n\n<p>\u3000\u2460 <strong>Wifi\u3068MQTT\u30d6\u30ed\u30fc\u30ab\u30fc\u306e\u63a5\u7d9a<\/strong>(\u4ee5\u4e0b\u306e\u5185\u5bb9\u3092\u30b3\u30fc\u30c9\u306b\u8a18\u5165)\uff1a<br>\u3000\u3000\u30fbWifi\u306eSSID \u2192 \u53f3\u4e0b\u306e\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u30a2\u30af\u30bb\u30b9\u3067\u78ba\u8a8d<br>\u3000\u3000\u30fbWifi\u306e\u30d1\u30b9\u30ef\u30fc\u30c9<br>\u3000\u3000\u30fb\u30db\u30b9\u30c8\u30de\u30b7\u30f3\u306eIP\u30a2\u30c9\u30ec\u30b9 \u2192 CMD\u3067&#8221;ipconfig&#8221;\u3059\u308b\u306a\u3069\u3057\u3066\u78ba\u8a8d<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"408\" src=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-440-1024x408.png\" alt=\"\" class=\"wp-image-5426\" srcset=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-440-1024x408.png 1024w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-440-300x120.png 300w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-440-768x306.png 768w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-440-1536x612.png 1536w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-440-2048x817.png 2048w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-440-1024x408.png 856w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u3000\u2781<strong> \u521d\u671f\u8a2d\u5b9a<\/strong>\uff1a<br>\u3000\u3000\u30fb<code>M5.begin()<\/code>\u3067M5Stack\u3092\u521d\u671f\u5316\u3002<br>\u3000\u3000\u30fb<code>Serial.begin(115200)<\/code>\u3000\u30c7\u30fc\u30bf\u8ee2\u9001\u901f\u5ea6<br>\u3000\u3000\u30fb<code>SerialGPS.begin(9600, SERIAL_8N1, 16, 17)<\/code>\u3000UART\u901a\u4fe1\u3067\u5b9f\u88c5\u3059\u308b\u305f\u3081\u300116\/17Pin\u306b\u8a2d\u5b9a\u3059\u308b<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u3000\u2782 <strong>MQTT\u30e1\u30c3\u30bb\u30fc\u30b8\u306e\u9001\u4fe1<\/strong>\uff1a<br>\u3000\u3000\u30fbclient.publish(mqtt_topic, jsonPayload.c_str())<br>\u3000\u3000\u30fbPubSubClient\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u7528\u3057\u3066MQTT\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u7279\u5b9a\u306eTOPIC\u306b\u516c\u958b\u3059\u308b<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u3000\u2783 <strong>\u30c7\u30fc\u30bf\u53d6\u5f97\u30eb\u30fc\u30d7<\/strong>\uff1a <br>\u3000\u3000\u30fb<code>SerialGPS.println(\"AT+CGNSINF\")<\/code>\u3067GNSS\u60c5\u5831\u3092\u8981\u6c42<br>\u3000\u3000\u30fb\u53d6\u5f97\u3057\u305f\u30c7\u30fc\u30bf\u3092\u89e3\u6790\u3057\u3001\u7def\u5ea6\u3001\u7d4c\u5ea6\u3001\u9ad8\u5ea6\u3001\u901f\u5ea6\u306a\u3069\u306e\u60c5\u5831\u3092\u8868\u793a<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u3000\u30dd\u30fc\u30c8\u304c\u958b\u3044\u3066\u3044\u308b\u304b\u78ba\u8a8d<\/h3>\n\n\n\n<p>\u3000\u2460 <strong>\u7ba1\u7406\u8005\u6a29\u9650\u3067CMD\u3092\u7acb\u3061\u4e0a\u3052<\/strong>\u3001mosquitto\u3092\u8d77\u52d5\u3059\u308b<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>net start mosquitto<\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>\u3000\u2781 1883\u30dd\u30fc\u30c8\u304c\u958b\u3044\u3066\u3044\u308b\u304b(LISTENING\u3055\u308c\u3066\u3044\u308b\u304b\u78ba\u8a8d)<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>netstat -an | find &quot;1883&quot;<\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<div class=\"wp-block-jin-gb-block-icon-box jin-icon-caution jin-iconbox\"><div class=\"jin-iconbox-icons\"><i class=\"jic jin-ifont-caution jin-icons\"><\/i><\/div><div class=\"jin-iconbox-main\">\n<p>\u2192 \u958b\u3044\u3066\u3044\u306a\u3044\u3001MQTT\u63a5\u7d9a\u304c\u3067\u304d\u306a\u3044\u5834\u5408<br>\u3000\u30fb<strong>Windows\u306e\u30d5\u30a1\u30a4\u30a2\u30a6\u30a9\u30fc\u30eb\u30671883\u30dd\u30fc\u30c8\u3092\u958b\u3051\u308b<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"456\" src=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-447-1024x456.png\" alt=\"\" class=\"wp-image-5434\" srcset=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-447-1024x456.png 1024w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-447-300x133.png 300w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-447-768x342.png 768w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-447.png 1405w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-447-1024x456.png 856w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"450\" src=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-448-1024x450.png\" alt=\"\" class=\"wp-image-5435\" srcset=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-448-1024x450.png 1024w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-448-300x132.png 300w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-448-768x338.png 768w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-448.png 1160w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-448-1024x450.png 856w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"235\" src=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-450-1024x235.png\" alt=\"\" class=\"wp-image-5437\" srcset=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-450-1024x235.png 1024w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-450-300x69.png 300w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-450-768x176.png 768w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-450-1536x352.png 1536w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-450-2048x469.png 2048w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-450-1024x235.png 856w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u3000\u30fb<strong>mosquitto.conf\u30d5\u30a1\u30a4\u30eb\u306b\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u633f\u5165\u3059\u308b<\/strong><br>\u3000\u3000\u2192\u30e1\u30e2\u5e33\u30a2\u30d7\u30ea\u7b49\u3092\u7ba1\u7406\u8005\u6a29\u9650\u3067\u958b\u304d\u3001\u30d5\u30a1\u30a4\u30eb\u3092\u958b\u304f\u3092\u62bc\u3059<br>\u3000\u3000\u3000C:\\Program Files\\mosquitto\u3067\u5168\u3066\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u8868\u793a\u3057\u3001 <br>\u3000\u3000\u3000<strong>mosquitto.conf\u30d5\u30a1\u30a4\u30eb<\/strong>\u3092\u958b\u304f<br><\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>listener 1883\nallow_anonymous true<\/code><\/pre><\/div>\n<\/div><\/div>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"a4\">Node-RED\u306e\u30d5\u30ed\u30fc<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u5168\u4f53\u50cf<\/h3>\n\n\n\n<div class=\"wp-block-jin-gb-block-box simple-box2\">\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"655\" height=\"147\" src=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-443.png\" alt=\"\" class=\"wp-image-5429\" \/><\/figure>\n<\/div>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">MQTT IN\u30ce\u30fc\u30c9\u306e\u8a2d\u5b9a<\/h3>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"433\" src=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-444-1024x433.png\" alt=\"\" class=\"wp-image-5430\" srcset=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-444-1024x433.png 1024w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-444-300x127.png 300w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-444-768x325.png 768w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-444-1536x650.png 1536w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-444.png 1962w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-444-1024x433.png 856w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u3000\u30fb\u753b\u50cf\u306e\u901a\u308a\u8a2d\u5b9a<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"a3\">\u5b9f\u884c\u7d50\u679c<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Arduino IDE\u306e\u753b\u9762<\/h3>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"794\" src=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-445-1024x794.png\" alt=\"\" class=\"wp-image-5431\" srcset=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-445-1024x794.png 1024w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-445-300x233.png 300w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-445-768x596.png 768w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-445.png 1260w, https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-445-1024x794.png 856w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p> -&gt; Data received:<br>\u3000\u3000GPS\u30e2\u30b8\u30e5\u30fc\u30eb\u304b\u3089\u30c7\u30fc\u30bf\u304c\u53d7\u4fe1\u3055\u308c\u305f\u3053\u3068\u3092\u793a\u3057\u3066\u3044\u308b<br><br> -&gt; AT+CGNSINF<br>\u3000\u3000M5Stack\u304cGPS\u30e2\u30b8\u30e5\u30fc\u30eb\u306b\u9001\u4fe1\u3057\u305fAT\u30b3\u30de\u30f3\u30c9<br><br> -&gt; +CGNSINF:1,1,20240724030344.000,\uff5e<br>\u3000\u3000GPS\u30e2\u30b8\u30e5\u30fc\u30eb\u304b\u3089\u8fd4\u3063\u3066\u304d\u305f\u30c7\u30fc\u30bf<br><br> -&gt; OK<br>\u3000\u3000GPS\u30e2\u30b8\u30e5\u30fc\u30eb\u304b\u3089\u306e\u5fdc\u7b54<br><br> -&gt; Published GPS data:<br>\u3000\u3000GPS\u30c7\u30fc\u30bf\u304cMQTT\u30c8\u30d4\u30c3\u30af\u306b\u516c\u958b\u3055\u308c\u305f\u3053\u3068\u3092\u793a\u3059<br><br> -&gt; {&#8220;latitude&#8221;: 35.678178,&#8221;longitude&#8221;: 139.687137,&#8221;altitude&#8221;: 51.589,&#8221;speed&#8221;: 0.00}<br>\u3000\u3000MQTT\u30e1\u30c3\u30bb\u30fc\u30b8\u3068\u3057\u3066\u516c\u958b\u3055\u308c\u305fGPS\u30c7\u30fc\u30bf<\/p>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"594\" height=\"926\" src=\"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-446.png\" alt=\"\" class=\"wp-image-5433\" \/><\/figure>\n\n\n\n<p>\u7def\u5ea6\uff08Latitude\uff09\uff1a35.678227<br>\u7d4c\u5ea6\uff08Longitude\uff09\uff1a139.687100<br>\u9ad8\u5ea6\uff08Altitude\uff09\uff1a42.436<br>\u901f\u5ea6\uff08Speed\uff09\uff1a0.00<\/p>\n\n\n\n<p>\u2192 \u53d6\u5f97\u3057\u305fGPS(\u4f4d\u7f6e)\u30c7\u30fc\u30bf\u3092Node-RED\u4e0a\u3067\u78ba\u8a8d\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u305f<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u306f\u3058\u3081\u306b \u3000\u4eca\u56de\u306f\u300cM5Stack Basic V2.7\u300d\u3068\u300cCatM + GNSS\u300d\u3092\u4f7f\u7528\u3057\u3066\u53d6\u5f97\u3057\u305fGPS(\u4f4d\u7f6e\u60c5\u5831)\u3092MQTT\u3067Node-RED\u306b\u9001\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3059\u308b \u3000\u30fbM5Stack\u3092Arduino IDE\u3067\u52d5\u304b<\/p>\n","protected":false},"author":16,"featured_media":5440,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jin_ogp_image_url":"","_jin_last_featured_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-5425","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-intern"],"jetpack_featured_media_url":"https:\/\/blog.smartlight.co.jp\/wp-content\/uploads\/2024\/07\/image-452.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/blog.smartlight.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/5425","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.smartlight.co.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.smartlight.co.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.smartlight.co.jp\/index.php?rest_route=\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.smartlight.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5425"}],"version-history":[{"count":3,"href":"https:\/\/blog.smartlight.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/5425\/revisions"}],"predecessor-version":[{"id":5460,"href":"https:\/\/blog.smartlight.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/5425\/revisions\/5460"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.smartlight.co.jp\/index.php?rest_route=\/wp\/v2\/media\/5440"}],"wp:attachment":[{"href":"https:\/\/blog.smartlight.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5425"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.smartlight.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5425"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.smartlight.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5425"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}