With the rapid development of computer network technology and the popularization of Internet, resident’s living standard has been increasingly improved. People have higher requirements for residence as well as residential community, and the smart community has just met people’s new demands. Besides, the fast advancement of electronic and computer technology provides technical support for smart home. As a smart control technique, smart home together with motor control, is gradually being widely used in the field of industrial automation on the basis of Modbus / TCP protocol. This paper designs a smart home system based on the concept of Modbus / TCP protocol and smart home, and discusses its hardware and software design methods.


With the rapid development of computer network technology and the popularity of the Internet, people’s living standards continue to improve. People have higher demands for residence and residential areas, and the smart community has just met people’s new requirements. The advancement of electronic and computer technology provides technical support for smart home. Under the support of computers, networks, communication and multimedia technology, with the field bus connecting to various types of modules to issue instructions accordingly, smart home system can realize functions of home communication network system, home automation system, home security system and so on [1-3]. The smart home system provides residents with a safe, comfortable, convenient and informative living environment so that people can understand the home situation and control the home equipment through remote operation, making their home environment more humanized and more intelligent. Since the intelligent development of electronic equipment enables people to have higher daily housing requirements, the delicacy and convenience of housing gradually becomes a prior demand.
Therefore, the combination of distributed control system and local area network becomes the trend of centralized monitoring of home equipment. On one hand, the centralized monitoring and network management can ensure the reliability of the safe equipment operation, and greatly improve the management efficiency on the other hand. At present, communication protocols applied in intelligent field are based on CAN bus monitoring, LONWORK field bus monitoring and embedded Linux industrial monitoring system [4]. However, Modbus is still the most widely used protocol [5]due to following reasons:


nowadays, more than 400 manufacturers and 600 products have been supporting Modbus protocol which has become the necessity for most industrial manufacturers;

2) Extensiveness:

Modbus can be widely adopted in many areas, including supporting a variety of electrical interfaces, or to be transmitted via various media, such as twisted pair, fiber, wireless, etc.

3) Simpleness:

Modbus’s frame format is simple, compact and easy to understand. It is adoptive for most people especially for users and operators.

4) Price:

the low price of Modbus makes it possible for Modbus to be popularized in daily life, and to become an indispensable part of industrial cost reduction;

5) Comprehensiveness:

the standardization of data communication links, together with the development of communication networks helps to integrate a variety of industrial equipment into a large system to meet the factory automation requirements, and to follow the open trend;

6) Smartness:

the database system, the reasoning performance and the future bus development will progress towards smartness, bringing easier operations and a lower packet loss probability.

7) Host computer to be PC:

PC (Personal Computer)gains a momentum in the 21st century, which is doomed to be widely used as a host computer in future industrial communications owing to its universality and flexibility.

8) Specialization:

Today, industrial productions in different areas focus on the performance of different priorities, and the industrial communications will be gradually specialized to meet distinctive communication requirements in the future.

2. Modbus / TCP Protocol and Smart Home

2.1 Modbus / TCP Protocol

The Modbus protocol provides communication services for the client / server on the Ethernet network. This client / server mode is based on four types of packets: Modbus request, Modbus indication, Modbus response, and Modbus acknowledgment. The Modbus request is a message that the client sends on the network to initiate the transaction. The Modbus indication is the request message received by the server. The Modbus response is the response information sent by the server. The Modbus acknowledgment is the receiving of the response information from the server. Use the Modbus message transmission service to conduct real-time information exchange between two device applications, the device application and other devices, the HMI / SCADA application and device, and the PC and the device program providing online services .The client / server communication mode is shown in Figure 1.

Figure 1 Modbus Client/Server Communication Mode
Modbus / TCP protocol is a Modbus packet transmission protocol running on TCP / IP of Ethernet TCP / IP[6].The controllers can use networks and other devices to communicate with each other through this protocol. Modbus / TCP is an open protocol assigned with a serial number 502,the only port assigned to the instrumentation and automation industry up to now, by the IANA (Internet Assigned Numbers Authority).If the application layer uses the industry-wide standard of Modbus protocol, it then completes the industrial Ethernet application.
The Modbus / TCP communication protocol can be applied to the monitoring process of automated equipment. One of the common application practices is the development of a gateway based on the protocol, through which the PLC, I / O modules and other simple bus or I / O network can be connected to the Ethernet. Modbus / TCP is simply ported to TCP / IP protocol as an application layer protocol without any change on the original Modbus protocol. This specification mainly describes how Modbus messages can be decoded in detail via TCP protocol available on the Internet, for the purpose of enabling developers regarding Modbus / TCP as the operational standard in industrial automation to use it. Modbus / TCP is connection-oriented with each call requiring a respective response. This call-response mechanism collaborates with the Modbus master / slave mechanism to ensure a higher certainty of the switching Ethernet. By using TCP / IP protocol, the web page makes the interface more user-friendly. People can also use a web browser to view the operation of the enterprise network equipment. Schneider Electric has registered 502 port for Modbus. In this way the real-time data can be transmitted to the server for client software to receive. Meanwhile a lot of industrial control configuration software can be a good support for Modbus / TCP protocol. Encapsulating this protocol with OPC package in the host computer will facilitate its connection to the existing industrial configuration monitoring software, and the entire system, therefore, will be seamlessly connected.

2.2 Smart Home

Compared with ordinary housing, smart home not only possesses traditional living functions, but also can provide information exchange service, through which people can view the information and control the relevant home equipment. It helps people to effectively arrange their time, making home life more secure and comfortable. This home system consists of the Internet, smart home appliances, controllers, home networks and gateways. However, the network and gateway of smart home is the key for information exchange between home appliances, and between Internet and its users. It is also the focal difficulty in designing and developing stage.
The ultimate goal of smart home is to make the home environment more comfortable, more secure, more environmentally friendly and more convenient. The emergence of the Internet of Things makes functions of current smart home system richer, more diversified and personalized. The smart home is applied in many areas, mainly the smart lighting control, smart home appliance control, video chat and smart security. Each family can design, expand, or cut functions according to their needs.

3. Smart Home System Design based on Modbus / TCP Protocol

The design needs to achieve the goal of smart home control with a mobile phone and client software of a tablet PC. The control gateway is the core content of the design with home appliances and client networking to be mentioned. The smart phone or tablet is connected to the home network via Wi-Fi, while the control gateway connects to the home network via Ethernet. Then the wireless router in the home network connects to both Wi-Fi and Ethernet at the same time. When the user installs the control program with a smart phone or tablet control terminal, the operation instruction is sent to the control gateway through wireless router. After the control gateway receives the operation instruction, the related functions are executed, and the device status information is returned back to it, which then forwards the device information to the smart phone or tablet through wireless router, achieving the control of smart home.

3.1 Hardware Design

This design focuses on the data acquisition, output and storage in each module of the smart home system. The embedded Modbus / TCP module adopts STM32 series ARM MCU. Mobile phone or tablet communicates with the embedded Modbus / TCP module via serial port (UART)and manipulates each module of the home system through communicating data. The data storage module in the home system is used to store all kinds of information; the data acquisition module sends the collected or stored data to the control module, and the control module adjusts the safety alarm module according to the user’s requirement.

3.2 Software Design

through the port number 502. This program design consists of three parts: the establishment of connections, data exchange, and the closure of connections.
The software design includes both the host and slave computer software. The latter communication module mainly supports to initialize the Ethernet configuration parameter as well as receives and sends the data of each module. The initialization of interface parameter is to configure the frame format of transmission data, the Baud rate, parity, priority and other basic parameters. In the process of receiving data, the slave computer needs to be powered on firstly. Then the processor initializes interface parameters of each module and receives data through the specified interface, and the CRC code is generated. Compare the CRC code with that of the message, if it is not the same, then drop it and send the error frame. If the same, it indicates that the received message is correct. Parse the message and follow the function code to execute the corresponding command. When sending data from the slave computer, the processor executes the command, gets the corresponding data and displays on the screen. It then calculates the CRC check code, sending it from the corresponding interface to the bus and finally, the control computer, through a message frame formed by adding the start bit. The inspector can know the operation of the field equipment through data feedback. CRC check-sum, also known as Cyclic Redundancy Check (CRC), is a hash function that generates a simple fixed-bit check-code based on data such as network packets or computer files. It is used to detect the connection and data receiving and sending between virtual machine.

4. Cases Of Smart Home And Motor Control System Application

In daily life, people can achieve remote wireless control of home appliances, establish a smart home system and create a high-tech living environment. While in the industrial field, people can realize remote management for industrial equipment under Modbus protocol as well as remote smart-controlled production. Applying the smart home system based on the field bus and Modbus technology not only helps to save labor costs in a way that the PC automatically reads water, electricity, and gas meter, but also improves the accuracy of the meter reading. Besides, people are able to do real-time monitoring of indoor gas leak, fire, door or window magnetic and other security facilities to prevent fire and pilferage. For users, they can always check the service condition and make timely payment. In addition, they can conduct remote control of home appliances such as turn on the air conditioner or TV on their way of home. In a word, the construction of smart home system based on field bus and Modbus technology is the leading choice for realizing smart residential community, and also the direction of family control network development.

5. Summary

This design is for the smart home system based on Modbus / TCP protocol. Users only need to connect the internet and start the Pad or mobile phone software to manage home security and appliances for real-time control. It brings users enjoyment from the network, and at the same time, creates a reliable living environment. On the whole, the hardware and software design of the smart home takes its advantages into account, including its accessibility, the low price of network implementation and its strong capability of integrating a variety of devices and transmitting data. Not only can it popularize home software, but also it can meet public demands for smart home through home local area.