
USR-M300 Íø¿Ú½ÓMODBUS TCPÁ¬½Ó°¢ÀïÔÆJsonÏ·¢Ê¾Àý
±¸×¢£º±¾°¸ÀýÊÇUSR-M300ÁªÍø£¬ºÍ°¢ÀïÔÆ·þÎñÆ÷½¨Á¢Á¬½Ó£¬USR-M300µÄÍø¿ÚLAN¿Ú½ÓÍø¿Ú MODBUS TCP´Ó»ú£¬°¢ÀïÔÆ·þÎñÆ÷JSONÏ·¢Ð´´Ó»ú¼Ä´æÆ÷µØÖ·Êý¾Ý¡£
Ò»¡¢×ÊÁÏÏÂÔØ
USR-M300 ˵Ã÷Ê飺/Download/1332.html
USR-M300 ¹æ¸ñÊ飺/Download/1333.html
USR-M300 Ó¦ÓÃÖ¸µ¼£º/Download/1369.html
¡¾PC¶Ëµ÷ÊÔ¹¤¾ß¡¿ÍøÂçµ÷ÊÔÖúÊÖ ´®¿Úµ÷ÊÔÖúÊÖ¶þºÏÒ»/Download/27.html
MODBUS SLAVEÈí¼þ¿ÉÒÔ×Ô¼º°Ù¶ÈÏÂÔØ¡£
¶þ¡¢Ó²¼þÁ¬½Ó
1¡¢ËùÐèÎïÆ·
USR-M300 ²úÆ· 1̨
12VµçÔ´ÊÊÅäÆ÷ 1¸ö
³¬ÎåÀàÍøÏß 2¸ù
±Ê¼Ç±¾µçÄÔ 1̨
2¡¢Ó²¼þÁ¬½Ó
USR-M300 ½ÓºÃ4GÌìÏߣ¬¿ÉÒÔÄÚÖÿ¨ÉÏÍø£¬Ò²¿ÉÒÔ²åÍâÖÃSIM¿¨ÉÏÍø£¬Ò²¿ÉÒÔWAN¿ÚÓÃÍøÏß½ÓÉϼ¶Â·ÓÉÆ÷ÉÏÍø¡£
USR-M300 µÄLAN¿ÚÓÃÍøÏߺ͵çÄÔÖ±Á¬¡£
µçÔ´¶Ë×Ó½Ó12VµçÔ´ÊÊÅ䣬עÒâÕý¸º¼«²»Òª½Ó·´¡£
µçÄÔÏÂÔØ°²×°MODBUS SLAVEÈí¼þÄ£ÄâUSR-M300 LAN¿Ú½ÓµÄMODBUS TCP´Ó»úÉ豸¡£
3¡¢²é¿´µçÄÔ»ñÈ¡µÄIP
´ò¿ª¿ØÖÆÃæ°å£¬´ò¿ªÍøÂçºÍInternet£¬´ò¿ªÍøÂçÁ¬½Ó£¬²é¿´±¾µØÓÐÏßÍø¿¨×´Ì¬£¬ÏêϸÐÅÏ¢¡£±¾°¸Àý£¬µçÄÔ´ÓUSR-M300»ñÈ¡µÄIPÊÇ192.168.1.11£¬µçÄÔÄ£ÄâÍø¿ÚMODBUS TCPÉ豸µÄIPÒ²¾ÍÊÇ192.168.1.11¡£
Èý¡¢°¢ÀïÔÆÉèÖÃ
1¡¢µÇ½°¢ÀïÔÆƽ̨£¬ÕÒµ½¿·¢K8¹ú¼ÊÊ×Ò³Íøƽ̨£¬ÕâÀïÓõÄÁ¬½Ó¹«¹²ÊµÀý
£¨1£©µÇ½°¢ÀïÔÆƽ̨
£¨2£©ÕÒµ½¿·¢K8¹ú¼ÊÊ×Ò³Íøƽ̨
£¨3£©¿ªÍ¨Á¬½Ó¹«¹²ÊµÀý
2¡¢´´½¨²úÆ·
£¨1£©µã»÷²úÆ·£¬µã»÷´´½¨²úÆ·
£¨2£©Ð½¨²úÆ·ÐÅÏ¢£¬ÒÀ´ÎÌîд£º
²úÆ·Ãû³Æ¾ÙÀýtest¡ª¡ªËùÊôÆ·ÀàÑ¡Ôñ×Ô¶¨ÒåÆ·Àࡪ¡ª½ÚµãÀàÐÍÑ¡ÔñÖ±Á¬É豸¡ª¡ªÁªÍøÓëÊý¾ÝÁªÍø·½Ê½Ñ¡Ôñ·äÎÑ£¨2G/3G/4G/5G£©¡ª¡ªÊý¾Ý¸ñʽѡÔñ͸´«/×Ô¶¨Ò塪¡ªÈÏÖ¤·½Ê½Ñ¡ÔñÉ豸ÃØÔ¿¡ª¡ªµã»÷È·¶¨£¬Íê³É´´½¨²úÆ·¡£
3¡¢Ìí¼ÓÉ豸
£¨1£©²úÆ·´´½¨³É¹¦ºó£¬Ìí¼ÓÉ豸¡£µã»÷É豸£¬µã»÷Ìí¼ÓÉ豸£¬²úÆ·Ãû¾ÙÀýÌîtest,DeviceNameÌîUSR-M300£¬±¸×¢Ãû³ÆÌîMQTT£¬µã»÷È·ÈÏ¡£
£¨2£©Ìí¼ÓÍêÉ豸£¬ÈçÏÂͼչʾ£¬É豸״̬ÊÇδ¼¤»î£¬µÈÉèÖÃÍêUSR-M300Á¬½Ó°¢ÀïÔƲÎÊýÖ®ºó£¬É豸״̬²ÅÏÔʾÔÚÏß¡£
4¡¢²é¿´É豸֤ÊéÄÚÈÝ
µã»÷É豸£¬µã»÷²é¿´£¬ÔÙµã»÷DeviceSecretºóÃæµÄ²é¿´¡£
չʾÉ豸֤Ê飺
ProductKey: i4u4VIKvRXf
DeviceName: USR-M300
DeviceSecret: 114be8fcaae18efa71bad10981646744
5¡¢²é¿´²úÆ·Topic
£¨1£©µã»÷²úÆ·£¬µã»÷²é¿´
£¨2£©µã»÷TopicÀàÁÐ±í£¬µã»÷×Ô¶¨ÒåTopic,ÕÒµ½¶©Ôĺͷ¢²¼
ÉèÖÃUSR-M300µÄ°¢ÀïÔƲÎÊý£¬ÐèÒª°´ÕÕÒÔÏ·½·¨ÉèÖö©Ôĺͷ¢²¼Ö÷Ìâ¡£
Êý¾Ý¶©ÔIJâÊÔ£º½«¶©ÔĵÄÖ÷Ìâ/i4u4VIKvRXf/USR-M300/user/getÌîдµ½USR-M300¶©ÔĵÄÖ÷ÌâÅäÖÃÖÐÈ¥£¨×¢Ò⽫ÔÖ÷ÌâÖеÄ${deviceName}Ì滻ΪUSR-M300(±¾²úÆ·µÄDeviceName)£©£»
Êý¾Ý·¢²¼²âÊÔ£º½«·¢²¼µÄÖ÷Ìâ/i4u4VIKvRXf/USR-M300/user/updateÌîдµ½USR-M300·¢²¼µÄÖ÷ÌâÅäÖÃÖÐÈ¥£¨×¢Ò⽫ÔÖ÷ÌâÖеÄ${deviceName}Ì滻ΪUSR-M300(±¾²úÆ·µÄDeviceName)£©£»
ËÄ¡¢²úÆ·²ÎÊýÉèÖÃ
1¡¢µÇ½USR-M300ÍøÒ³
µçÄÔ´ò¿ªä¯ÀÀÆ÷£¬ÊäÈë192.168.1.1£¬µÇ½USR-M300ÄÚÖÃÍøÒ³£¬Óû§ÃûºÍÃÜÂ붼ÊÇadmin¡£
2¡¢Êý¾Ýµãλ£ºÌí¼Ó´Ó»úºÍµãλ
£¨1£©µã¿ªÊý¾Ýµã룬ÔÚ´Ó»úÒ»À¸£¬µã»÷Ìí¼Ó¡£
£¨2£©´Ó»úÃû³Æ£ºdevice1£¬²É¼¯ÐÒ飺Modbus TCP£¬IPÌîLAN¿Ú½ÓµÄÍø¿ÚMODBUS TCP´Ó»úIP£º192.168.1.11£¬¶Ë¿ÚºÅÌî102£¬´Ó»úµØÖ·1£¬µã»÷È·¶¨£¬µÈÉèÖÃÍêËùÓвÎÊý£¬×îºóÍøÒ³ÖØÆôUSR-M300¡£
£¨3£©´Ó»ú--µãλÁÐ±í£¬µã»÷Ìí¼Ó
£¨4£©µãλÃû³Æ£ºdata1(ºÍºóÃæÉϱ¨Êý¾Ý¶¼µãλÃû³Æ±£³ÖÒ»Ö£©£¬¼Ä´æÆ÷¹¦ÄÜÂë04£¬¼Ä´æÆ÷µØÖ·1£¨¶ÔӦʵ¼ÊÊ®½øÖƼĴæÆ÷µØÖ·0£©£¬¶Áд״̬¶Áд£¬µã»÷È·¶¨¡£
£¨5£©ÔÙÌí¼ÓµÚ¶þ¸öµã룬µãλÃû³Æ£ºdata2(ºÍºóÃæÉϱ¨Êý¾ÝµÄµãλÃû³Æ±£³ÖÒ»Ö£©£¬¼Ä´æÆ÷¹¦ÄÜÂë04£¬¼Ä´æÆ÷µØÖ·1£¨¶ÔӦʵ¼ÊÊ®½øÖƼĴæÆ÷µØÖ·0£©£¬¶Áд״̬¶Áд£¬µã»÷È·¶¨¡£
£¨6£©Ìí¼ÓÍ꣬¿ÉÒÔÁбí¼ì²é
3¡¢±ßÔµÍø¹Ø£ºÍ¨ÐÅÁ´Â·--Á´Â·1--TCP²ÎÊýÉèÖÃ
£¨1£©µã»÷Á´Â·1£¬´ò¿ªÁ´Â·1¿ª¹Ø¡£
£¨2£©ÔÚ»ù´¡ÉèÖã¬
ͨÐÅÐÒ飺°¢ÀïÔÆ
ʵÀýÀàÐÍ£º¹«¹²°æʵÀý
ProductKey£ºi4u4VIKvRXf
ÇøÓò´úÂ룺cn-shanghai
DeviceName£ºUSR-M300
DeviceSecret£º114be8fcaae18efa71bad10981646744
·þÎñÆ÷¶Ë¿Ú£º1883
ÆäËû²ÎÊý±£³ÖĬÈÏ¡£
µã»÷Ó¦Óá£
£¨3£©·¢²¼ÉèÖÃ
µã»÷·¢²¼ÉèÖ㬵ã»÷±à¼£¬Ö÷ÌâÃû³ÆÌî/i4u4VIKvRXf/USR-M300/user/update
QOS£ºÑ¡ÔñQOS0£¬µã»÷È·¶¨£¬µã»÷Ó¦Óá£
£¨4£©¶©ÔÄÉèÖÃ
µã»÷¶©ÔÄÉèÖ㬵ã»÷±à¼£¬Ö÷ÌâÃû³ÆÌî/i4u4VIKvRXf/USR-M300/user/get
QOS£ºÑ¡ÔñQOS0£¬µã»÷È·¶¨£¬µã»÷Ó¦Óá£
4¡¢±ßÔµÍø¹Ø£ºÐÒéת»»--Json
£¨1£©µã»÷ÐÒéת»»£¬µã»÷Json£¬¿ªÆôJson
£¨2£©¿ªÆôJsonÖ®ºóµã»÷Ìí¼Ó
£¨3£©Á´Â·Ñ¡ÔñÁ´Â·1£¬·¢²¼Ö÷Ìâ/i4u4VIKvRXf/USR-M300/user/update£¬¶©ÔÄÖ÷Ìâ/i4u4VIKvRXf/USR-M300/user/get¡£
£¨4£©µã»÷Ó¦ÓÃ
5¡¢×îºóÍøÒ³µã»÷ÖØÆô£¬µÈ´ýUSR-M300ÖØÆôÍê³É¡£
Îå¡¢MODBUS SLAVEÈí¼þÉèÖÃ
1¡¢MODBUS SLAVEÈí¼þÉèÖÃ
£¨1£©ÔÚµçÄÔÉÏ°²×°Modbus SlaveÈí¼þ£¬µã»÷Setup
Slave ID£º1£¨´Ó»úµØÖ·²âÊÔÓÃ1£©
Function: 03£¨¶Á¼Ä´æÆ÷¹¦ÄÜÂ룩
Address£º0£¨¼Ä´æÆ÷ÆðʼµØÖ·ÓÃ0£©
Quantity£º2£¨´ÓÆðʼµØÖ·¿ªÊ¼¼Ä´æÆ÷µØÖ·ÊýÁ¿£©
£¨2£©Modbus SlaveÈí¼þ£¬µã»÷Connection£¬Ñ¡ÔñModbus TCP/IP¡£Ñ¡ÔñPort 102£¬¶ÔÓ¦USR-M300 Ìí¼Ó´Ó»úʱÌîдµÄ¶Ë¿ÚºÅ102¡£×îºóµã»÷OK¡£
Áù¡¢JSONÏ·¢Ð´Êý¾Ý
1¡¢JSONÏ·¢Ð´¼Ä´æÆ÷µØÖ·Êý¾Ý
£¨1£©°¢ÀïÔÆ£¬µã»÷É豸£¬µã»÷ºóÃæµÄ²é¿´¡£
£¨2£©µã»÷TopicÁÐ±í£¬µã»÷·¢²¼ÏûÏ¢£¬·¢ËÍÇø°´ÕÕ¸ñʽÊäÈëÏ·¢JSON¸ñʽÃüÁ
{
"rw_prot": {
"Ver": "1.0.1",
"dir": "down",
"id": "12345",
"r_data": [{
"name": "data1"
},
{
"name": "data2"
}
],
"w_data": [{
"name": "data1",
"value": "666"
},
{
"name": "data2",
"value": "888"
}
]
}
}
- Éϱ¨Êý¾Ýµ½°¢ÀïÔÆ·þÎñÆ÷
£¨1£©USR-M300²ÎÊýÉèÖÃÍê³É£¬É豸ÔÚÏß
£¨2£©µã»÷¼à¿ØÔËά£¬µã»÷ÈÕÖ¾·þÎñ£¬²úÆ·Ñ¡ÔñÌí¼ÓµÄÉ豸Ãû£¬ÔÚÈÕÖ¾ÐÅÏ¢ÖУ¬µã»÷²é¿´¡£
½ÓÊջظ´Êý¾Ý¡£»Ø¸´JSON¸ñʽÄÚÈÝ£º
{ "rw_prot": { "dir": "up", "Ver": "1.0.1", "id": "12345", "w_data": [{ "name": "data1", "value": "666", "err": "0" }, { "name": "data2", "value": "888", "err": "0" }], "r_data": [{ "name": "data1", "value": "666", "err": "0" }, { "name": "data2", "value": "888", "err": "0" }] } }
±àдÈË£º½ðÖ¾·½ ±àдÈÕÆÚ£º2024-08-02
ÉóºËÈË£º½ðÖ¾·½ ÉóºËÈÕÆÚ£º2024-08-02
¶©Õý°æ±¾£ºV1.0 ¶©ÕýÄÚÈÝ£º³õ¸å