# DeviceBit modbus device service
Label: modbus
---
The following part mainly introduces how to connect modbus device with DeviceBit platform directly by DTU.
## 1 Introduction
### 1.1 DeviceBit modbus device service
Without program, connect modbus device with DeviceBit platform directly by DTU.
### 1.2 Advantage
Modbus is one of the most common industrial equipment protocol, and the related equipment and instrument are innumerable. Just select a suitable MODBUS device and a universal DTU, you can directly connect the device with DeviceBit platform.
> For example: gas detector, power meter, water meter, or anyone sold on the market or the internet.
### 1.3 Why can they connect directly?
Modbus device connects to modbus tcp server provided by DeviceBit by DTU. Modbus tcp server finds the account information on DeviceBit of modbus device through DTU registration package, and initiate data request to modbus device through registers for modbus device in Devicebit account. Then, the data read is stored directly for the device in DeviceBit account.
![乐为物联modbus 设备接入服务][1]
## 2 Connection Steps
Access to the platform requires the following 3 steps,
1. Sign up one account on DeviceBit; Write account information in DTU as a registration package.
2. Set registers for modbus device on DeviceBit.
3. Connect DTU with modbus device.
The main working procedure is as following:
### 2.1 First simulate one modbus device, as the following picture shows. Two register addresses :0 1, and the values are 12 13 separately.
![modbus slave 模拟设备][2]
### 2.2 Sign up one account and add a new device. Please notice all the settings.
![此处输入图片的描述][3]、
### 2.3 Get the registration package from the account and write it in DTU.
About how to get the registration package, please refer to[乐联网DTU 教程2 :用DTU把JSY-149 单项电表接入乐联网][4]
About how to write the registration package in DTU, there are different methods for different DTU. It depends on yourself.
Writting the registration package in DTU means the connection between device and DeviceBit is established.
### 2.4 Connect modbus device with DTU
### 2.5 Test by modbus console
![modbus 控制台][5]
![看到这里就是成功联通了][6]
### 2.6 Add sensors to collect data automatically
The sensor naming rule is the S+ register address, for example, the register 0 is S0, and if the register has two addresses, such as register 1-2, the name is S1-2.
![新建传感器对应寄存器][7]
![新建传感器对应寄存器][8]
For the sensors added, please see the following picture.
![此处输入图片的描述][9]
### 2.7 Reconnect after adding the sensors.
![重置链接,是传感器建立生效][10]
### 2.8 Wait to see the data automatically collected.
![自动采集数据成功][11]
## 参考文档
[乐联网DTU 教程1 :概述][12]
[乐联网DTU 教程2 :用DTU把JSY-149 单项电表接入乐联网][13]
[乐联网DTU 教程3 :概述用python+Openwrt DIY DTU 连接乐联网][14]
[乐联网DTU 教程4:DIY 低成本乐联网GPRS DTU][15]
[乐联网DTU 教程5:DIY 低成本乐联网WIFI DTU][16]
[1]: http://doc-resources.lewei50.com/lewei50/img/DTU-lewei50-20170707-10.png
[2]: http://doc-resources.lewei50.com/lewei50/img/DTU-lewei50-20170707-1.jpg
[3]: http://doc-resources.lewei50.com/lewei50/img/DTU-lewei50-20170707-2.jpg
[4]: http://www.jianshu.com/p/3a1332c8f703
[5]: http://doc-resources.lewei50.com/lewei50/img/DTU-lewei50-20170707-3.jpg
[6]: http://doc-resources.lewei50.com/lewei50/img/DTU-lewei50-20170707-4.jpg
[7]: http://doc-resources.lewei50.com/lewei50/img/DTU-lewei50-20170707-5.jpg
[8]: http://doc-resources.lewei50.com/lewei50/img/DTU-lewei50-20170707-6.jpg
[9]: http://doc-resources.lewei50.com/lewei50/img/DTU-lewei50-20170707-7.jpg
[10]: http://doc-resources.lewei50.com/lewei50/img/DTU-lewei50-20170707-8.jpg
[11]: http://doc-resources.lewei50.com/lewei50/img/DTU-lewei50-20170707-9.jpg
[12]: http://www.jianshu.com/p/c1e1097d7e5f
[13]: http://www.jianshu.com/p/3a1332c8f703
[14]: http://www.jianshu.com/p/dea70ea26847
[15]: http://www.jianshu.com/p/5aa5abe3bdc7
[16]: http://www.jianshu.com/p/a0e6926bc436
- DeviceBit User Manual
- Quick Start
- 1. Add A Device
- 2. Add a new sensor or controller
- 3. Data Upload Simulation
- 4. WeChat Alert
- 5. Email Alert
- 6. Data Reports
- 7. Account Settings
- 8. WeChat
- 9. Email Auto-sending
- 10. Email Report
- 11. Control Scheme
- 12. Trigger
- 13. MQTT
- 14. Modbus
- 15. Agent
- 16. Credits
- DeviceBit Open Source Tutorials
- 1. DIY WiFi Particles Monitor
- 2. DIY WiFi Particles & HCHO Monitor
- 3. DIY GPRS Particles Monitor
- 4. GPRS Particles Kit V0.1
- 5. WiFi Socket
- Applicaton Doc
- DTU Tutorial 1: Overview
- DTU Tutorial 2: Using DTU to connect JSY-149 single-phase meter to DeviceBit
- DTU Tutorial 3: Using Python+Openwrt DIY DTU & Connect DeviceBit
- DTU Tutorial 4 DIY Low-cost DeviceBit GPRS DTU
- DTU Tutorial 5: DIY Low-cost DeviceBit WIFI DTU
- DeviceBit Other Platform