🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
Label: Modbus DTU DeviceBit Single-phase power meter --- Abstract: Connect modbus power meter to DeviceBit (without programming) by universal DTU just like playing building blocks. --- # 1 Hardware 1. Shenzhen JSY-149 series single-phase meter (Any power meter with MODBUS interface meter can be used.) 2. USR DTU 410S (Any DTU which has the function of registration packets can be used.) ![左边电表右边DTU][1] # 2 Procedures ### 2.1 Account Settings **Sign up a account on DeviceBit & Add a new device** ![乐联网系统下面添加设备][2] **Select device type: modbus, please note the content in red frames.** ![添加设备时候的具体设置][3] We will illustrate these settings one by one: ID: ID for the device, and will be used later in DTU settings. Here, it is 01. Type: fixed, select lw-modbusmodbus slave ID: Modbus device ID. Here, it is 01. Func:The command setting for the Modbus device; here is 03. Choose DeviceBit MODBUS service: mandatory option. For MODBUS devices you must choose this. After selecting, the following content will automatically appear, and there is no need to manually enter them. **After clicking on Save, you will see:** ![添加成功后][4] **Find your usrkey for it will be used later.** ![账户userkey 位置][5] ### 2.2 DTU Settings For 410S manuals, please go to someone'the official website. Setting page is shown below. Please pay attention to the content in red frames. ![有人410S设置][6] Main parameters: socket:modbus.lewei50.com:9970 Registration packet content: the format is usrkey_device ID (Please see the screeshot in 2.1) Registration packet type: custom content; send once liked Serial port: select according to the actual situation. Click on Save and restart DTU. # 3 Monitor on DeviceBit Then, the power meter is connect to DeviceBit by DTU. Let's Test it through the Modbus console first. ### 3.1 Modbus console test Go back to "My Devices", and click on the link showed by the arrow poiter to enter the Modbus console test. ![modbus控制台位置][7] Click on Send according to the settings in the red frames. If the messages on the right side are returned, it means the test is successful. ![modbus 控制台内容][8] Description: Command: 03 Starting position: 72 Read location: 1 For JSY-149, 03 command, register 0048H 0048H (read-only) voltage, unsigned number, value =DATA/100, unit V The returned value 0x5a7b, corresponding to 23163, divided by 100 is 231.63V. ### 3.2 Settings for automatically reading meter parameters After successful testing with Modbus console, you can set to automatically read the device parameters on DeviceBit. **Key Parameters for JSY-149 power meter** Register | Description | ----|------| 0048H (Read-only) | Voltage,Unsigned number,Value=DATA/100, Unit V 0049H (Read-only)| Current,Unsigned number,Value=DATA/100,Unit A 004AH (Read-only) | Active power,Unsigned number,Value=DATA,Unit W 004BH-004CH(Read-only)| Forward active energy,Unsigned number,Value=DATA/3200,Unit kWh **Settings for automatically reading voltage, power, power consumption on DeviceBit** Next, add sensors on DeviceBit to read voltage. ![添加传感器][9] ![电压传感器][10] S72: S is the fixed format required by the system. It must begins with S. 72=0x48 (see the above JSY-149 protocol; please refer to 3.2.1) Coefficient 0.01: JSY-149 voltage parameter coefficient (see the above JSY-149 protocol; please refer to 3.2.1). Settings for power, similar to reading voltage. ![功率传感器][11] S74:S is the fixed format required by the system.It must begins with S. 74=0x4a (see the above JSY-149 protocol; please refer to 3.2.1). Settings for power consumption, similar to reading voltage. ![用电量传感器][12] S75-76:For the modbus register with two addresses, we name it in this way. Please note the difference with name method for the above register with just 1 address. Coefficient 0.0003125:JSY-149 power consumption parameter coefficient(see the above JSY-149 protocol; please refer to 3.2.1). When the settings are complete, restart the DTU or enter the Modbus console to perform the following operations (reconnecting, and updating the configuration) ![执行更新配置操作][13] And you can see the data are uploaded on DeviceBit. ![大功告成][14] # 4 Conclusion The above demonstrates the use of a universal DTU (no difference with manufacturers, and no difference with the uplink modes), to connect the Modbus meter (In fact, any Modbus RTU can be used.) DeviceBit just like playing building blocks. If the tutorial is not clear, you can refer to the following video [DeviceBit MODBUS Device DTU][15] Thanks to@瘦网虫 [1]: http://doc-resources.lewei50.com/lewei50/img/MODBUS-lewei50-20170506-1.jpg [2]: http://doc-resources.lewei50.com/lewei50/img/MODBUS-lewei50-20170506-2.jpg [3]: http://doc-resources.lewei50.com/lewei50/img/MODBUS-lewei50-20170506-3.jpg [4]: http://doc-resources.lewei50.com/lewei50/img/MODBUS-lewei50-20170506-4.jpg [5]: http://doc-resources.lewei50.com/lewei50/img/MODBUS-lewei50-20170506-5.jpg [6]: http://doc-resources.lewei50.com/lewei50/img/MODBUS-lewei50-20170506-6.jpg [7]: http://doc-resources.lewei50.com/lewei50/img/MODBUS-lewei50-20170506-7.jpg [8]: http://doc-resources.lewei50.com/lewei50/img/MODBUS-lewei50-20170506-8.jpg [9]: http://doc-resources.lewei50.com/lewei50/img/MODBUS-lewei50-20170506-9.jpg [10]: http://doc-resources.lewei50.com/lewei50/img/MODBUS-lewei50-20170506-10.jpg [11]: http://doc-resources.lewei50.com/lewei50/img/MODBUS-lewei50-20170506-11.jpg [12]: http://doc-resources.lewei50.com/lewei50/img/MODBUS-lewei50-20170506-12.jpg [13]: http://doc-resources.lewei50.com/lewei50/img/MODBUS-lewei50-20170506-13.jpg [14]: http://doc-resources.lewei50.com/lewei50/img/MODBUS-lewei50-20170506-14.jpg [15]: http://v.youku.com/v_show/id_XMjY5NTAyNDc2MA==?spm=a2h3j.8428770.3416059.1#paction&qq-pf-to=pcqq.group