{"id":115134,"date":"2026-10-11T09:32:56","date_gmt":"2026-10-11T01:32:56","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/115134.html"},"modified":"2026-10-11T09:32:56","modified_gmt":"2026-10-11T01:32:56","slug":"iot-%e7%b3%bb%e7%bb%9f%e6%9e%b6%e6%9e%84%e5%85%a8%e6%99%af%ef%bc%9a%e4%bb%8e%e4%bc%a0%e6%84%9f%e5%99%a8%e5%88%b0%e4%ba%91%ef%bc%8c%e4%b8%80%e5%bc%a0%e5%9b%be%e8%ae%b2%e6%b8%85%e7%ab%af","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/115134.html","title":{"rendered":"IoT \u7cfb\u7edf\u67b6\u6784\u5168\u666f\uff1a\u4ece\u4f20\u611f\u5668\u5230\u4e91\uff0c\u4e00\u5f20\u56fe\u8bb2\u6e05\u201c\u7aef-\u8fb9-\u4e91\u201c"},"content":{"rendered":"<p>IoT \u7cfb\u5217\u7b2c 1 \u7bc7\u3002\u5728\u300a09_\u65e0\u7ebf\u901a\u4fe1\u300b\u91cc\u6211\u4eec\u89e3\u51b3\u4e86&#034;\u6570\u636e\u600e\u4e48\u98de\u51fa\u53bb&#034;&#xff0c;\u8fd9\u4e00\u7bc7\u5f80\u4e0a\u62ac\u4e00\u5c42&#xff0c;\u770b\u6574\u5f20\u5730\u56fe\u3002<\/p>\n<p>\u9002\u7528\u4eba\u7fa4&#xff1a;\u73a9\u8fc7 STM32 \u6216 ESP32\u3001\u80fd\u8bfb\u4f20\u611f\u5668\u3001\u80fd\u8fde Wi-Fi&#xff0c;\u4f46\u4e00\u88ab\u95ee&#034;\u4f60\u8fd9\u5957\u4e1c\u897f\u67b6\u6784\u662f\u600e\u6837\u7684&#034;\u5c31\u7b54\u4e0d\u4e0a\u6765\u7684\u540c\u5b66\u3002\u4e0d\u9700\u8981\u670d\u52a1\u5668\u7ecf\u9a8c&#xff0c;Docker \u547d\u4ee4\u6211\u4f1a\u4ece 0 \u7ed9\u3002<\/p>\n<p>\u8bfb\u5b8c\u4f60\u80fd\u5f97\u5230&#xff1a;<\/p>\n<ul>\n<li>\u4e00\u5f20\u80fd\u9ed8\u51fa\u6765\u7684\u7aef-\u8fb9-\u4e91\u4e09\u5c42\u67b6\u6784\u56fe&#xff0c;\u9762\u8bd5\u753b\u5728\u767d\u677f\u4e0a\u4e0d\u5fc3\u865a&#xff1b;<\/li>\n<li>\u201c\u4e3a\u4ec0\u4e48\u4e2d\u95f4\u975e\u8981\u591a\u4e00\u4e2a\u7f51\u5173\u201d\u2014\u2014\u56db\u4e2a\u80fd\u6298\u7b97\u6210\u94b1\u6216\u53ef\u9760\u6027\u7684\u7406\u7531&#xff1b;<\/li>\n<li>\u5e38\u89c1\u8f6f\u786c\u4ef6\u7684\u5bf9\u53f7\u5165\u5ea7&#xff08;STM32\/ESP32\/\u6811\u8393\u6d3e\/EMQX\/\u4e91\u5e73\u53f0\u5404\u7ad9\u54ea\u4e00\u5c42&#xff09;&#xff1b;<\/li>\n<li>\u4e00\u6b21\u5b8c\u6574\u6570\u636e\u6d41\u7684\u516d\u6b65\u8d70&#xff0c;\u77e5\u9053\u4f60\u7684\u5b57\u8282\u8fc7\u4e86\u51e0\u9053\u624b&#xff1b;<\/li>\n<li>\u534f\u8bae\u9009\u578b\u89c6\u89d2&#xff1a;MQTT \/ CoAP \/ HTTP \/ LwM2M \u4e0d\u662f\u56db\u9009\u4e00&#xff0c;\u662f\u5404\u7ba1\u4e00\u6bb5&#xff1b;<\/li>\n<li>\u534a\u5c0f\u65f6\u5728\u672c\u673a\u8dd1\u8d77\u6765\u7684\u6700\u5c0f\u7aef\u8fb9\u4e91&#xff08;ESP32 &#043; EMQX Docker &#043; Node-RED&#xff09;\u3002<\/li>\n<\/ul>\n<p>\u6ca1\u770b\u8fc7\u65e0\u7ebf\u901a\u4fe1\u90a3\u51e0\u7bc7\u4e5f\u80fd\u61c2\u7684\u6838\u5fc3&#xff1a;\u4f20\u611f\u5668\u53ea\u8d1f\u8d23&#034;\u628a\u7269\u7406\u91cf\u53d8\u6210\u6570\u5b57&#034;&#xff0c;\u6570\u5b57\u8981\u53d8\u6210&#034;\u522b\u4eba\u80fd\u7528\u7684\u4fe1\u606f&#034;&#xff0c;\u4e2d\u95f4\u8fd8\u9694\u7740\u94fe\u8def\u3001\u534f\u8bae\u3001\u7f51\u5173\u3001\u5e73\u53f0\u56db\u5c42\u3002\u672c\u6587\u8bb2\u7684\u5c31\u662f\u8fd9\u56db\u5c42\u600e\u4e48\u5206\u5de5\u3002<\/p>\n<hr \/>\n<h3>\u4e00\u3001\u6211\u66fe\u7ecf\u4ee5\u4e3a&#034;IoT &#061; ESP32 \u8fde Wi-Fi \u53d1\u4e2a HTTP&#034;<\/h3>\n<p>\u5927\u4e8c\u90a3\u5e74\u6211\u505a\u4e86\u4e2a&#034;\u6559\u5ba4\u6e29\u6e7f\u5ea6\u76d1\u6d4b&#034;&#xff1a;ESP32 \u8bfb SHT30&#xff0c;\u6bcf 10 \u79d2 POST \u4e00\u4e2a JSON \u5230\u6211\u81ea\u5df1\u5199\u7684 Flask \u63a5\u53e3&#xff0c;\u7f51\u9875\u80fd\u770b\u66f2\u7ebf\u3002\u5f53\u65f6\u6211\u89c9\u5f97\u7269\u8054\u7f51\u4e0d\u8fc7\u5982\u6b64\u3002\u540e\u6765\u4e24\u4e2a&#034;\u770b\u8d77\u6765\u5dee\u4e0d\u591a&#034;\u7684\u9700\u6c42\u628a\u6211\u6253\u9192\u4e86\u3002<\/p>\n<p>\u7b2c\u4e00\u4e2a\u662f\u5b66\u6821\u8bd5\u9a8c\u7530\u7684\u571f\u58e4\u5892\u60c5\u3002 \u7530\u91cc\u6ca1 Wi-Fi\u3001\u6ca1\u5e02\u7535&#xff0c;\u8981\u592a\u9633\u80fd &#043; \u7535\u6c60\u6d3b\u4e00\u5b66\u671f\u3002\u6211\u539f\u6765\u7684\u65b9\u6848\u76f4\u63a5\u4f5c\u5e9f&#xff1a;\u4e00\u53f0\u8bbe\u5907\u5f00\u4e00\u4e2a HTTP \u957f\u8fde&#xff0c;\u5149 TCP \u63e1\u624b\u7684\u5f00\u9500\u90fd\u6bd4\u4e00\u5305\u6570\u636e\u5927\u3002\u800c\u4e14 20 \u4e2a\u8282\u70b9\u5404\u81ea\u76f4\u8fde\u6211\u7684\u4e91\u670d\u52a1\u5668&#xff0c;20 \u6761 TCP \u8fde\u63a5 24 \u5c0f\u65f6\u6302\u7740\u2014\u2014\u4e91\u662f\u6211\u81ea\u5df1\u7684&#xff0c;\u94b1\u5305\u4e5f\u662f\u6211\u81ea\u5df1\u7684\u3002<\/p>\n<p>\u7b2c\u4e8c\u4e2a\u662f\u667a\u6167\u8def\u706f\u3002 \u8981\u6c42\u662f&#034;\u5929\u9ed1\u81ea\u52a8\u4eae\u3001\u4eba\u8d70\u8fc7\u52a0\u4eae\u3001\u65ad\u7f51\u4e86\u4e5f\u8981\u4eae&#034;\u3002\u6211\u7b2c\u4e00\u53cd\u5e94\u662f&#034;\u4e91\u7aef\u5199\u4e2a\u89c4\u5219\u5457&#034;&#xff0c;\u8001\u5e08\u95ee\u6211\u4e00\u53e5&#xff1a;\u6821\u56ed\u7f51\u65ad\u4e86&#xff0c;\u4f60\u7684\u8def\u706f\u662f\u4e0d\u662f\u5c31\u5168\u778e\u4e86&#xff1f; \u6211\u7b54\u4e0d\u4e0a\u6765\u3002\u8fd9\u7c7b&#034;\u65ad\u7f51\u4e5f\u8981\u80fd\u5de5\u4f5c&#034;\u7684\u9700\u6c42&#xff0c;\u672c\u8d28\u4e0a\u662f\u8981\u6c42\u5224\u65ad\u903b\u8f91\u4e0d\u5728\u4e91\u4e0a&#xff0c;\u800c\u5728\u8def\u706f\u65c1\u8fb9\u3002<\/p>\n<p>\u8fd9\u4e24\u4e2a\u9700\u6c42\u628a\u6211\u903c\u51fa\u4e86&#034;\u8bbe\u5907\u76f4\u8fde\u4e91&#034;\u7684\u5355\u4e00\u601d\u7ef4\u3002\u771f\u5b9e\u7684 IoT \u7cfb\u7edf\u91cc&#xff0c;\u8bbe\u5907\u548c\u4e91\u4e4b\u95f4\u51e0\u4e4e\u603b\u662f\u5939\u7740\u4e00\u5c42\u4e1c\u897f&#xff0c;\u5b83\u53eb\u8fb9&#xff08;Edge&#xff09;\u3002\u52a0\u4e0a\u5b83\u4e4b\u540e&#xff0c;\u539f\u672c\u65e0\u89e3\u7684\u95ee\u9898\u7a81\u7136\u6709\u89e3\u4e86&#xff1a;<\/p>\n<ul>\n<li>\u7530\u91cc 20 \u4e2a\u7535\u6c60\u8282\u70b9\u4e0d\u7528\u5404\u81ea\u8fde\u4e91&#xff0c;\u7528 BLE \u6216 LoRa \u7529\u7ed9\u7530\u57c2\u4e0a\u90a3\u4e2a\u6709\u7535\u6709\u7f51\u7684\u7f51\u5173\u7edf\u4e00\u4e0a\u884c\u2014\u2014\u7701\u7535\u3001\u7701\u6d41\u91cf\u3001\u7701\u8fde\u63a5\u6570&#xff1b;<\/li>\n<li>\u8def\u706f\u7684\u8054\u52a8\u89c4\u5219\u5199\u5728\u672c\u5730\u7f51\u5173\u91cc&#xff0c;\u65ad\u7f51\u53ea\u662f&#034;\u4e0a\u4e0d\u4e86\u62a5&#034;&#xff0c;\u706f\u7167\u6837\u4eae&#xff1b;<\/li>\n<li>\u4e0a\u884c\u6570\u636e\u5148\u5728\u7f51\u5173\u6ee4\u6ce2\u3001\u805a\u5408\u3001\u53ea\u4f20\u53d8\u5316\u91cf&#xff0c;\u6d41\u91cf\u8d39\u76f4\u63a5\u964d\u4e00\u4e2a\u6570\u91cf\u7ea7\u3002<\/li>\n<\/ul>\n<p>\u6211\u6ca1\u6709\u91cf\u4ea7\u7ecf\u9a8c&#xff0c;\u8fd9\u4e9b\u662f\u6211\u5728\u8bfe\u8bbe\u548c\u5543\u6587\u6863\u8fc7\u7a0b\u4e2d\u6574\u7406\u7684\u3002\u4f46&#034;\u7aef-\u8fb9-\u4e91&#034;\u4e0d\u662f\u6211\u53d1\u660e\u7684&#xff0c;\u5b83\u662f\u884c\u4e1a\u901a\u7528\u8bed\u8a00\u2014\u2014\u4f60\u53bb\u9762\u8bd5&#xff0c;\u767d\u677f\u4e0a\u753b\u51fa\u6765\u7684\u90a3\u5f20\u56fe\u5e94\u8be5\u8ddf\u672c\u6587\u56fe 1 \u540c\u4e00\u4e2a\u9aa8\u67b6\u3002<\/p>\n<hr \/>\n<h3>\u4e8c\u3001\u524d\u7f6e\u6982\u5ff5\u8868&#xff1a;\u5148\u628a\u8fd9\u51e0\u4e2a\u8bcd\u5bf9\u9f50<\/h3>\n<table>\n<tr>\u672f\u8bed\u767d\u8bdd\u89e3\u91ca\u4e00\u53e5\u8bdd\u8bb0\u4f4f\u5b83<\/tr>\n<tbody>\n<tr>\n<td>\u7aef&#xff08;Device \/ Node&#xff09;<\/td>\n<td>\u771f\u6b63\u63a5\u89e6\u7269\u7406\u4e16\u754c\u7684\u677f\u5b50&#xff1a;\u91c7\u96c6\u6570\u636e\u6216\u6267\u884c\u52a8\u4f5c<\/td>\n<td>\u5927\u591a\u6570\u7aef\u8282\u70b9\u538b\u6839\u4e0d\u4f1a\u76f4\u63a5\u4e0a\u7f51&#xff0c;\u4e5f\u4e0a\u4e0d\u8d77\u7f51<\/td>\n<\/tr>\n<tr>\n<td>\u8fb9&#xff08;Edge&#xff09;<\/td>\n<td>\u7aef\u548c\u4e91\u4e4b\u95f4\u7684&#034;\u4e2d\u8f6c &#043; \u5904\u7406\u7ad9&#034;\u3002\u6709\u7535\u3001\u6709\u7f51\u3001\u7b97\u529b\u6bd4\u7aef\u5f3a<\/td>\n<td>\u5b83\u4e0d\u662f&#034;\u8f6c\u53d1\u5668&#034;&#xff0c;\u662f\u4f1a\u601d\u8003\u7684\u4e2d\u8f6c\u7ad9<\/td>\n<\/tr>\n<tr>\n<td>\u4e91&#xff08;Cloud&#xff09;<\/td>\n<td>\u8fdc\u7aef\u670d\u52a1\u5668\u96c6\u7fa4&#xff1a;\u5b58\u50a8\u3001\u5206\u6790\u3001\u4e0b\u53d1\u3001\u5bf9\u63a5\u4e1a\u52a1<\/td>\n<td>\u957f\u5904\u662f\u7b97\u529b\u548c\u5168\u5c40\u89c6\u89d2&#xff0c;\u77ed\u5904\u662f\u79bb\u8bbe\u5907\u592a\u8fdc<\/td>\n<\/tr>\n<tr>\n<td>Broker<\/td>\n<td>MQTT \u7684\u6d88\u606f\u4e2d\u8f6c\u670d\u52a1\u5668&#xff0c;\u6309\u4e3b\u9898\u8f6c\u53d1<\/td>\n<td>\u8bbe\u5907\u4e4b\u95f4\u4ece\u4e0d\u76f4\u8fde&#xff0c;\u90fd\u5728\u8ddf Broker \u8bf4\u8bdd<\/td>\n<\/tr>\n<tr>\n<td>\u7f51\u5173&#xff08;Gateway&#xff09;<\/td>\n<td>\u534f\u8bae\u8f6c\u6362\u5668&#xff1a;\u628a BLE\/Modbus\/Zigbee \u7ffb\u8bd1\u6210 MQTT\/HTTP<\/td>\n<td>\u7f51\u5173\u662f\u8fb9\u6700\u5e38\u89c1\u7684\u7269\u7406\u5f62\u6001&#xff1b;&#034;\u8fb9&#034;\u8fd8\u5305\u62ec\u7f51\u5173\u91cc\u8dd1\u7684\u903b\u8f91<\/td>\n<\/tr>\n<tr>\n<td>\u4e0a\u884c \/ \u4e0b\u884c<\/td>\n<td>\u8bbe\u5907\u2192\u4e91\u53eb\u4e0a\u884c&#xff08;\u9065\u6d4b&#xff09;&#xff0c;\u4e91\u2192\u8bbe\u5907\u53eb\u4e0b\u884c&#xff08;\u547d\u4ee4&#xff09;<\/td>\n<td>\u4e0a\u884c\u6c42&#034;\u7a33&#034;&#xff0c;\u4e0b\u884c\u6c42&#034;\u5feb&#034;<\/td>\n<\/tr>\n<tr>\n<td>\u4e3b\u9898&#xff08;Topic&#xff09;<\/td>\n<td>MQTT \u91cc\u6d88\u606f\u7684\u5730\u5740&#xff0c;agri\/gw01\/telemetry&#xff0c;\u7528 \/ \u5206\u5c42<\/td>\n<td>\u4e3b\u9898\u8bbe\u8ba1\u597d\u4e0d\u597d&#xff0c;\u51b3\u5b9a\u4ee5\u540e\u52a0\u8bbe\u5907\u75db\u4e0d\u75db\u82e6<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u26a0\ufe0f \u6700\u5bb9\u6613\u641e\u6df7\u7684\u4e00\u5bf9&#xff1a;&#034;\u8fb9&#034;\u662f\u903b\u8f91\u5c42&#xff0c;&#034;\u7f51\u5173&#034;\u662f\u5177\u4f53\u8bbe\u5907\u3002\u4e00\u4e2a\u6811\u8393\u6d3e\u4e0a\u8dd1 Mosquitto &#043; Node-RED &#043; \u8054\u52a8\u811a\u672c&#xff0c;\u5b83\u65e2\u662f\u7f51\u5173&#xff08;\u786c\u4ef6&#xff09;&#xff0c;\u4e5f\u662f\u8fb9&#xff08;\u903b\u8f91&#xff09;\u3002\u963f\u91cc\u4e91\u7684&#034;\u8fb9\u7f18\u8ba1\u7b97\u5b9e\u4f8b&#034;\u5219\u662f\u628a\u8fb9\u505a\u6210\u8f6f\u4ef6\u585e\u8fdb\u522b\u7684\u673a\u5668\u2014\u2014\u5c42\u8fd8\u5728&#xff0c;\u53ea\u662f\u4e0d\u518d\u662f\u4e00\u53f0\u770b\u5f97\u89c1\u7684\u76d2\u5b50\u3002<\/p>\n<hr \/>\n<h3>\u4e09\u3001\u7aef-\u8fb9-\u4e91\u4e09\u5c42\u5168\u666f\u56fe<\/h3>\n<p>[\u56fe 1] IoT \u7cfb\u7edf&#034;\u7aef-\u8fb9-\u4e91&#034;\u4e09\u5c42\u5168\u666f&#xff08;\u9762\u8bd5\u767d\u677f\u4e0a\u753b\u7684\u90a3\u5f20&#xff09;<\/p>\n<p> \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u4e91 CLOUD \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n \u2502  \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510   \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510   \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510  \u2502<br \/>\n \u2502  \u2502 \u7269\u8054\u7f51\u5e73\u53f0       \u2502   \u2502  \u89c4\u5219\u5f15\u64ce     \u2502   \u2502  \u4e1a\u52a1\u5e94\u7528         \u2502  \u2502<br \/>\n \u2502  \u2502 EMQX \/ \u963f\u91cc\u4e91IoT \u2502\u2500\u2500&gt;\u2502 \u9608\u503c\u544a\u8b66      \u2502\u2500\u2500&gt;\u2502 \u5927\u5c4f \/ App \/ MES \u2502  \u2502<br \/>\n \u2502  \u2502 \u534e\u4e3a\u4e91 \/ OneNET  \u2502   \u2502 \u6570\u636e\u6e05\u6d17      \u2502   \u2502 \u65f6\u5e8f\u6570\u636e\u5e93        \u2502  \u2502<br \/>\n \u2502  \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518   \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518   \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518  \u2502<br \/>\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<br \/>\n          \u2502  MQTT over TLS&#xff1a;1883 \/ 8883<br \/>\n          \u2502  \u2191 \u8fd9\u4e00\u6bb5\u662f\u5e7f\u57df\u7f51&#xff0c;\u4f1a\u65ad\u3001\u4f1a\u6162\u3001\u6309\u6d41\u91cf\u6536\u8d39<br \/>\n \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550<br \/>\n          \u2502  \u56ed\u533a \/ \u73b0\u573a\u5c40\u57df\u7f51&#xff1a;\u901a\u5e38\u514d\u8d39\u3001\u5feb&#xff0c;\u4f46\u5730\u7406\u8303\u56f4\u6709\u9650<br \/>\n \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u8fb9 EDGE \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n \u2502  \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510  \u2502<br \/>\n \u2502  \u2502  \u8fb9\u7f18\u7f51\u5173&#xff08;\u6811\u8393\u6d3e \/ ESP32-S3 \/ \u5de5\u63a7\u673a \/ \u5de5\u4e1a\u7f51\u5173&#xff09;           \u2502  \u2502<br \/>\n \u2502  \u2502   \u2460 \u534f\u8bae\u8f6c\u6362   BLE \/ Modbus \/ Zigbee \/ LoRa  \u21c4  MQTT      \u2502  \u2502<br \/>\n \u2502  \u2502   \u2461 \u672c\u5730 Broker&#xff08;\u53ef\u9009&#xff09;Mosquitto \/ EMQX&#xff0c;\u65ad\u7f51\u4e5f\u80fd\u5185\u90e8\u901a\u4fe1   \u2502  \u2502<br \/>\n \u2502  \u2502   \u2462 \u8fb9\u7f18\u8ba1\u7b97   \u6ed1\u52a8\u6ee4\u6ce2\u3001\u8d8a\u9650\u5224\u65ad\u3001\u805a\u5408\u4e0a\u62a5\u3001\u5355\u4f4d\u6362\u7b97        \u2502  \u2502<br \/>\n \u2502  \u2502   \u2463 \u65ad\u7f51\u7eed\u4f20   \u672c\u5730\u961f\u5217 &#043; SQLite \/ \u6587\u4ef6\u7f13\u5b58&#xff0c;\u8054\u7f51\u540e\u8865\u4f20     \u2502  \u2502<br \/>\n \u2502  \u2502   \u2464 \u672c\u5730\u8054\u52a8   &#034;\u6e29\u5ea6&gt;30 \u5c31\u5f00\u98ce\u6247&#034;&#xff0c;\u4e0d\u4f9d\u8d56\u4e91                \u2502  \u2502<br \/>\n \u2502  \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518  \u2502<br \/>\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u25b2\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u25b2\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u25b2\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<br \/>\n        \u2502              \u2502                     \u2502<br \/>\n    BLE \/ Zigbee   RS-485 \/ Modbus        LoRa \/ \u79c1\u6709\u5c04\u9891<br \/>\n \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u250c\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510      \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n \u2502 \u6e29\u6e7f\u5ea6\u8282\u70b9    \u2502 \u2502 \u7535\u8868 \/ \u6c34\u8868 \u2502      \u2502 \u571f\u58e4\u5892\u60c5\u8282\u70b9   \u2502<br \/>\n \u2502 STM32&#043;\u4f20\u611f\u5668  \u2502 \u2502 \u5de5\u4e1a\u4eea\u8868    \u2502      \u2502 \u7535\u6c60 &#043; \u592a\u9633\u80fd  \u2502<br \/>\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518      \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<br \/>\n                     \u7aef DEVICES&#xff08;\u6570\u91cf\u591a\u3001\u8d44\u6e90\u5c11\u3001\u5927\u591a\u4e0d\u901a IP&#xff09;<\/p>\n<h4>3.1 \u4e09\u5c42\u5404\u81ea\u8be5\u5e72\u4ec0\u4e48\u3001\u4e0d\u8be5\u5e72\u4ec0\u4e48<\/h4>\n<p>\u5224\u65ad\u4e00\u4e2a\u529f\u80fd\u653e\u54ea\u5c42&#xff0c;\u6211\u7684\u571f\u529e\u6cd5\u662f\u95ee\u4e09\u4e2a\u95ee\u9898&#xff1a;\u8981\u4e0d\u8981\u5168\u5c40\u4fe1\u606f&#xff1f;\u80fd\u4e0d\u80fd\u5bb9\u5fcd\u5ef6\u8fdf&#xff1f;\u65ad\u7f51\u65f6\u8fd8\u8981\u4e0d\u8981\u5de5\u4f5c&#xff1f;<\/p>\n<table>\n<tr>\u5c42\u8be5\u5b83\u5e72\u7684\u4e0d\u8be5\u5b83\u5e72\u7684\u5178\u578b\u8f6f\u786c\u4ef6<\/tr>\n<tbody>\n<tr>\n<td>\u7aef<\/td>\n<td>\u91c7\u6837\u3001\u6267\u884c\u3001\u672c\u5730\u5b89\u5168\u8054\u9501\u3001\u4f4e\u529f\u8017\u4f11\u7720&#xff08;Stop \/ Deep Sleep&#xff09;\u3001\u57fa\u7840\u81ea\u68c0<\/td>\n<td>\u590d\u6742\u89c4\u5219\u5224\u65ad\u3001\u957f\u8fde\u63a5\u3001TLS \u63e1\u624b\u3001\u5927\u6570\u636e\u7f13\u5b58<\/td>\n<td>STM32&#xff08;F1\/F4\/L4\/U5 \u6309\u529f\u8017\u7b97\u529b\u9009&#xff09;\u3001ESP32-C3\/S3&#xff08;\u81ea\u5e26 Wi-Fi\/BLE&#xff09;\u3001nRF52&#xff08;\u7eaf BLE&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u8fb9<\/td>\n<td>\u534f\u8bae\u8f6c\u6362\u3001\u805a\u5408\/\u6ee4\u6ce2\u3001\u672c\u5730\u8054\u52a8\u3001\u65ad\u7f51\u7eed\u4f20\u3001\u672c\u5730\u544a\u8b66\u3001\u56fa\u4ef6\u5206\u53d1<\/td>\n<td>\u8de8\u7ad9\u70b9\u5168\u5c40\u5206\u6790\u3001\u957f\u671f\u5386\u53f2\u5b58\u50a8<\/td>\n<td>\u6811\u8393\u6d3e\/\u9999\u6a59\u6d3e&#xff08;Linux &#043; Docker&#xff09;\u3001ESP32-S3&#xff08;\u8f7b\u91cf\u7f51\u5173&#xff09;\u3001\u5de5\u4e1a\u7f51\u5173&#xff08;RS-485\/DI\/DO&#xff09;\u3001\u8dd1 Mosquitto \/ EMQX \/ Node-RED<\/td>\n<\/tr>\n<tr>\n<td>\u4e91<\/td>\n<td>\u6d77\u91cf\u5b58\u50a8\u3001\u8de8\u8bbe\u5907\u5173\u8054\u5206\u6790\u3001\u7528\u6237\u6743\u9650\u3001OTA \u7248\u672c\u7ba1\u7406\u3001\u5bf9\u63a5\u4e1a\u52a1<\/td>\n<td>\u6beb\u79d2\u7ea7\u5b9e\u65f6\u63a7\u5236\u3001\u5355\u70b9\u9ad8\u9891\u8054\u52a8<\/td>\n<td>\u963f\u91cc\u4e91 IoT \/ \u534e\u4e3a\u4e91 \/ OneNET&#xff08;\u6258\u7ba1&#xff09;&#xff1b;\u81ea\u5efa&#xff1a;EMQX \/ Mosquitto &#043; \u65f6\u5e8f\u5e93&#xff08;TDengine\/InfluxDB&#xff09;&#043; \u89c4\u5219\u5f15\u64ce<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u26a0\ufe0f \u5e73\u53f0\u5dee\u5f02&#xff1a;\u540c\u6837\u53eb&#034;\u8fb9&#034;&#xff0c;ESP32-S3 \u548c\u6811\u8393\u6d3e\u4e0d\u662f\u4e00\u4e2a\u91cf\u7ea7\u3002ESP32-S3 \u51e0\u767e KB RAM\u3001\u65e0 MMU\u3001\u8dd1 FreeRTOS&#xff0c;\u8ba9\u5b83\u505a&#034;\u672c\u5730 Broker &#043; \u4e00\u5468\u7f13\u5b58&#034;\u662f\u60f3\u591a\u4e86&#xff1b;\u6811\u8393\u6d3e\u662f\u74e6\u7ea7\u529f\u8017\u3001GB \u7ea7\u5185\u5b58&#xff0c;\u80fd\u5e72\u7684\u591a\u5f97\u591a\u4f46\u8d39\u7535\u3001\u8d35\u3001\u8981\u7ba1\u7cfb\u7edf\u3002\u9009\u786c\u4ef6\u524d\u5148\u7b97\u6e05\u695a&#034;\u8981\u7f13\u5b58\u591a\u5c11&#034;\u201c\u8981\u4e0d\u8981\u8dd1\u5bb9\u5668\u201d&#xff0c;\u522b\u4e0a\u6765\u5c31\u4e0a\u6811\u8393\u6d3e&#xff0c;\u4e5f\u522b\u786c\u625b\u3002<\/p>\n<p>&#x1f4a1; \u4e91\u7aef\u9009\u578b&#xff1a;\u6258\u7ba1\u5e73\u53f0\u7684\u597d\u5904\u662f&#034;\u63a5\u5165\u3001\u9274\u6743\u3001\u5f71\u5b50\u3001OTA \u90fd\u7ed9\u4f60\u505a\u597d\u4e86&#034;&#xff0c;\u574f\u5904\u662f\u88ab\u7ed1\u6b7b\u3001\u6309\u6d88\u606f\u6570\u6536\u8d39\u3001\u6570\u636e\u8fc7\u522b\u4eba\u624b\u3002\u81ea\u5efa\u5168\u5728\u81ea\u5df1\u624b\u91cc\u3001\u672c\u5730\u5c31\u80fd\u7ec3\u624b&#xff0c;\u4ee3\u4ef7\u662f\u9274\u6743\/\u9ad8\u53ef\u7528\/\u76d1\u63a7\u81ea\u5df1\u625b\u3002\u6211\u7684\u5efa\u8bae\u662f\u5148\u81ea\u5efa\u628a MQTT \u641e\u660e\u767d&#xff0c;\u518d\u5b66\u5e73\u53f0\u7684\u5c01\u88c5\u2014\u2014\u987a\u5e8f\u53cd\u4e86&#xff0c;\u5e73\u53f0\u7684&#034;\u7269\u6a21\u578b&#034;\u201c\u5f71\u5b50\u201d&#034;Topic \u7c7b&#034;\u4f60\u4e00\u4e2a\u90fd\u770b\u4e0d\u61c2\u3002<\/p>\n<hr \/>\n<h3>\u56db\u3001\u4e3a\u4ec0\u4e48\u975e\u8981\u591a\u4e00\u4e2a&#034;\u8fb9&#034;&#xff1a;\u56db\u4e2a\u7406\u7531&#xff0c;\u9010\u4e2a\u80fd\u7b97\u8d26<\/h3>\n<p>\u5982\u679c\u4f60\u4ee5\u540e\u53ea\u8bb0\u5f97\u4e00\u53e5\u8bdd&#xff0c;\u6211\u5e0c\u671b\u662f\u8fd9\u53e5&#xff1a;\u8fb9\u4e0d\u662f\u4e3a\u4e86&#034;\u591a\u4e00\u5c42\u663e\u5f97\u4e13\u4e1a&#034;&#xff0c;\u5b83\u89e3\u51b3\u7684\u90fd\u662f\u80fd\u6298\u7b97\u6210\u94b1\u6216\u53ef\u9760\u6027\u7684\u95ee\u9898\u3002<\/p>\n<h4>4.1 \u7701\u94b1&#xff1a;\u5e26\u5bbd\u548c\u4e91\u6210\u672c<\/h4>\n<p>\u5047\u8bbe\u4e00\u4e2a\u5927\u68da\u6709 50 \u4e2a\u8282\u70b9&#xff0c;\u6bcf 30 \u79d2\u4e0a\u62a5\u4e00\u6b21 100 \u5b57\u8282&#xff1a;<\/p>\n<p>\u65b9\u6848 A&#xff1a;50 \u4e2a\u8282\u70b9\u5404\u81ea\u76f4\u8fde\u4e91&#xff08;\u6bcf\u4e2a\u90fd\u5f00 TCP &#043; TLS&#xff09;<br \/>\n  \u6bcf\u5305\u5b9e\u9645\u5f00\u9500 \u2248 100 B \u8f7d\u8377 &#043; 40 B TCP\/IP \u5934 &#043; ~30 B MQTT \u5934 &#043; TLS \u8bb0\u5f55\u5934 \u2248 200 B \u5f80\u4e0a<br \/>\n  \u6bcf\u5929&#xff1a;50 \u00d7 2880 \u00d7 200 B \u2248 28.8 MB\/\u5929 \u2248 864 MB\/\u6708&#xff1b;\u670d\u52a1\u5668\u7ef4\u6301 50 \u6761 TLS \u957f\u8fde\u63a5<\/p>\n<p>\u65b9\u6848 B&#xff1a;\u8282\u70b9\u8d70 BLE\/LoRa \u7ed9\u7f51\u5173&#xff0c;\u7f51\u5173\u6bcf 5 \u5206\u949f\u805a\u5408\u53d1\u4e00\u5305&#xff08;\u7ea6 2 KB&#xff09;<br \/>\n  \u6bcf\u5929&#xff1a;288 \u00d7 2 KB \u2248 0.58 MB\/\u5929 \u2248 17 MB\/\u6708&#xff1b;\u670d\u52a1\u5668\u53ea\u7ef4\u6301 1 \u6761\u8fde\u63a5<\/p>\n<p>  \u2192 \u6d41\u91cf\u964d\u5230\u7ea6 1\/50&#xff0c;\u8fde\u63a5\u6570\u4ece 50 \u964d\u5230 1<\/p>\n<p>\u6570\u5b57\u662f\u4f30\u7b97\u7684&#xff0c;\u4f46\u6570\u91cf\u7ea7\u662f\u5bf9\u7684&#xff1a;\u805a\u5408 &#043; \u6279\u91cf\u4e0a\u4f20&#xff0c;\u662f\u8fb9\u7f18\u5c42\u6700\u76f4\u767d\u7684\u7701\u94b1\u65b9\u5f0f\u3002<\/p>\n<h4>4.2 \u7701\u7535&#xff1a;\u628a\u6700\u8d39\u7535\u7684\u6d3b\u4ece\u7535\u6c60\u8282\u70b9\u8eab\u4e0a\u62ff\u8d70<\/h4>\n<p>\u300a\u4f4e\u529f\u8017\u300b\u90a3\u51e0\u7bc7\u7684\u516c\u5f0f&#xff1a;\u5e73\u5747\u7535\u6d41 &#061; \u03a3(\u5404\u72b6\u6001\u7535\u6d41 \u00d7 \u505c\u7559\u65f6\u95f4) \u00f7 \u5468\u671f\u3002\u4e00\u6b21 MQTT \u4e0a\u62a5\u8981 3~5 \u79d2\u7684\u9ad8\u7535\u6d41&#xff08;\u542b\u5efa\u8fde\u3001TLS \u63e1\u624b&#xff09;&#xff0c;\u800c\u4e00\u6b21 BLE \u5e7f\u64ad\u53ea\u8981\u51e0\u5341\u6beb\u79d2\u3002\u628a\u5c04\u9891\u53d1\u5c04\u65f6\u957f\u780d\u6389\u4e00\u4e24\u4e2a\u6570\u91cf\u7ea7&#xff0c;\u7eed\u822a\u76f4\u63a5\u7ffb\u500d\u3002 \u6240\u4ee5\u6211\u90a3\u4e2a&#034;\u53d1 HTTP&#034;\u7684 ESP32 \u6559\u5ba4\u8282\u70b9\u7528\u5e02\u7535\u6beb\u65e0\u95ee\u9898&#xff0c;\u4e00\u6362\u7535\u6c60\u67b6\u6784\u5c31\u5f97\u6539&#xff1a;\u7535\u6c60\u7aef\u53ea\u505a\u77ed\u8ddd\u79bb\u4f4e\u529f\u8017\u901a\u4fe1&#xff0c;\u8054\u7f51\u7684\u91cd\u6d3b\u4ea4\u7ed9\u6709\u5e02\u7535\u7684\u7f51\u5173\u3002<\/p>\n<h4>4.3 \u65ad\u7f51\u7eed\u4f20&#xff1a;\u6700\u5bb9\u6613\u88ab\u5ffd\u89c6&#xff0c;\u4e5f\u6700\u5bb9\u6613\u5728\u9a8c\u6536\u65f6\u7ffb\u8f66<\/h4>\n<p>\u6211\u7b2c\u4e00\u6b21\u505a\u6237\u5916\u9879\u76ee\u65f6\u5199\u7684\u662f&#xff1a;\u91c7\u6837 \u2192 \u8fde Wi-Fi \u2192 \u53d1 HTTP \u2192 \u5931\u8d25\u5c31\u4e22\u5f03\u3002\u53ea\u8981\u90a3 5 \u5206\u949f\u7f51\u7edc\u6296\u4e00\u4e0b&#xff0c;\u6570\u636e\u5c31\u6c38\u4e45\u6ca1\u4e86\u3002\u9a8c\u6536\u65f6\u5bf9\u65b9\u95ee\u6211&#034;\u6628\u5929\u4e0b\u5348 3 \u70b9\u5230 4 \u70b9\u7684\u6570\u636e\u5462&#034;&#xff0c;\u6211\u53ea\u80fd\u8bf4&#034;\u90a3\u4f1a\u513f\u65ad\u7f51\u4e86&#034;\u3002<\/p>\n<p>[\u56fe 2] \u65ad\u7f51\u7eed\u4f20\u7684\u57fa\u672c\u7ed3\u6784<\/p>\n<p>  \u91c7\u6837 \u2500\u2500&gt; \u6253\u65f6\u95f4\u6233 \u2500\u2500&gt; \u672c\u5730\u73af\u5f62\u961f\u5217&#xff08;\u5185\u5b58 &#043; \u6389\u7535\u4fdd\u5b58\u5230 Flash\/SQLite&#xff09;<br \/>\n                             \u2502<br \/>\n                \u8054\u7f51&#xff1f;\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n                 \u662f \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500&gt; \u6279\u91cf\u4e0a\u884c \u2192 \u6536\u5230\u786e\u8ba4 \u2192 \u5220\u9664\u961f\u5217\u6761\u76ee<br \/>\n                 \u5426 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500&gt; \u7ee7\u7eed\u6512&#xff0c;\u5230\u4e0a\u9650\u5c31\u6309\u7b56\u7565\u4e22\u6700\u65e7\u7684<\/p>\n<p>\u4e09\u4e2a\u8981\u70b9&#xff0c;\u6bcf\u6761\u90fd\u662f\u8e29\u8fc7\u7684&#xff1a;\u2460 \u65f6\u95f4\u6233\u8981\u5728\u91c7\u6837\u90a3\u4e00\u523b\u6253&#xff0c;\u4e0d\u662f\u4e0a\u4f20\u65f6\u6253\u2014\u2014\u5426\u5219\u65ad\u7f51\u4e00\u5c0f\u65f6\u540e\u8865\u4f20\u7684\u6570\u636e\u5168\u6324\u5728\u540c\u4e00\u65f6\u523b&#xff0c;\u66f2\u7ebf\u662f\u9519\u7684&#xff1b;\u2461 \u961f\u5217\u8981\u6709\u4e0a\u9650&#xff0c;\u522b\u628a Flash \u5199\u7a7f&#xff08;\u548c\u300a17_\u5b58\u50a8\u300b\u7684\u5199\u5e73\u8861\u3001\u6389\u7535\u4fdd\u62a4\u662f\u540c\u4e00\u4e2a\u95ee\u9898&#xff09;&#xff1b;\u2462 \u8865\u4f20\u8981\u5206\u6279\u9650\u901f\u2014\u2014\u65ad\u7f51\u4e24\u5c0f\u65f6\u540e\u4e00\u6062\u590d\u704c\u51e0\u5343\u6761\u8fdb\u53bb&#xff0c;\u8f7b\u5219\u5361\u6b7b\u81ea\u5df1&#xff0c;\u91cd\u5219\u88ab Broker \u9650\u6d41\u8e22\u4e0b\u7ebf\u3002<\/p>\n<h4>4.4 \u672c\u5730\u8054\u52a8&#xff1a;\u547c\u5e94\u6211\u5728\u300a\u9879\u76ee\u5b9e\u6218_02\u300b\u505a\u7684 BLE \u7f51\u5173<\/h4>\n<p>\u6211\u5728\u300a\u9879\u76ee\u5b9e\u6218_02&#xff1a;\u667a\u80fd\u5bb6\u5c45\u73af\u5883\u7f51\u5173\u2014\u2014ESP32 \u505a BLE \u4e2d\u5fc3 &#043; \u672c\u5730\u8054\u52a8\u300b\u91cc\u5e72\u7684\u4e8b&#xff0c;\u7528\u672c\u7bc7\u7684\u8bed\u8a00\u91cd\u8ff0\u4e00\u904d&#xff1a;<\/p>\n<p>[\u56fe 3] \u540c\u4e00\u4e2a\u9879\u76ee&#xff0c;\u4e24\u79cd\u67b6\u6784<\/p>\n<p>  (a) \u6211\u6700\u521d\u7684&#034;\u4e91\u4e0a\u8054\u52a8&#034;\u60f3\u6cd5<br \/>\n      \u4f20\u611f\u5668 \u2500\u2500Wi-Fi\u2500\u2500&gt; \u4e91\u89c4\u5219\u5f15\u64ce \u2500\u2500&gt; \u4e0b\u53d1\u547d\u4ee4 \u2500\u2500&gt; \u6267\u884c\u5668<br \/>\n      \u65ad\u7f51 &#061; \u5168\u762b&#xff1b;\u6bcf\u6b21\u8054\u52a8\u7ed5\u4e00\u5708&#xff0c;\u5ef6\u8fdf\u51e0\u767e\u6beb\u79d2\u5230\u51e0\u79d2<\/p>\n<p>  (b) \u5b9e\u9645\u505a\u6210\u7684&#034;\u672c\u5730\u8054\u52a8&#034;&#xff08;\u8fb9\u5728\u8d77\u4f5c\u7528&#xff09;<br \/>\n      \u4f20\u611f\u5668 \u2500\u2500BLE\u2500\u2500&gt; ESP32 \u7f51\u5173\u3010\u89c4\u5219&#xff1a;\u6e29\u5ea6&gt;28\u2103 \u4e14 \u6709\u4eba \u2192 \u5f00\u98ce\u6247\u3011\u2500\u2500&gt; \u6267\u884c\u5668<br \/>\n                          \u2514\u2500\u2500MQTT\u2500\u2500&gt; \u4e91&#xff08;\u53ea\u8d1f\u8d23\u8bb0\u5f55\u548c\u8fdc\u7a0b\u624b\u52a8\u63a7\u5236&#xff09;<br \/>\n      \u65ad\u7f51 &#061; \u53ea\u662f\u4e0a\u4e0d\u4e86\u62a5&#xff0c;\u8054\u52a8\u7167\u5e38&#xff1b;\u5ef6\u8fdf\u662f\u6beb\u79d2\u7ea7<\/p>\n<p>\u8fd9\u4e2a\u7ecf\u5386\u8ba9\u6211\u5f7b\u5e95\u7406\u89e3\u4e86&#034;\u8fb9&#034;&#xff1a;\u5224\u65ad\u903b\u8f91\u79bb\u88ab\u63a7\u5bf9\u8c61\u8d8a\u8fd1&#xff0c;\u7cfb\u7edf\u8d8a\u53ef\u9760\u3002 \u4e91\u662f&#034;\u5168\u5c40\u89c6\u89d2\u548c\u8bb0\u5fc6\u529b&#034;&#xff0c;\u4e0d\u662f&#034;\u53cd\u5c04\u795e\u7ecf&#034;\u2014\u2014\u4f60\u4e0d\u4f1a\u6307\u671b\u5927\u8111\u76ae\u5c42\u8d1f\u8d23\u819d\u8df3\u53cd\u5c04\u3002<\/p>\n<hr \/>\n<h3>\u4e94\u3001\u6570\u636e\u662f\u600e\u4e48\u6d41\u8fc7\u53bb\u7684&#xff1a;\u4e00\u6b21\u4e0a\u884c &#043; \u4e00\u6b21\u4e0b\u884c<\/h3>\n<p>[\u56fe 4] \u4e00\u6b21\u5b8c\u6574\u95ed\u73af&#xff0c;\u516d\u4e2a\u9636\u6bb5<\/p>\n<p>  \u2460 \u91c7\u96c6      \u4f20\u611f\u5668 \u2192 \u6570\u5b57\u91cf&#xff08;I2C\/SPI\/ADC&#xff09;<br \/>\n  \u2461 \u672c\u5730\u5904\u7406  \u6807\u5b9a\u3001\u5355\u4f4d\u6362\u7b97\u3001\u6ed1\u52a8\u5e73\u5747\u3001\u5254\u9664\u8df3\u53d8\u3001\u8d8a\u9650\u6807\u8bb0<br \/>\n  \u2462 \u534f\u8bae\u5c01\u88c5  \u7ec4 JSON\/CBOR&#xff0c;\u52a0\u8bbe\u5907 ID\u3001\u65f6\u95f4\u6233\u3001\u5e8f\u53f7\u3001\u6821\u9a8c<br \/>\n  \u2463 \u4e0a\u884c      MQTT PUBLISH(QoS 1) \u2192 Wi-Fi\/4G\/LoRa \u2192 \u7f51\u5173 \u2192 Broker<br \/>\n  \u2464 \u5e73\u53f0      \u89e3\u6790\u3001\u9274\u6743\u3001\u5165\u5e93\u3001\u89c4\u5219\u5f15\u64ce\u5224\u5b9a\u3001\u66f4\u65b0\u8bbe\u5907\u5f71\u5b50<br \/>\n  \u2465 \u4e0b\u884c\u63a7\u5236  PUBLISH \u5230 cmd \u4e3b\u9898 \u2192 \u8bbe\u5907\u6821\u9a8c\u6267\u884c \u2192 \u56de\u62a5\u65b0\u72b6\u6001&#xff08;\u56de\u5230 \u2460&#xff09;<\/p>\n<p>  \u5173\u952e&#xff1a;\u2465 \u6267\u884c\u5b8c\u5fc5\u987b\u56de\u62a5&#xff0c;\u5f62\u6210\u95ed\u73af\u3002\u5426\u5219 App \u4e0a\u6c38\u8fdc\u662f&#034;\u5df2\u53d1\u9001&#034;&#xff0c;<br \/>\n  \u4f60\u4e0d\u77e5\u9053\u8bbe\u5907\u5230\u5e95\u5f00\u6ca1\u5f00\u2014\u2014\u800c\u8fd9\u4e2a&#034;\u56de\u62a5&#034;\u672c\u8eab\u5c31\u662f\u4e00\u6b21\u4e0a\u884c\u3002<\/p>\n<p>\u26a0\ufe0f \u7b2c \u2462 \u6b65\u65b0\u624b\u6700\u5e38\u8e29&#xff1a;\u628a\u6240\u6709\u4e1c\u897f\u585e\u8fdb\u4e00\u4e2a\u4e3b\u9898\u3002\u6bd4\u5982 device\/data \u91cc\u4e00\u4f1a\u513f\u6e29\u5ea6\u4e00\u4f1a\u513f\u7535\u91cf\u4e00\u4f1a\u513f\u5fc3\u8df3&#xff0c;\u9760\u89e3\u6790 payload \u533a\u5206\u3002\u540e\u679c\u662f\u6ca1\u6cd5\u7528\u4e3b\u9898\u8fc7\u6ee4&#xff08;\u4e91\u7aef\u89c4\u5219\u5199\u5f97\u53c8\u81ed\u53c8\u957f&#xff09;\u3001retained \u6d88\u606f\u4e5f\u6ca1\u6cd5\u7528\u3002\u4e3b\u9898\u8981\u6309&#034;\u7528\u9014&#034;\u5206\u5c42&#xff0c;\u4e0d\u662f\u6309&#034;\u8bbe\u5907&#034;\u6253\u5305\u3002<\/p>\n<hr \/>\n<h3>\u516d\u3001\u534f\u8bae\u9009\u578b&#xff1a;\u4e0d\u662f\u56db\u9009\u4e00&#xff0c;\u662f\u5404\u7ba1\u4e00\u6bb5<\/h3>\n<p>\u8fd9\u662f\u6211\u6700\u60f3\u7ea0\u6b63\u7684\u8bef\u89e3\u3002\u6559\u7a0b\u5e38\u628a MQTT\/CoAP\/HTTP\/LwM2M \u6446\u4e00\u6392\u8ba9\u4f60&#034;\u9009\u4e00\u4e2a&#034;&#xff0c;\u4f46\u771f\u5b9e\u67b6\u6784\u91cc\u5b83\u4eec\u5e38\u5e38\u540c\u65f6\u51fa\u73b0&#xff0c;\u53ea\u662f\u5728\u4e0d\u540c\u7684\u6bb5\u4e0a\u3002<\/p>\n<p>[\u56fe 5] \u534f\u8bae\u662f\u5206\u6bb5\u7684&#xff0c;\u4e0d\u662f\u4e92\u65a5\u7684<\/p>\n<p>   \u7aef \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500&gt; \u8fb9 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500&gt; \u4e91 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500&gt; \u4e1a\u52a1<br \/>\n   BLE GATT          MQTT over TLS     HTTPS \/ AMQP \/ Kafka<br \/>\n   Modbus RTU        &#xff08;\u4e5f\u53ef\u80fd\u76f4\u63a5 CoAP&#xff09;\u6570\u636e\u5e93\u9a71\u52a8<br \/>\n   Zigbee \/ LoRa \u79c1\u6709\u5e27<\/p>\n<p>   \u2514\u2500 \u6839\u672c\u4e0d\u662f IP \u7f51\u7edc&#xff0c;   \u2514\u2500 \u8fd9\u4e00\u6bb5\u624d\u662f        \u2514\u2500 \u8ddf\u5d4c\u5165\u5f0f\u5173\u7cfb\u4e0d\u5927&#xff0c;<br \/>\n      \u8f6e\u4e0d\u5230 MQTT            MQTT \u7684\u4e3b\u6218\u573a         \u662f\u540e\u7aef\u7684\u4e8b<\/p>\n<p>\u6240\u4ee5\u542c\u5230&#034;\u8fd9\u8bbe\u5907\u7528\u4ec0\u4e48\u534f\u8bae&#034;&#xff0c;\u7b2c\u4e00\u4e2a\u8be5\u95ee\u7684\u662f&#034;\u4ece\u54ea\u513f\u5230\u54ea\u513f&#034;\u3002<\/p>\n<table>\n<tr>\u534f\u8bae\u8dd1\u5728\u62a5\u6587\u5f00\u9500\u6a21\u578b\u8be5\u7528\u7684\u5730\u65b9\u522b\u7528\u7684\u5730\u65b9<\/tr>\n<tbody>\n<tr>\n<td>MQTT<\/td>\n<td>TCP(&#043;TLS)<\/td>\n<td>\u56fa\u5b9a\u5934\u6700\u5c0f 2 B<\/td>\n<td>\u53d1\u5e03\/\u8ba2\u9605&#xff0c;\u957f\u8fde\u63a5&#xff0c;\u652f\u6301\u63a8\u9001<\/td>\n<td>\u8fb9\u2194\u4e91\u4e3b\u529b&#xff1b;\u9065\u6d4b &#043; \u4e0b\u884c\u547d\u4ee4&#xff1b;\u6709\u5e02\u7535\u8bbe\u5907<\/td>\n<td>\u7535\u6c60 &#043; NB-IoT \u7684\u6781\u4f4e\u9891\u4e0a\u62a5&#xff08;\u5fc3\u8df3\u672c\u8eab\u5c31\u8d39\u7535&#xff0c;\u89c1\u300a\u65e0\u7ebf_03\u300b&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>CoAP<\/td>\n<td>UDP<\/td>\n<td>\u56fa\u5b9a\u5934 4 B<\/td>\n<td>\u8bf7\u6c42\/\u54cd\u5e94&#xff08;\u50cf\u7cbe\u7b80 HTTP&#xff09;<\/td>\n<td>\u7535\u6c60\u8bbe\u5907 &#043; \u6781\u53d7\u9650\u7f51\u7edc&#xff1b;NB-IoT\/LoRa \u76f4\u8fde<\/td>\n<td>\u9700\u8981\u670d\u52a1\u7aef\u4e3b\u52a8\u63a8\u547d\u4ee4\u3001\u5bf9\u4e22\u5305\u96f6\u5bb9\u5fcd\u7684\u4e1a\u52a1<\/td>\n<\/tr>\n<tr>\n<td>HTTP(S)<\/td>\n<td>TCP<\/td>\n<td>\u6587\u672c\u5934&#xff0c;\u52a8\u8f84\u51e0\u767e\u5b57\u8282<\/td>\n<td>\u8bf7\u6c42\/\u54cd\u5e94&#xff0c;\u77ed\u8fde\u63a5<\/td>\n<td>\u5076\u5c14\u53d6\u914d\u7f6e\u3001\u4e0b\u8f7d\u56fa\u4ef6\u3001\u5bf9\u63a5 Web \u540e\u7aef<\/td>\n<td>\u9ad8\u9891\u9065\u6d4b&#xff08;\u5934\u6bd4\u8f7d\u8377\u5927&#xff09;&#xff1b;\u4e0b\u884c\u5b9e\u65f6\u63a7\u5236<\/td>\n<\/tr>\n<tr>\n<td>LwM2M<\/td>\n<td>\u901a\u5e38\u5728 CoAP \u4e4b\u4e0a<\/td>\n<td>\u540c CoAP<\/td>\n<td>\u9762\u5411&#034;\u8d44\u6e90&#034;&#xff08;\u5982 \/3\/0\/1&#xff09;<\/td>\n<td>\u8bbe\u5907\u7ba1\u7406&#xff1a;\u8fdc\u7a0b\u914d\u7f6e\u3001\u56fa\u4ef6\u5347\u7ea7\u3001\u751f\u547d\u5468\u671f<\/td>\n<td>\u5f53&#034;\u6570\u636e\u4e0a\u62a5\u534f\u8bae&#034;\u7528\u2014\u2014\u90a3\u4e0d\u662f\u5b83\u7684\u4e3b\u573a<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&#x1f4a1; \u4e00\u53e5\u8bdd\u8bb0\u5fc6&#xff1a;MQTT \u7ba1\u6765\u56de\u4f20\u6570\u636e&#xff0c;CoAP \u7ba1\u6781\u7701\u7535\u5730\u4f20\u4e00\u5305&#xff0c;HTTP \u7ba1\u8ddf Web \u4e16\u754c\u6253\u4ea4\u9053&#xff0c;LwM2M \u7ba1\u7ba1\u7406\u8bbe\u5907\u672c\u8eab\u3002 \u6210\u719f\u5e73\u53f0\u91cc\u8fd9\u56db\u4e2a\u5f80\u5f80\u540c\u65f6\u5728\u8dd1\u3002<\/p>\n<h4>6.1 \u4e3b\u9898\u547d\u540d&#xff1a;\u73b0\u5728\u591a\u82b1 5 \u5206\u949f&#xff0c;\u4ee5\u540e\u7701 5 \u5929<\/h4>\n<p>{\u4ea7\u54c1}\/{\u8bbe\u5907ID}\/{\u65b9\u5411}\/{\u7528\u9014}<br \/>\n   agri\/gw01\/up\/telemetry     \u4e0a\u884c&#xff1a;\u5468\u671f\u9065\u6d4b<br \/>\n   agri\/gw01\/up\/event         \u4e0a\u884c&#xff1a;\u4e8b\u4ef6\/\u544a\u8b66<br \/>\n   agri\/gw01\/up\/reply         \u4e0a\u884c&#xff1a;\u547d\u4ee4\u6267\u884c\u7ed3\u679c&#xff08;\u95ed\u73af&#xff01;&#xff09;<br \/>\n   agri\/gw01\/down\/cmd         \u4e0b\u884c&#xff1a;\u547d\u4ee4<br \/>\n   agri\/gw01\/status           \u72b6\u6001&#xff08;\u914d\u5408 retained &#043; \u9057\u5631&#xff09;<\/p>\n<p>\u8ba2\u9605\u4fa7&#xff1a;agri\/gw01\/down\/#&#xff08;\u8fd9\u53f0\u7684\u4e0b\u884c&#xff09;  agri\/&#043;\/up\/telemetry&#xff08;\u6240\u6709\u8bbe\u5907\u9065\u6d4b&#xff09;<\/p>\n<p>\u56db\u6761\u89c4\u77e9&#xff1a;\u2460 \u4e0d\u4ee5 \/ \u5f00\u5934&#xff08;\u4f1a\u4ea7\u751f\u7a7a\u5c42\u7ea7&#xff09;&#xff1b;\u2461 \u4e3b\u9898\u91cc\u4e0d\u653e\u52a8\u6001\u503c&#xff08;\u65f6\u95f4\u6233\u3001\u968f\u673a\u6570\u4e00\u5f8b\u8fdb payload&#xff0c;\u5426\u5219\u4e3b\u9898\u6811\u7206\u70b8&#xff09;&#xff1b;\u2462 \u5168\u5c0f\u5199 &#043; \u77ed\u6a2a\u7ebf&#xff0c;\u522b\u6df7\u5927\u5c0f\u5199&#xff1b;\u2463 \u4e3b\u9898\u91cc\u4e0d\u653e\u654f\u611f\u4fe1\u606f&#xff0c;\u5b83\u662f\u660e\u6587\u7684&#xff0c;\u9274\u6743\u9760\u7528\u6237\u540d\/\u5bc6\u7801\u6216\u8bc1\u4e66\u3002<\/p>\n<hr \/>\n<h3>\u4e03\u3001\u52a8\u624b&#xff1a;\u534a\u5c0f\u65f6\u642d\u4e00\u4e2a\u6700\u5c0f\u7aef\u8fb9\u4e91<\/h3>\n<p>\u8fd9\u5957\u6211\u81ea\u5df1\u5728\u7b14\u8bb0\u672c\u4e0a\u8dd1\u901a\u8fc7&#xff0c;\u4e0d\u9700\u8981\u4e70\u4e91\u3001\u4e0d\u9700\u8981\u516c\u7f51 IP&#xff0c;\u5168\u5728\u672c\u673a Docker \u91cc\u3002<\/p>\n<h4>\u7b2c 1 \u6b65&#xff1a;\u8d77\u4e00\u4e2a\u672c\u5730 Broker&#xff08;EMQX&#xff09;<\/h4>\n<p><span class=\"token function\">docker<\/span> run <span class=\"token parameter variable\">-d<\/span> <span class=\"token parameter variable\">&#8211;name<\/span> emqx <span class=\"token punctuation\">\\\\<\/span><br \/>\n  <span class=\"token parameter variable\">-p<\/span> <span class=\"token number\">1883<\/span>:1883  <span class=\"token punctuation\">\\\\<\/span>   <span class=\"token comment\"># MQTT over TCP<\/span><br \/>\n  <span class=\"token parameter variable\">-p<\/span> <span class=\"token number\">8083<\/span>:8083  <span class=\"token punctuation\">\\\\<\/span>   <span class=\"token comment\"># MQTT over WebSocket<\/span><br \/>\n  <span class=\"token parameter variable\">-p<\/span> <span class=\"token number\">8084<\/span>:8084  <span class=\"token punctuation\">\\\\<\/span>   <span class=\"token comment\"># MQTT over WSS<\/span><br \/>\n  <span class=\"token parameter variable\">-p<\/span> <span class=\"token number\">8883<\/span>:8883  <span class=\"token punctuation\">\\\\<\/span>   <span class=\"token comment\"># MQTT over TLS<\/span><br \/>\n  <span class=\"token parameter variable\">-p<\/span> <span class=\"token number\">18083<\/span>:18083 <span class=\"token punctuation\">\\\\<\/span>  <span class=\"token comment\"># Dashboard&#xff08;Web \u7ba1\u7406\u9875&#xff09;<\/span><br \/>\n  emqx\/emqx:latest<\/p>\n<p><span class=\"token function\">docker<\/span> logs <span class=\"token parameter variable\">-f<\/span> emqx     <span class=\"token comment\"># \u770b\u65e5\u5fd7\u786e\u8ba4\u8d77\u6765\u4e86<\/span><\/p>\n<p>\u6d4f\u89c8\u5668\u6253\u5f00 http:\/\/localhost:18083&#xff0c;\u9ed8\u8ba4\u8d26\u53f7\u5bc6\u7801 admin \/ public&#xff0c;\u9996\u6b21\u767b\u5f55\u4f1a\u8981\u6c42\u6539\u6389\u9ed8\u8ba4\u5bc6\u7801\u3002<\/p>\n<p>\u26a0\ufe0f \u540e\u9762\u8ba9 ESP32 \u8fde\u8fd9\u4e2a Broker \u65f6&#xff0c;\u5730\u5740\u4e0d\u80fd\u586b localhost \u6216 127.0.0.1\u2014\u2014\u90a3\u662f ESP32 \u81ea\u5df1\u3002\u8981\u7528\u7535\u8111\u5728\u5c40\u57df\u7f51\u91cc\u7684 IP&#xff08;ifconfig \/ ipconfig \u67e5&#xff09;\u3002\u8fd9\u662f&#034;ESP32 \u8fde\u4e0d\u4e0a EMQX&#034;\u7684\u5934\u53f7\u539f\u56e0&#xff0c;\u7b2c\u4e8c\u53f7\u662f\u9632\u706b\u5899\u6ca1\u653e\u884c 1883\u3002<\/p>\n<h4>\u7b2c 2 \u6b65&#xff1a;\u5148\u7528\u547d\u4ee4\u884c\u9a8c\u8bc1 Broker \u901a\u4e86<\/h4>\n<p><span class=\"token function\">sudo<\/span> <span class=\"token function\">apt<\/span> <span class=\"token function\">install<\/span> <span class=\"token parameter variable\">-y<\/span> mosquitto-clients        <span class=\"token comment\"># macOS: brew install mosquitto<\/span><\/p>\n<p><span class=\"token comment\"># \u7ec8\u7aef A&#xff1a;\u8ba2\u9605&#xff08;\u6a21\u62df&#034;\u4e91\/\u5e94\u7528&#034;\u4e00\u4fa7&#xff09;<\/span><br \/>\nmosquitto_sub <span class=\"token parameter variable\">-h<\/span> <span class=\"token number\">192.168<\/span>.1.100 <span class=\"token parameter variable\">-t<\/span> <span class=\"token string\">&#039;agri\/#&#039;<\/span> <span class=\"token parameter variable\">-v<\/span><br \/>\n<span class=\"token comment\"># \u7ec8\u7aef B&#xff1a;\u53d1\u5e03&#xff08;\u6a21\u62df&#034;\u8bbe\u5907&#034;\u4e00\u4fa7&#xff09;<\/span><br \/>\nmosquitto_pub <span class=\"token parameter variable\">-h<\/span> <span class=\"token number\">192.168<\/span>.1.100 <span class=\"token parameter variable\">-t<\/span> <span class=\"token string\">&#039;agri\/gw01\/up\/telemetry&#039;<\/span> <span class=\"token punctuation\">\\\\<\/span><br \/>\n  <span class=\"token parameter variable\">-m<\/span> <span class=\"token string\">&#039;{&#034;temp&#034;:26.5,&#034;humi&#034;:61,&#034;ts&#034;:1756000000}&#039;<\/span> <span class=\"token parameter variable\">-q<\/span> <span class=\"token number\">1<\/span><\/p>\n<p>\u7ec8\u7aef A \u5e94\u7acb\u523b\u6253\u5370\u51fa\u8fd9\u4e00\u6761\u3002\u610f\u4e49&#xff1a;\u5148\u628a\u4e91\u4fa7\u6253\u901a\u518d\u8c03\u8bbe\u5907&#xff0c;\u8fd9\u6837\u8bbe\u5907\u8054\u4e0d\u4e0a\u65f6\u4f60\u80fd\u786e\u5b9a\u95ee\u9898\u5728\u8bbe\u5907\u4fa7\u3002<\/p>\n<h4>\u7b2c 3 \u6b65&#xff1a;ESP32 \u4e0a\u62a5&#xff08;\u6700\u5c0f\u53ef\u7528\u7248&#xff09;<\/h4>\n<p><span class=\"token comment\">\/* &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061; ESP32 \/ ESP-IDF v5.x&#xff1a;\u6700\u5c0f MQTT \u4e0a\u62a5 &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;<br \/>\n * \u524d\u7f6e&#xff1a;Wi-Fi \u5df2\u8fde\u63a5\u5e76\u62ff\u5230 IP&#xff08;esp_wifi \u6216 example_connect \u5747\u53ef&#xff09;<br \/>\n * \u914d\u7f6e\u7ec6\u8282\u89c1\u672c\u7cfb\u5217\u4e0b\u4e00\u7bc7\u300aMQTT \u6df1\u5ea6\u5b9e\u6218\u300b<br \/>\n *\/<\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;stdbool.h&gt;<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;string.h&gt;<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&#034;mqtt_client.h&#034;<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&#034;esp_log.h&#034;<\/span><\/span><\/p>\n<p><span class=\"token keyword\">static<\/span> <span class=\"token keyword\">const<\/span> <span class=\"token keyword\">char<\/span> <span class=\"token operator\">*<\/span>TAG <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;app&#034;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">static<\/span> <span class=\"token class-name\">esp_mqtt_client_handle_t<\/span> s_client <span class=\"token operator\">&#061;<\/span> <span class=\"token constant\">NULL<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token keyword\">static<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">mqtt_event_handler<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">void<\/span> <span class=\"token operator\">*<\/span>handler_args<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">esp_event_base_t<\/span> base<span class=\"token punctuation\">,<\/span><br \/>\n                               <span class=\"token class-name\">int32_t<\/span> event_id<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token operator\">*<\/span>event_data<span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token class-name\">esp_mqtt_event_handle_t<\/span> event <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token class-name\">esp_mqtt_event_handle_t<\/span><span class=\"token punctuation\">)<\/span>event_data<span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token keyword\">switch<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">esp_mqtt_event_id_t<\/span><span class=\"token punctuation\">)<\/span>event_id<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">case<\/span> MQTT_EVENT_CONNECTED<span class=\"token operator\">:<\/span><br \/>\n        <span class=\"token function\">ESP_LOGI<\/span><span class=\"token punctuation\">(<\/span>TAG<span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;broker \u5df2\u8fde\u63a5&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token function\">esp_mqtt_client_subscribe<\/span><span class=\"token punctuation\">(<\/span>event<span class=\"token operator\">-&gt;<\/span>client<span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;agri\/gw01\/down\/cmd&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">1<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token keyword\">break<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token keyword\">case<\/span> MQTT_EVENT_DATA<span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token comment\">\/* \u26a0\ufe0f event-&gt;topic \/ event-&gt;data \u4e0d\u4ee5 &#039;\\\\0&#039; \u7ed3\u5c3e&#xff0c;\u5fc5\u987b\u6309\u957f\u5ea6\u62f7\u8d1d *\/<\/span><br \/>\n        <span class=\"token keyword\">char<\/span> topic<span class=\"token punctuation\">[<\/span><span class=\"token number\">64<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token keyword\">int<\/span> tlen <span class=\"token operator\">&#061;<\/span> event<span class=\"token operator\">-&gt;<\/span>topic_len<span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>tlen <span class=\"token operator\">&gt;&#061;<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span><span class=\"token punctuation\">)<\/span><span class=\"token keyword\">sizeof<\/span><span class=\"token punctuation\">(<\/span>topic<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> tlen <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span><span class=\"token punctuation\">)<\/span><span class=\"token keyword\">sizeof<\/span><span class=\"token punctuation\">(<\/span>topic<span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#8211;<\/span> <span class=\"token number\">1<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token function\">memcpy<\/span><span class=\"token punctuation\">(<\/span>topic<span class=\"token punctuation\">,<\/span> event<span class=\"token operator\">-&gt;<\/span>topic<span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token class-name\">size_t<\/span><span class=\"token punctuation\">)<\/span>tlen<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        topic<span class=\"token punctuation\">[<\/span>tlen<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token char\">&#039;\\\\0&#039;<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>        <span class=\"token function\">ESP_LOGI<\/span><span class=\"token punctuation\">(<\/span>TAG<span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;\u6536\u5230 [%s] qos&#061;%d : %.*s&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n                 topic<span class=\"token punctuation\">,<\/span> event<span class=\"token operator\">-&gt;<\/span>qos<span class=\"token punctuation\">,<\/span> event<span class=\"token operator\">-&gt;<\/span>data_len<span class=\"token punctuation\">,<\/span> event<span class=\"token operator\">-&gt;<\/span>data<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token comment\">\/* \u6267\u884c\u5b8c\u8bb0\u5f97\u5f80 &#8230;\/up\/reply \u56de\u62a5\u4e00\u6b21&#xff0c;\u5f62\u6210\u95ed\u73af *\/<\/span><br \/>\n        <span class=\"token keyword\">break<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><\/p>\n<p>    <span class=\"token keyword\">case<\/span> MQTT_EVENT_DISCONNECTED<span class=\"token operator\">:<\/span><br \/>\n        <span class=\"token function\">ESP_LOGW<\/span><span class=\"token punctuation\">(<\/span>TAG<span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;\u8fde\u63a5\u65ad\u5f00&#xff0c;esp-mqtt \u9ed8\u8ba4\u4f1a\u81ea\u52a8\u91cd\u8fde&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token keyword\">break<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token keyword\">default<\/span><span class=\"token operator\">:<\/span> <span class=\"token keyword\">break<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token keyword\">void<\/span> <span class=\"token function\">mqtt_app_start<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">void<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">const<\/span> <span class=\"token class-name\">esp_mqtt_client_config_t<\/span> cfg <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token punctuation\">.<\/span>broker<span class=\"token punctuation\">.<\/span>address<span class=\"token punctuation\">.<\/span>uri           <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;mqtt:\/\/192.168.1.100&#034;<\/span><span class=\"token punctuation\">,<\/span>  <span class=\"token comment\">\/* \u6362\u6210\u4f60\u7684\u5c40\u57df\u7f51 IP *\/<\/span><br \/>\n        <span class=\"token punctuation\">.<\/span>credentials<span class=\"token punctuation\">.<\/span>client_id        <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;esp32-gw01&#034;<\/span><span class=\"token punctuation\">,<\/span>            <span class=\"token comment\">\/* \u540c Broker \u5185\u5fc5\u987b\u552f\u4e00 *\/<\/span><br \/>\n        <span class=\"token punctuation\">.<\/span>session<span class=\"token punctuation\">.<\/span>keepalive            <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">60<\/span><span class=\"token punctuation\">,<\/span>                      <span class=\"token comment\">\/* \u79d2 *\/<\/span><br \/>\n        <span class=\"token punctuation\">.<\/span>network<span class=\"token punctuation\">.<\/span>reconnect_timeout_ms <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">5000<\/span><span class=\"token punctuation\">,<\/span><br \/>\n        <span class=\"token punctuation\">.<\/span>network<span class=\"token punctuation\">.<\/span>timeout_ms           <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">10000<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    s_client <span class=\"token operator\">&#061;<\/span> <span class=\"token function\">esp_mqtt_client_init<\/span><span class=\"token punctuation\">(<\/span><span class=\"token operator\">&amp;<\/span>cfg<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>s_client <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token constant\">NULL<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span> <span class=\"token function\">ESP_LOGE<\/span><span class=\"token punctuation\">(<\/span>TAG<span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;mqtt init \u5931\u8d25&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token keyword\">return<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token function\">esp_mqtt_client_register_event<\/span><span class=\"token punctuation\">(<\/span>s_client<span class=\"token punctuation\">,<\/span> ESP_EVENT_ANY_ID<span class=\"token punctuation\">,<\/span> mqtt_event_handler<span class=\"token punctuation\">,<\/span> <span class=\"token constant\">NULL<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token function\">esp_mqtt_client_start<\/span><span class=\"token punctuation\">(<\/span>s_client<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token comment\">\/* \u4e0a\u62a5\u4e00\u5305\u9065\u6d4b&#xff08;\u5728\u91c7\u96c6\u4efb\u52a1\u91cc\u8c03\u7528&#xff09; *\/<\/span><br \/>\nbool <span class=\"token function\">telemetry_publish<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">float<\/span> temp<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">float<\/span> humi<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">int64_t<\/span> ts_ms<span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>s_client <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token constant\">NULL<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">return<\/span> false<span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token keyword\">char<\/span> payload<span class=\"token punctuation\">[<\/span><span class=\"token number\">128<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">int<\/span> n <span class=\"token operator\">&#061;<\/span> <span class=\"token function\">snprintf<\/span><span class=\"token punctuation\">(<\/span>payload<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">sizeof<\/span><span class=\"token punctuation\">(<\/span>payload<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><br \/>\n                     <span class=\"token string\">&#034;{\\\\&#034;temp\\\\&#034;:%.1f,\\\\&#034;humi\\\\&#034;:%.1f,\\\\&#034;ts\\\\&#034;:%lld}&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n                     <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">double<\/span><span class=\"token punctuation\">)<\/span>temp<span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">double<\/span><span class=\"token punctuation\">)<\/span>humi<span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">long<\/span> <span class=\"token keyword\">long<\/span><span class=\"token punctuation\">)<\/span>ts_ms<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>n <span class=\"token operator\">&lt;&#061;<\/span> <span class=\"token number\">0<\/span> <span class=\"token operator\">||<\/span> n <span class=\"token operator\">&gt;&#061;<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span><span class=\"token punctuation\">)<\/span><span class=\"token keyword\">sizeof<\/span><span class=\"token punctuation\">(<\/span>payload<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">return<\/span> false<span class=\"token punctuation\">;<\/span>   <span class=\"token comment\">\/* \u683c\u5f0f\u5316\u5931\u8d25\u6216\u622a\u65ad *\/<\/span><\/p>\n<p>    <span class=\"token comment\">\/* QoS 1&#xff1a;\u8981\u7b49 PUBACK\u3002\u8fd4\u56de &gt;&#061;0 \u7684 msg_id \u624d\u7b97\u8fdb\u4e86\u53d1\u9001\u961f\u5217 *\/<\/span><br \/>\n    <span class=\"token keyword\">int<\/span> msg_id <span class=\"token operator\">&#061;<\/span> <span class=\"token function\">esp_mqtt_client_publish<\/span><span class=\"token punctuation\">(<\/span>s_client<span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;agri\/gw01\/up\/telemetry&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n                                         payload<span class=\"token punctuation\">,<\/span> n<span class=\"token punctuation\">,<\/span> <span class=\"token number\">1<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>msg_id <span class=\"token operator\">&lt;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token function\">ESP_LOGW<\/span><span class=\"token punctuation\">(<\/span>TAG<span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;publish \u5931\u8d25: %d&#xff08;-2 &#061; outbox \u6ee1&#xff0c;\u53d1\u7684\u6bd4\u7f51\u7edc\u5feb&#xff09;&#034;<\/span><span class=\"token punctuation\">,<\/span> msg_id<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token keyword\">return<\/span> false<span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> true<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h4>\u7b2c 4 \u6b65&#xff1a;\u7528 Node-RED \u5f53\u90a3\u4e2a&#034;\u4e91\u4e0a\u5e94\u7528&#034;<\/h4>\n<p><span class=\"token function\">npm<\/span> <span class=\"token function\">install<\/span> <span class=\"token parameter variable\">-g<\/span> node-red <span class=\"token operator\">&amp;&amp;<\/span> node-red        <span class=\"token comment\"># \u6253\u5f00 http:\/\/localhost:1880<\/span><br \/>\n<span class=\"token comment\"># \u6216&#xff1a;docker run -d -p 1880:1880 &#8211;name nodered nodered\/node-red<\/span><\/p>\n<p>\u62d6\u56db\u4e2a\u8282\u70b9\u8fde\u6210\u4e00\u6761\u7ebf&#xff0c;\u8fd9\u5c31\u662f\u4e91\u5c42\u5728\u5e72\u7684\u4e8b&#xff1a;\u89e3\u6790 \u2192 \u5b58\u50a8 \u2192 \u5c55\u793a\u3002<\/p>\n<p>  \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510   \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510   \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510   \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n  \u2502 mqtt in  \u2502\u2500\u2500&gt;\u2502   json    \u2502\u2500\u2500&gt;\u2502 function \u2502\u2500\u2500&gt;\u2502 debug \/ \u2502<br \/>\n  \u2502 agri\/#   \u2502   \u2502 \u89e3\u6790\u5b57\u7b26\u4e32 \u2502   \u2502 \u63d0\u53d6\u5b57\u6bb5  \u2502   \u2502 chart   \u2502<br \/>\n  \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518   \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518   \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518   \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<\/p>\n<p>mqtt in \u8282\u70b9\u586b Server 192.168.1.100:1883\u3001Topic agri\/#\u3001QoS 1&#xff1b;function \u8282\u70b9\u53ea\u5199\u4e00\u884c&#xff1a;<\/p>\n<p><span class=\"token comment\">\/\/ Node-RED function \u8282\u70b9\u5185&#xff08;JavaScript&#xff09;<\/span><br \/>\nmsg<span class=\"token punctuation\">.<\/span>payload <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">{<\/span> <span class=\"token literal-property property\">value<\/span><span class=\"token operator\">:<\/span> msg<span class=\"token punctuation\">.<\/span>payload<span class=\"token punctuation\">.<\/span>temp<span class=\"token punctuation\">,<\/span> <span class=\"token literal-property property\">ts<\/span><span class=\"token operator\">:<\/span> msg<span class=\"token punctuation\">.<\/span>payload<span class=\"token punctuation\">.<\/span>ts <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">return<\/span> msg<span class=\"token punctuation\">;<\/span><\/p>\n<p>\u70b9 Deploy&#xff0c;\u518d\u7528 mosquitto_pub \u53d1\u4e00\u6b21&#xff0c;debug \u9762\u677f\u5e94\u7acb\u523b\u51fa\u73b0\u6570\u636e\u3002\u5230\u8fd9\u4e00\u6b65\u4f60\u5df2\u8dd1\u901a\u5b8c\u6574\u7684&#034;\u7aef \u2192 \u4e91 \u2192 \u5e94\u7528&#034;\u94fe\u8def\u2014\u2014\u53ea\u4e0d\u8fc7&#034;\u8fb9&#034;\u76ee\u524d\u662f\u7a7a\u7684\u3002<\/p>\n<h4>\u7b2c 5 \u6b65&#xff1a;\u628a&#034;\u8fb9&#034;\u52a0\u56de\u6765&#xff0c;\u505a\u5bf9\u6bd4\u5b9e\u9a8c<\/h4>\n<li>\u4e0d\u805a\u5408&#xff1a;ESP32 \u6bcf 2 \u79d2\u53d1\u4e00\u5305&#xff0c;\u53bb EMQX Dashboard \u770b\u6d88\u606f\u901f\u7387&#xff1b;<\/li>\n<li>\u52a0\u4e0a\u8fb9&#xff1a;\u5728 ESP32 \u91cc\u505a 10 \u79d2\u6ed1\u52a8\u7a97\u53e3&#xff0c;\u53ea\u6709&#034;\u6e29\u5ea6\u53d8\u5316\u8d85 0.5 \u2103 \u6216\u8d85\u8fc7 30 \u79d2\u6ca1\u53d1&#034;\u624d\u4e0a\u62a5&#xff1b;<\/li>\n<li>\u5bf9\u6bd4 Dashboard \u4e0a\u7684\u300c\u6d88\u606f\u6570 \/ \u5206\u949f\u300d\u3002<\/li>\n<p>\u4f60\u4f1a\u770b\u5230\u4e00\u4e2a\u6570\u91cf\u7ea7\u7684\u5dee\u522b&#xff0c;\u4e14\u6570\u636e\u51e0\u4e4e\u6ca1\u6709\u4fe1\u606f\u635f\u5931\u2014\u2014\u8fd9\u5c31\u662f 4.1 \u90a3\u7b14\u8d26\u7684\u5b9e\u7269\u7248\u3002<\/p>\n<hr \/>\n<h3>\u516b\u3001\u65b0\u624b\u5fc5\u8e29\u7684 8 \u4e2a\u5751<\/h3>\n<table>\n<tr>#\u5751\u73b0\u8c61 \/ \u540e\u679c\u6b63\u786e\u505a\u6cd5<\/tr>\n<tbody>\n<tr>\n<td>1<\/td>\n<td>\u6240\u6709\u8bbe\u5907\u76f4\u8fde\u4e91&#xff0c;\u4e0d\u8003\u8651\u7f51\u5173<\/td>\n<td>\u8fde\u63a5\u6570\u7206\u70b8\u3001\u6d41\u91cf\u8d39\u9ad8\u3001\u7535\u6c60\u6491\u4e0d\u8fc7\u4e00\u5468<\/td>\n<td>\u5148\u95ee&#034;\u6709\u6ca1\u6709\u5e02\u7535\u3001\u6570\u91cf\u591a\u5c11&#034;&#xff0c;10 \u4e2a\u4ee5\u4e0a\u7535\u6c60\u8282\u70b9\u5c31\u8be5\u8003\u8651\u8fb9<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>ESP32 \u91cc Broker \u5730\u5740\u586b localhost \/ 127.0.0.1<\/td>\n<td>\u8fde\u4e0d\u4e0a&#xff0c;\u65e5\u5fd7\u4e00\u7247\u8d85\u65f6<\/td>\n<td>\u586b\u7535\u8111\u7684\u5c40\u57df\u7f51 IP&#xff1b;\u786e\u8ba4\u9632\u706b\u5899\u653e\u884c 1883<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>\u65ad\u7f51\u65f6\u76f4\u63a5\u4e22\u6570\u636e<\/td>\n<td>\u7f51\u7edc\u4e00\u6296&#xff0c;\u8fd9\u6bb5\u65f6\u95f4\u6570\u636e\u6c38\u4e45\u7f3a\u5931<\/td>\n<td>\u672c\u5730\u961f\u5217 &#043; \u91c7\u6837\u65f6\u6253\u65f6\u95f4\u6233 &#043; \u961f\u5217\u6709\u4e0a\u9650 &#043; \u8865\u4f20\u9650\u901f<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>\u65f6\u95f4\u6233\u5728\u4e0a\u4f20\u65f6\u6253&#xff0c;\u4e0d\u662f\u91c7\u6837\u65f6\u6253<\/td>\n<td>\u8865\u4f20\u7684\u5386\u53f2\u6570\u636e\u5168\u6324\u540c\u4e00\u65f6\u523b&#xff0c;\u66f2\u7ebf\u662f\u5047\u7684<\/td>\n<td>\u91c7\u6837\u90a3\u4e00\u523b\u5c31\u6253&#xff1b;\u6216\u7ef4\u62a4\u5e8f\u53f7\u7531\u5e73\u53f0\u8fd8\u539f<\/td>\n<\/tr>\n<tr>\n<td>5<\/td>\n<td>\u6240\u6709\u6d88\u606f\u585e\u8fdb\u4e00\u4e2a\u4e3b\u9898<\/td>\n<td>\u4e91\u7aef\u89c4\u5219\u5199\u4e0d\u52a8\u3001\u6ca1\u6cd5\u8fc7\u6ee4\u3001retained \u7528\u4e0d\u4e86<\/td>\n<td>\u6309 {\u4ea7\u54c1}\/{\u8bbe\u5907}\/{\u65b9\u5411}\/{\u7528\u9014} \u5206\u5c42&#xff0c;\u4e00\u7528\u9014\u4e00\u4e3b\u9898<\/td>\n<\/tr>\n<tr>\n<td>6<\/td>\n<td>\u4e3b\u9898\u4ee5 \/ \u5f00\u5934&#xff0c;\u6216\u628a\u65f6\u95f4\u6233\u62fc\u8fdb\u4e3b\u9898<\/td>\n<td>\u591a\u51fa\u7a7a\u5c42\u7ea7&#xff1b;\u4e3b\u9898\u6811\u7206\u70b8\u6491\u7206 Broker \u5185\u5b58<\/td>\n<td>\u4e0d\u4ee5 \/ \u5f00\u5934&#xff1b;\u4e3b\u9898\u53ea\u653e\u7a33\u5b9a\u6807\u8bc6&#xff0c;\u52a8\u6001\u503c\u8fdb payload<\/td>\n<\/tr>\n<tr>\n<td>7<\/td>\n<td>\u4e0b\u884c\u547d\u4ee4\u53d1\u51fa\u53bb\u5c31\u4e0d\u7ba1<\/td>\n<td>App \u663e\u793a&#034;\u5df2\u53d1\u9001&#034;&#xff0c;\u4e0d\u77e5\u8bbe\u5907\u6709\u6ca1\u6709\u6267\u884c<\/td>\n<td>\u8bbe\u5907\u6267\u884c\u5b8c\u56de\u62a5 &#8230;\/up\/reply&#xff0c;\u5f62\u6210\u95ed\u73af<\/td>\n<\/tr>\n<tr>\n<td>8<\/td>\n<td>\u8fb9\u8fd9\u5c42\u786c\u4ef6\u9009\u578b\u62cd\u8111\u888b<\/td>\n<td>\u6811\u8393\u6d3e\u505a\u7535\u6c60\u573a\u666f\u51e0\u5c0f\u65f6\u6ca1\u7535&#xff1b;ESP32 \u786c\u625b\u4e00\u5468\u7f13\u5b58\u6491\u4e0d\u4f4f<\/td>\n<td>\u5148\u7b97&#034;\u7f13\u5b58\u591a\u5927\u3001\u8981\u4e0d\u8981\u8dd1\u5bb9\u5668\u3001\u529f\u8017\u9884\u7b97\u591a\u5c11&#034;\u518d\u9009<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h3>\u4e5d\u3001\u52a8\u624b\u7ec3\u4e00\u7ec3<\/h3>\n<p>\u6309\u987a\u5e8f\u505a\u3002\u7b2c 3 \u6b65\u548c\u7b2c 5 \u6b65\u662f\u6545\u610f\u641e\u7834\u574f\u2014\u2014\u53ea\u6709\u4eb2\u773c\u89c1\u8fc7\u6545\u969c\u73b0\u8c61&#xff0c;\u4ee5\u540e\u624d\u8ba4\u5f97\u51fa\u5b83\u3002<\/p>\n<h4>\u7ec3\u4e60 1&#xff1a;\u628a\u672c\u673a\u7aef\u8fb9\u4e91\u8dd1\u901a&#xff08;30 \u5206\u949f&#xff09;<\/h4>\n<p>\u6309\u7b2c\u4e03\u7ae0\u505a\u5b8c\u3002\u9a8c\u6536\u6807\u51c6&#xff1a;ESP32 \u4e0a\u7535\u540e Node-RED \u7684 debug \u9762\u677f\u6301\u7eed\u6536\u5230\u6570\u636e&#xff0c;EMQX Dashboard \u7684 Clients \u9875\u80fd\u770b\u5230 esp32-gw01 \u5728\u7ebf\u3002<\/p>\n<h4>\u7ec3\u4e60 2&#xff1a;\u7528\u547d\u4ee4\u884c\u624b\u52a8\u6a21\u62df&#034;\u8bbe\u5907&#034;\u548c&#034;\u5e94\u7528&#034;<\/h4>\n<p>\u4e0d\u5f00 ESP32&#xff0c;\u53ea\u7528\u4e24\u4e2a\u7ec8\u7aef\u4e92\u53d1\u3002\u8981\u6c42&#xff1a;\u4f60\u80fd\u8bf4\u51fa\u8fd9\u4e00\u5305\u4ece&#034;\u53d1\u5e03\u8005 \u2192 Broker \u2192 \u8ba2\u9605\u8005&#034;\u7ecf\u8fc7\u54ea\u4e9b\u73af\u8282&#xff0c;\u5e76\u6307\u51fa Broker \u5728\u91cc\u9762\u7684\u4f5c\u7528\u3002<\/p>\n<h4>\u7ec3\u4e60 3&#xff08;\u6545\u610f\u8bd5\u9519&#xff09;&#xff1a;\u6390\u65ad\u7f51\u7edc&#xff0c;\u770b\u6570\u636e\u4f1a\u4e0d\u4f1a\u4e22<\/h4>\n<p>\u8ba9 ESP32 \u6b63\u5e38\u4e0a\u62a5&#xff0c;\u7136\u540e\u76f4\u63a5\u5173\u6389\u7535\u8111 Wi-Fi&#xff08;\u6216 docker stop emqx&#xff09;&#xff0c;\u7b49 30 \u79d2\u518d\u6062\u590d\u3002\u6ca1\u6709\u672c\u5730\u961f\u5217\u7684\u8bdd&#xff0c;\u8fd9 30 \u79d2\u7684\u6570\u636e\u4e0d\u89c1\u4e86&#xff0c;\u800c\u4e14\u65e5\u5fd7\u91cc\u53ef\u80fd\u4ec0\u4e48\u90fd\u770b\u4e0d\u51fa\u6765\u3002\u7136\u540e\u52a0\u4e00\u4e2a\u6700\u7b80\u5355\u7684\u961f\u5217&#xff08;\u54ea\u6015\u53ea\u662f\u5185\u5b58\u91cc\u7684\u73af\u5f62\u6570\u7ec4 &#043; \u8865\u4f20&#xff09;&#xff0c;\u518d\u8bd5\u4e00\u6b21\u3002<\/p>\n<p>\u610f\u4e49&#xff1a;\u8fd9\u662f&#034;\u80fd\u6f14\u793a\u7684 demo&#034;\u548c&#034;\u80fd\u4ea4\u4ed8\u7684\u7cfb\u7edf&#034;\u4e4b\u95f4\u7684\u5206\u6c34\u5cad\u3002<\/p>\n<h4>\u7ec3\u4e60 4&#xff1a;\u6539\u4e3b\u9898\u7ed3\u6784&#xff0c;\u4f53\u4f1a\u8fc7\u6ee4\u7684\u5a01\u529b<\/h4>\n<p>\u5148\u628a\u6240\u6709\u6570\u636e\u90fd\u53d1\u5230 agri\/data&#xff0c;\u5728 Node-RED \u91cc\u5199\u8fc7\u6ee4\u903b\u8f91&#xff1b;\u518d\u6539\u6210 agri\/gw01\/up\/telemetry \u7684\u5206\u5c42\u7ed3\u6784&#xff0c;\u7528 agri\/&#043;\/up\/telemetry \u8ba2\u9605\u3002\u5bf9\u6bd4\u4e24\u79cd\u5199\u6cd5\u4e0b Node-RED \u6d41\u7a0b\u7684\u590d\u6742\u5ea6&#xff0c;\u4f60\u5c31\u660e\u767d\u4e3a\u4ec0\u4e48\u8981\u5206\u5c42\u3002<\/p>\n<h4>\u7ec3\u4e60 5&#xff08;\u6545\u610f\u8bd5\u9519&#xff09;&#xff1a;\u628a Broker \u5730\u5740\u5199\u9519&#xff0c;\u5b66\u4f1a\u770b\u9519\u8bef<\/h4>\n<p>\u628a .broker.address.uri \u6539\u6210 mqtt:\/\/192.168.1.999 \u91cd\u65b0\u70e7\u5f55&#xff0c;\u770b\u4e32\u53e3\u65e5\u5fd7\u91cc MQTT_EVENT_ERROR \u7684 error_type&#xff0c;\u7136\u540e\u5bf9\u6bd4\u4e24\u79cd\u60c5\u51b5&#xff1a;IP \u4e0d\u5b58\u5728\u662f\u4f20\u8f93\u5c42&#xff08;TCP&#xff09;\u5931\u8d25\u4e14\u53cd\u590d\u91cd\u8bd5&#xff1b;IP \u5b58\u5728\u4f46\u7aef\u53e3\u6ca1\u5f00&#xff08;\u5982\u586b 1884&#xff09;\u662f\u8fde\u63a5\u88ab\u62d2&#xff0c;\u91cd\u8fde\u95f4\u9694\u7531 reconnect_timeout_ms \u51b3\u5b9a\u3002<\/p>\n<p>\u610f\u4e49&#xff1a;\u4ee5\u540e\u9047\u5230&#034;\u8bbe\u5907\u79bb\u7ebf&#034;&#xff0c;\u4f60\u80fd\u7b2c\u4e00\u65f6\u95f4\u5206\u6e05\u662f&#034;\u7f51\u7edc\u4e0d\u901a&#034;\u8fd8\u662f&#034;Broker \u4e0d\u8ba4\u6211&#034;&#xff0c;\u800c\u4e0d\u662f\u76f2\u76ee\u91cd\u542f\u3002<\/p>\n<hr \/>\n<h3>\u5c0f\u7ed3<\/h3>\n<ul>\n<li>\u7aef-\u8fb9-\u4e91\u662f\u4e09\u6b21\u5206\u5de5&#xff1a;\u7aef\u63a5\u89e6\u7269\u7406\u4e16\u754c&#xff0c;\u8fb9\u5c31\u5730\u89e3\u51b3\u672c\u5730\u8be5\u89e3\u51b3\u7684\u4e8b&#xff0c;\u4e91\u8d1f\u8d23\u5168\u5c40\u548c\u8bb0\u5fc6\u3002<\/li>\n<li>\u8fb9\u7684\u4ef7\u503c\u80fd\u6298\u7b97\u6210\u94b1\u548c\u53ef\u9760\u6027&#xff1a;\u7701\u5e26\u5bbd&#xff08;\u805a\u5408&#xff09;\u3001\u7701\u7535&#xff08;\u91cd\u6d3b\u4ece\u7535\u6c60\u8282\u70b9\u62ff\u8d70&#xff09;\u3001\u65ad\u7f51\u7eed\u4f20&#xff08;\u6570\u636e\u4e0d\u4e22&#xff09;\u3001\u672c\u5730\u8054\u52a8&#xff08;\u65ad\u7f51\u4e5f\u80fd\u63a7&#xff09;\u3002\u6bcf\u6761\u90fd\u80fd\u8bb2\u51fa\u4e00\u4e2a\u5177\u4f53\u573a\u666f\u3002<\/li>\n<li>\u534f\u8bae\u662f\u5206\u6bb5\u7684&#xff1a;\u7aef\u2194\u8fb9\u5e38\u5e38\u6839\u672c\u4e0d\u662f IP \u7f51\u7edc&#xff0c;\u8fb9\u2194\u4e91\u624d\u662f MQTT \u7684\u4e3b\u573a\u3002\u522b\u95ee&#034;MQTT \u548c CoAP \u54ea\u4e2a\u597d&#034;&#xff0c;\u8981\u95ee&#034;\u8fd9\u4e00\u6bb5\u7528\u54ea\u4e2a&#034;\u3002<\/li>\n<li>\u4e3b\u9898\u8bbe\u8ba1\u8981\u8d81\u65e9&#xff1a;{\u4ea7\u54c1}\/{\u8bbe\u5907}\/{\u65b9\u5411}\/{\u7528\u9014}&#xff0c;\u4e00\u7528\u9014\u4e00\u4e3b\u9898&#xff0c;\u52a8\u6001\u503c\u8fdb payload\u3002\u73b0\u5728\u5077\u61d2&#xff0c;\u4ee5\u540e\u8981\u8fd8\u3002<\/li>\n<li>\u4e0b\u884c\u5fc5\u987b\u6709\u56de\u62a5&#xff0c;\u5426\u5219\u4f60\u7684\u7cfb\u7edf\u6c38\u8fdc\u53ea\u6709\u5f00\u73af\u3002<\/li>\n<\/ul>\n<p>\u53c2\u8003&#xff1a;MQTT 3.1.1 \/ 5.0 \u534f\u8bae\u89c4\u8303&#xff08;OASIS&#xff09;&#xff1b;EMQX \u5b98\u65b9\u6587\u6863&#xff08;Docker \u90e8\u7f72\u4e0e Dashboard \u7aef\u53e3&#xff09;&#xff1b;\u4e50\u946b ESP-IDF \u7f16\u7a0b\u6307\u5357\u4e2d esp-mqtt \u7ec4\u4ef6\u7684\u914d\u7f6e\u8bf4\u660e\u3002\u6587\u4e2d\u534f\u8bae\u5f00\u9500\u4e0e\u6d41\u91cf\u4f30\u7b97\u4e3a\u5178\u578b\u503c&#xff0c;\u5b9e\u9645\u8bf7\u4ee5\u6293\u5305&#xff08;Wireshark&#xff09;\u6216 Broker \u4fa7\u7edf\u8ba1\u4e3a\u51c6\u3002<\/p>\n<p>\u4e0b\u4e00\u7bc7&#xff1a;MQTT \u6df1\u5ea6\u5b9e\u6218\u2014\u2014QoS\u3001\u4fdd\u7559\u6d88\u606f\u3001\u9057\u5631\u4e0e\u8ba2\u9605\u6811&#xff0c;ESP32 \u5bf9\u63a5 Broker<\/p>\n","protected":false},"excerpt":{"rendered":"<p>IoT \u7cfb\u5217\u7b2c 1 \u7bc7\u3002\u5728\u300a09_\u65e0\u7ebf\u901a\u4fe1\u300b\u91cc\u6211\u4eec\u89e3\u51b3\u4e86\\&#8221;\u6570\u636e\u600e\u4e48\u98de\u51fa\u53bb\\&#8221;&#xff0c;\u8fd9\u4e00\u7bc7\u5f80\u4e0a\u62ac\u4e00\u5c42&#xff0c;\u770b\u6574\u5f20\u5730\u56fe\u3002\u9002\u7528\u4eba\u7fa4&#xff1a;\u73a9\u8fc7 STM32 \u6216 ESP32\u3001\u80fd\u8bfb\u4f20\u611f\u5668\u3001\u80fd\u8fde Wi-Fi&#xff0c;\u4f46\u4e00\u88ab\u95ee\\&#8221;\u4f60\u8fd9\u5957\u4e1c\u897f\u67b6\u6784\u662f\u600e\u6837\u7684\\&#8221;\u5c31\u7b54\u4e0d\u4e0a\u6765\u7684\u540c\u5b66\u3002\u4e0d\u9700\u8981\u670d\u52a1\u5668\u7ecf\u9a8c&#xff0c;Docker \u547d\u4ee4\u6211\u4f1a\u4ece 0 \u7ed9\u3002<br \/>\n\u8bfb\u5b8c\u4f60\u80fd\u5f97\u5230&#xff1a;<br \/>\n\u4e00\u5f20\u80fd\u9ed8\u51fa\u6765\u7684\u7aef-\u8fb9-\u4e91\u4e09\u5c42\u67b6\u6784\u56fe&#xff0c;\u9762\u8bd5\u753b\u5728\u767d\u677f\u4e0a\u4e0d\u5fc3\u865a&#xff1b;\u201c\u4e3a\u4ec0\u4e48<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[219,220,442],"topic":[],"class_list":["post-115134","post","type-post","status-publish","format-standard","hentry","category-server","tag-219","tag-220","tag-442"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>IoT \u7cfb\u7edf\u67b6\u6784\u5168\u666f\uff1a\u4ece\u4f20\u611f\u5668\u5230\u4e91\uff0c\u4e00\u5f20\u56fe\u8bb2\u6e05\u201c\u7aef-\u8fb9-\u4e91\u201c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/115134.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"IoT \u7cfb\u7edf\u67b6\u6784\u5168\u666f\uff1a\u4ece\u4f20\u611f\u5668\u5230\u4e91\uff0c\u4e00\u5f20\u56fe\u8bb2\u6e05\u201c\u7aef-\u8fb9-\u4e91\u201c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"IoT \u7cfb\u5217\u7b2c 1 \u7bc7\u3002\u5728\u300a09_\u65e0\u7ebf\u901a\u4fe1\u300b\u91cc\u6211\u4eec\u89e3\u51b3\u4e86&quot;\u6570\u636e\u600e\u4e48\u98de\u51fa\u53bb&quot;&#xff0c;\u8fd9\u4e00\u7bc7\u5f80\u4e0a\u62ac\u4e00\u5c42&#xff0c;\u770b\u6574\u5f20\u5730\u56fe\u3002\u9002\u7528\u4eba\u7fa4&#xff1a;\u73a9\u8fc7 STM32 \u6216 ESP32\u3001\u80fd\u8bfb\u4f20\u611f\u5668\u3001\u80fd\u8fde Wi-Fi&#xff0c;\u4f46\u4e00\u88ab\u95ee&quot;\u4f60\u8fd9\u5957\u4e1c\u897f\u67b6\u6784\u662f\u600e\u6837\u7684&quot;\u5c31\u7b54\u4e0d\u4e0a\u6765\u7684\u540c\u5b66\u3002\u4e0d\u9700\u8981\u670d\u52a1\u5668\u7ecf\u9a8c&#xff0c;Docker \u547d\u4ee4\u6211\u4f1a\u4ece 0 \u7ed9\u3002 \u8bfb\u5b8c\u4f60\u80fd\u5f97\u5230&#xff1a; \u4e00\u5f20\u80fd\u9ed8\u51fa\u6765\u7684\u7aef-\u8fb9-\u4e91\u4e09\u5c42\u67b6\u6784\u56fe&#xff0c;\u9762\u8bd5\u753b\u5728\u767d\u677f\u4e0a\u4e0d\u5fc3\u865a&#xff1b;\u201c\u4e3a\u4ec0\u4e48\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/115134.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-11T01:32:56+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/115134.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/115134.html\",\"name\":\"IoT \u7cfb\u7edf\u67b6\u6784\u5168\u666f\uff1a\u4ece\u4f20\u611f\u5668\u5230\u4e91\uff0c\u4e00\u5f20\u56fe\u8bb2\u6e05\u201c\u7aef-\u8fb9-\u4e91\u201c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-11T01:32:56+00:00\",\"dateModified\":\"2026-10-11T01:32:56+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/115134.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/115134.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/115134.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"IoT \u7cfb\u7edf\u67b6\u6784\u5168\u666f\uff1a\u4ece\u4f20\u611f\u5668\u5230\u4e91\uff0c\u4e00\u5f20\u56fe\u8bb2\u6e05\u201c\u7aef-\u8fb9-\u4e91\u201c\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"IoT \u7cfb\u7edf\u67b6\u6784\u5168\u666f\uff1a\u4ece\u4f20\u611f\u5668\u5230\u4e91\uff0c\u4e00\u5f20\u56fe\u8bb2\u6e05\u201c\u7aef-\u8fb9-\u4e91\u201c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/115134.html","og_locale":"zh_CN","og_type":"article","og_title":"IoT \u7cfb\u7edf\u67b6\u6784\u5168\u666f\uff1a\u4ece\u4f20\u611f\u5668\u5230\u4e91\uff0c\u4e00\u5f20\u56fe\u8bb2\u6e05\u201c\u7aef-\u8fb9-\u4e91\u201c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"IoT \u7cfb\u5217\u7b2c 1 \u7bc7\u3002\u5728\u300a09_\u65e0\u7ebf\u901a\u4fe1\u300b\u91cc\u6211\u4eec\u89e3\u51b3\u4e86\"\u6570\u636e\u600e\u4e48\u98de\u51fa\u53bb\"&#xff0c;\u8fd9\u4e00\u7bc7\u5f80\u4e0a\u62ac\u4e00\u5c42&#xff0c;\u770b\u6574\u5f20\u5730\u56fe\u3002\u9002\u7528\u4eba\u7fa4&#xff1a;\u73a9\u8fc7 STM32 \u6216 ESP32\u3001\u80fd\u8bfb\u4f20\u611f\u5668\u3001\u80fd\u8fde Wi-Fi&#xff0c;\u4f46\u4e00\u88ab\u95ee\"\u4f60\u8fd9\u5957\u4e1c\u897f\u67b6\u6784\u662f\u600e\u6837\u7684\"\u5c31\u7b54\u4e0d\u4e0a\u6765\u7684\u540c\u5b66\u3002\u4e0d\u9700\u8981\u670d\u52a1\u5668\u7ecf\u9a8c&#xff0c;Docker \u547d\u4ee4\u6211\u4f1a\u4ece 0 \u7ed9\u3002 \u8bfb\u5b8c\u4f60\u80fd\u5f97\u5230&#xff1a; \u4e00\u5f20\u80fd\u9ed8\u51fa\u6765\u7684\u7aef-\u8fb9-\u4e91\u4e09\u5c42\u67b6\u6784\u56fe&#xff0c;\u9762\u8bd5\u753b\u5728\u767d\u677f\u4e0a\u4e0d\u5fc3\u865a&#xff1b;\u201c\u4e3a\u4ec0\u4e48","og_url":"https:\/\/www.wsisp.com\/helps\/115134.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-11T01:32:56+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"8 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/115134.html","url":"https:\/\/www.wsisp.com\/helps\/115134.html","name":"IoT \u7cfb\u7edf\u67b6\u6784\u5168\u666f\uff1a\u4ece\u4f20\u611f\u5668\u5230\u4e91\uff0c\u4e00\u5f20\u56fe\u8bb2\u6e05\u201c\u7aef-\u8fb9-\u4e91\u201c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-11T01:32:56+00:00","dateModified":"2026-10-11T01:32:56+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/115134.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/115134.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/115134.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"IoT \u7cfb\u7edf\u67b6\u6784\u5168\u666f\uff1a\u4ece\u4f20\u611f\u5668\u5230\u4e91\uff0c\u4e00\u5f20\u56fe\u8bb2\u6e05\u201c\u7aef-\u8fb9-\u4e91\u201c"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/115134","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=115134"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/115134\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=115134"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=115134"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=115134"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=115134"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}