Abstract
The Internet of Things (IoT) is regarded as the future generation Internet, which ranges from radio frequency identification (RFID) to the ubiquitous computing systems such as wireless sensor networks and mobile ad hoc networks. With the rapid development of IoT, designing an effective low-cost embedded terminal device for the IoT become very necessary. A new embedded device, Webit&NEU, and its reduced embedded real-time operating system used for IoT are implemented by our China Liaoning Province Embedded Technique Key Laboratory in this paper. Besides, related modules in terms of RFID technique, wireless communication, and network protocol are also provided in this paper. Compared with several current solutions of connecting devices and Internet, it has the advantages of good real-time performance, light weight, and low cost. Besides, this paper also puts forward a localization algorithm for the Webit&NEU, and experimental test results in terms of real-time system ability, network communication performance, and localization algorithm show that Webit&NEU can work well and meet the actual requirements of the IoT.
1. Introduction
The IoT is a new-emerging technique. After the age of Internet and wireless sensor network, people are gradually entering the era of IoT. The IoT refers to uniquely identifiable objects (things) and their virtual representations in an Internet-like structure [1]. In fact, the IoT includes technologies such as RFID, sensors, and smart devices. The concept of the IoT has become more and more popular now. RFID is often regarded as a prerequisite for the IoT [2, 3]. Supposing all objects of daily life were equipped with radio tags, thus they could be identified, tacked, and managed by computers, and then they will certainly bring great convenience to people's lives.
Embedded Internet device Webit2.0 can make the standard industry device have the ability of accessing the Internet, and it has successfully been embedded to fieldbus, industrial devices, and so forth, so people can feel free to access those devices through Internet. Webit2.0 has been successfully developed by our China Liaoning Province Embedded Technique Key Laboratory and has been large-scaly manufactured by China Shenyang Neu-era Information Technology Stock Co., Ltd [4]. It is worth noting that Webit2.0 has obtained the China's product patent (nos. ZL 00 2 52482.1 and ZL 01 2 29725.9).
The design and implementation of embedded device Webit&NEU are based on Webit2.0. Besides the basic functions of Webit2.0, new functions such as RFID data processing and wireless date communication are also added to the Webit&NEU, and its microcontroller is also updated to Atmega128L so that it can well be used in IoT.
This paper mainly makes three novel research contributions.
It implements a light-weight and low-cost embedded device Webit&NEU used for the IoT and its reduced operating systems kernel Webit&NEU OS written in AVR assembly language.
It implements data collection module, wireless communication module, and network protocol module efficiently.
It proposes an improved localization algorithm for the practical application of Webit&NEU.
This paper is organized as follows. The second section presents the current embedded system communication solutions and related analysis. The third section describes the design and implementation of Webit&NEU hardware system, its light-weight operating system kernel, and related performance analysis. Besides, the wireless communication module between different devices, RFID data collection module, and the TCP/IP protocol module are provided in this section. The fourth section proposed an improved localization algorithm for Webit&NEU, and performance comparison in terms of localization error and localization time is described in this section. Concluding remarks are given at the end of the paper.
2. Current Embedded System Communication Solutions
The current common methods used to collect, communicate, and manage data are shown as follows [5, 6].
RS485 is adopted in consideration of its good capability of long distance communication. The implementation includes connecting all RFID readers by concentrator and linking them by server. In this method, the server handles the data and also supports Internet interface so as to make users access them remotely as Figure 1 shows.
Handheld RFID is used reader to read and write RFID card, and then system sends data to nearby server by the method of wireless transmission and implements resources sharing by connecting to Internet. This method is adopted by some applications having high portable requirements as Figure 2 shows.
RFID and PC are usually connected by RS232 in this method. As the limit of communication capability for RS232, it is suitable for short distance communication. PC filters and handles these data collected by RFID reader and then sends these data to the server as Figure 3 shows.

Connection method of wireless communication.

Connection method of distribution access.

Connection method of bus access.
For most of the RFID products, the connection method between different devices is usually implemented by USB or serial port [7], which is not only inconvenient to expand, but also is unsuitable for remote data transmission, so this is the bottleneck for these devices to be applied to the IoT. So we engaged to develop embedded device features: high efficiency, light weight, and low cost used in the IoT.
3. Design and Implementation of Webit&NEU
3.1. Design of Webit&NEU Hardware
Webit&NEU uses the basic structure of Webit2.0. It can manage the data collected from the RFID reader and CC2530 and store the necessary data to memory. Besides it can assemble HTTP packet according to different applications and then send them to Internet by the RTL8019AS.
The product appearance of Webit2.0 is shown as Figure 4 shows (compared with one yuan coin).

Product appearance of Webit2.0.
Its corresponding interface parts are described as below:
14-bit full-duplex User I/O (TTL electrical level),
power supply interface (DC 9V),
network interface: IEEE802.3/RJ-45,
network data signal lights,
in-system programming interface.
And its technique feature and performance are provided, respectively, as below.
Technique feature:
no gateway and PC needed,
independent design of hardware and software architecture,
independent intelligent,
independent function of network server,
independent addressability,
embedded design,
low cost,
small in size.
Performance of Webit2.0:
Atmel AVR RISC processor,
customized definition Web page,
customized definition CGI programming,
duplexing I/O interface with 14 bit TTL electrical level,
UART interface of TTL electrical level supports up to 115200 bps,
10 M Ethernet interface (RJ-45),
in-system Programmability (ISP),
protocol supported: ARP, ICMP, IP, TCP, and HTTP,
Network interface: IEEE 802.3/RJ-45.
Webit&NEU can not only implement wireless communication with each other by CC2530, but also send the data collected from RFID reader to the Internet through RJ-45 interface as Figure 5 shows. Thus while devices are embedded with the Webit&NEU, then they can be used to smartly identify, locate, track, monitor, and manage these devices having RFID tag. The Webit&NEU well inherits good feature such as real-time ability from Webit2.0, and the most important is that the design goal for Webit&NEU is the implementation of light weight and low cost.

Composition architecture of Webit&NEU.
RFID reader collects data from devices having tags so as to identify devices [8]. The RFID data collection module, CC2530 wireless communication module, and Webit&NEU microprocessor module form the whole Webit&NEU hardware, and architecture illustration between Webit&NEU microprocessor module and RFID function module is shown as Figure 6 shows.

Hardware architecture between Webit2.0 and RFID.
The Webit&NEU microprocessor controls the RFID reader to achieve the function of data collection and management, and it mainly includes the below 4 procedures.
(1) Initialization. Webit&NEU microprocessor implements the initialization of RFID reader by sending specific command (01H) to it.
(2) Sending Commands. Webit&NEU microprocessor sends a request command (02H) to RFID reader so as to indicate that it will send commands, and RFID reader will return a response command (10H) to the microprocessor to show it has already prepared for receiving commands. After executing the above procedures, the microprocessor of Webit&NEU begins to send commands.
(3) Data Verification. This is used to make sure the data received are correct. It is implemented by the method of XOR operation. If this procedure is correct, then the system will execute data handling program. If not, the system will set the Flag in response frame as 1, so as to imply RFID reader that the data is wrong and order RFID reader to send it again.
(4) Data Filtering. While microprocessor of Webit&NEU receives data from RFID reader, it will judge whether the data is anticipated according to message ID, number of data bytes, and data verification. If not, then the system will filter the wrong and incomplete data.
3.2. The Reduced Webit&NEU Operating System Kernel
3.2.1. The Design and Implementation of Webit&NEU OS
A real-time operating system must have the ability to respond to external events timely. In order to coordinate and execute tasks effectively, Webit&NEU OS system provides the following services: interrupt handling, intertask communication, task synchronization, memory management, timing services, task priority assignment, and so on.
All of these functions implemented by the unique design of system call can easily execute real-time applications. System call is a program supported to user by system, while users need to implement certain system functions; what they need to do is to call the accordingly system call in their application program, so it is convenient for users to use the system kernel.
All the system calls are written in AVR assembly language. As one of the important advantages for AVR assembly language is that it can easily and flexibly operate a certain storage location in memory, even its certain bit of the storage location, so system can handle task, message, interruption, timing, and so on effectively.
So the Webit&NEU OS system can well be used to effectively manage data collection, wireless communication in the IoT [9, 10], and it has successfully been developed by our China Liaoning Province Embedded Technique Key Laboratory [11].
The system calls constitute the basic operating system and their brief descriptions are provided as follows.
Task management services:
CREATE_TASK: creating and scheduling a task dynamically,
DELETE_TASK: deleting certain specific task,
GET_FUNCTION_ID: obtaining task function ID (value ranges from 00 to 0FFH),
SUSPEND: suspending a task being executed.
Intertask communication services:
ALLOCATE: allocating buffer space where a task creates a message to be sent,
SEND_MESSAGE: sending certain message to specific task,
WAIT_ MESSAGE: allowing a task to wait for a message to come,
DEALLOCATE: returning certain specific buffer to the system buffer.
Internal memory management services:
GET_MEM: getting the address of certain memory having specific length is currently available in the system,
RELESE_MEM: returning certain memory with specific length to the system memory pool.
Interrupt-handling services:
DISABLE_INTERRUPT: disabling some interruptions,
ENABLE_INTERRUPT: reenabling disabled interruptions,
WAIT_3: synchronizing tasks with interruptions.
Timing services:
SET_INTERVAL: setting a time interval after the interval event occurred,
WAIT: waiting for interval event or timeout to occur.
The design and implementation of data variable units and tables in the memory block bring great convenience for system to handle task information and its responding priority, interruption, message, timing, and so on. Besides, while designing the system calls, the data storage units and tables are all stored in the internal SRAM, so the speed in terms of task switching and information handling is improved to some extent.
By using the above system calls, system can well synchronize and schedule multitasks in the IoT. Although only one task can be executed on the processor at any given time, the multiplexing of all tasks makes it appear as if all of the tasks are running simultaneously.
3.2.2. The Performance Test of Real-Time Ability about Webit&NEU OS
In order to evaluate the real-time performance of Webit&NEU OS, we mainly tested two performance parameters of task switching time and max interruption inhabit time [12, 13] and then compared them with Webit5.0 OS (The fifth-generation operating system designed for Webit2.0) and TinyOS 2.1.2. We chose the TinyOS 2.1.2 as the comparison system because it also has relatively small kernel code size compared with the other operating systems.
TinyOS is an open source, BSD-licensed operating system designed for low-power wireless devices, such as those used in sensor networks, ubiquitous computing, personal area networks, smart buildings, and smart meters. It is written in the nesC programming language as a set of cooperating tasks and processes. TinyOS started as a collaboration between the University of California, Berkeley, in cooperation with Intel Research and Crossbow Technology. A worldwide community from academia and industry uses, develops, and supports the operating system as well as its associated tools. TinyOS 2.1.2 is officially released on August 20, 2012. TinyOS 2.1.2 includes support for updated msp430-gcc (4.6.3) and avr-gcc (4.1.2). A complete 6lowpan/RPL IPv6 stack. Support for the ucmini platform and ATmega128RFA1 chip [14].
We used the tools of logic analyzer (TLA603), arbitrary waveform generator (AWG2021), and digital storage oscilloscope (TDS1012). In the test programs, we added some control codes by transforming the value of high and low levels of pulses through I/O interface. For each experiment below, we tested 20 times totally, kept down the maximum and minimum, and then calculated their average as Figures 7 and 8 show.

Experimental test results of task switching time (μs).

Experimental test results of max interruption inhibit time (μs).
For the Webit&NEU OS, the reduction of task switching time and max interruption inhabit time is 8.41% and 13.44% separately compared with Webit5.0 OS, which means Webit&NEU can not only process task switching more quickly, but also fast respond to external interruptions.
Compared with TinyOS 2.1.2, we can know that the task switching time of Webit&NEU OS is shorter, mainly because of the special design structure of TASK_READY_TAB (16 memory units ranging from 0283H to 0292H are used to store related information of every ready task). The low 4 bit stores the task priority, while the high 4 bit of each unit stores the task ITD. When a task is inserted into TASK_READY_TAB, it will be put in suitable place according to its priority so as to make sure all tasks in the task ready table are sorted by task priority. But for the max interruption inhibit time, TinyOS 2.1.2 is better, because the two categories of interruption handling program (COMMON SERVER and TIMER0 SERVER) take longer time for the Webit&NEU OS. But compared with Webit5.0 OS, the Webit&NEU OS is better in terms of both task switching time and max interruption inhibit time.
3.3. RFID Data Collection Module
The RFID terminal function module of Webit&NEU can be summarized as below.
The data collected from the RFID reader are sent to specific server by Internet so as to make the devices networked. In order to implement these functions, the architecture of terminal function module is mainly composed of network driver, data collection, and device driver module. The three modules and their composition are shown in Figure 9.

Architecture about RFID terminal function module of Webit&NEU.
Network driver module is the key to ensure RFID terminal devices are networked. In order to implement the connection between devices and Internet, the TCP/IP protocol is prerequisite. This system also implements the function of Web server so as to make clients access these devices by browser.
RFID data collection module is the input data part for the whole system. This module implements communication between different devices by RFID technology. In order to guarantee the correction and security of data collection and transmission, firstly there should be a procession of establishing link before data frames transmission, and system uses handshake principle to implement synchronization between sender and receiver. Secondly, the data frames used to communicate should include not only the actual data, but also the necessary control and check bit, which means data should be verified so as to guarantee the data correction, so sometimes the data retransmission operation is required. Finally, the system filters the control and check bit and then obtains the effective data.
Devices driver module is the basic part of the RFID terminal devices. This layer masks the complexity of microcontroller underlying hardware and supports simple interface to applications. This module includes Webit&NEU system initiation, serial port driver, and network driver.
3.4. Communication between Different Webit&NEU Devices
The basic communication mechanism for the Webit&NEU is sending and receiving the format message through CC2530 during different Webit&NEU devices. The implemented format of data packet includes link types, message length, bit identification, source/destination task, order/response identification and data as Figure 10 shows, which aims to implement wireless communication efficiently [15].

The communication format of data packet.
The first 4 bytes of the data packet is preamble which is used to implement the packet synchronization, and the following byte is start-of-frame delimiter (SFD), whose value is 0A7H used to indicate the beginning of the data packet, the next byte is the length of the data packet, and its low 7 bits is used to save the value of length, so its maximum value is 127, the following bytes are the PHY service data unit (PSDU), and it is composed of MAC header (Including frame control, sequence number, and addressing number), payload, and MAC footer. While sending message between different Webit&NEU devices, the reduced message format is put into the payload of the data packet.
In a word, the microprocessor of Webit&NEU controls the CC2530 to send and receive data so as to implement the wireless communication between different Webit&NEU devices.
3.5. Implementation of TCP/IP Protocol
As the storage resource of the ATmega 128L is relatively limited, so this paper aims to implement a reduced TCP/IP protocol so as to meet the basic requirements in the practical application. The design of TCP/IP protocol stack is using hierarchical structure. About link layer, it refers to the network card driver so as to implement the functions of receiving and sending Internet data frame, as this procedure depends on hardware address. Considering that IP protocol in the network layer is IP address, a dynamic translation between these two addresses is needed.
System judges the type of the data packet if it is ARP request (value is 0806H), and then the system will call the ARP response module; if it is IP packet (value is 0800H), system will then upload the packet to network layer and then call the IP handling module.
The system executes correspondingly operations according to the protocol value of IP packet existent in IP Input function; if the value is
For the TCP protocol in the transport layer, if the port of TCP is

Process flow of data packet.
In order to evaluate the network performance, we tested the parameters 20 times in terms of network response time, network upload rate and download rate. The maximum, minimum, and average values are described respectively in Figures 12, 13 and 14 shows. Network response time, network upload rate, and download rate are very important for evaluating the network performance, which can well reflect the network transmission velocity and real-time ability.

Experimental test results about network response time (μs).

Experimental test results about network upload rate (kbps).

Experimental test results about network download rate (kbps).
The experimental test results show that Webit&NEU OS performs better than Webit5.0 OS in terms of network response time and network upload and download rate. Compared with Webit&NEU OS and TinyOS 2.1.2 systems, Webit&NEU OS has little quicker network response time than TinyOS 2.1.2, but the network upload rate and download rate are slower than TinyOS 2.1.2. In general, the network performance of Webit&NEU can meet the basic requirement of data transmission so as to make sure that Webit&NEU can well be applied to the IoT [6, 7].
4. Localization Algorithm Designed for Webit&NEU
One of the most important functions for this system is to manage the devices efficiently, so obtaining the position of certain device is very necessary for Webit&NEU. The development of Webit&NEU is devoted to make it well used in the practical application; thus, the research of their localization is very important, because it directly affected the communication ability and efficiency.
Based on the traditional localization algorithm TL (used in the Webit2.0), we propose an improved localization algorithm ETL for Webit&NEU used in the IoT. In below discussion about localization algorithm, each Webit&NEU is regarded as a node.
The localization of nodes in the two-dimensional space can directly be calculated by their distance between nodes. If only knowing the coordinates of the two reference nodes

Analysis of node localization.
Calculating the distance between nodes above is under the assumption that the distance measurement is carried out with absolute precision; however, the measurement error is inevitable in the practical application environment. Supposing the error range is

Analysis of node localization error.
While the error value of s is small enough, then the error value can be approximated as the region formed by the hexagon of
So while the condition of
While arranging reference nodes in the monitoring region, the above localization method canminimize the localization error. However, the three reference nodes of
We can get the position of unknown node by using the improved localization algorithm as below.
Algorithm 1 (proposed ETL algorithm).
Step 1. Calculate distance
Step 2. Every node sends broadcast packet periodically, and each broadcast packet should include a message as the format of
Step 3. After receiving the broadcast packet, system calculates the distance
Step 4. While database receives N messages totally, for each set of
Step 5. Use three nodes whose angle exists in the range of
Step 6. For all the position of unknown node
For TL algorithm used in Webit2.0, it gets the position by rough calculation firstly and then obtains the final value by repeated similar procedure. Compared with TL algorithm, the ETL algorithm we proposed avoids some repeatable process by the above specific filter. The subsequent experiments will evaluate the performance of localization error and localization time for the ETL algorithm.
(a) The Test and Analysis of Localization Error. In order to locate the position of unknown devices, the two localization algorithms are both implemented. We compared the testing results by executing the Webit&NEU OS. The experimental region adopted is the indoor environment whose area is 4 m * 6 m. There are totally 17 Webit&NEU devices as the reference node, which are placed by the method of the above localization algorithm, and these devices form 20 equilateral triangles totally in this localization area.
As the Figure 17 shows, while the number of Webit&NEU devices is 3, the localization error caused by the two algorithms is close, but, with the increase of the Webit&NEU devices number, the localization error of ETL algorithm decreases more quickly than that of TL algorithm. While the number of Webit&NEU devices reaches to 6, the localization error decreases smoothly for ETL algorithm, but correspondingly while the number of Webit&NEU devices reaches to 12, the localization error begins to decrease smoothly for TL algorithm.

Comparison of localization error.
The comparison of the two algorithms verifies that the the ETL algorithm causes less localization error than TL algorithm; thus ETL algorithm is better to be used in the IoT because of its good localization accuracy.
(b) The Test and Analysis of Real-Time Ability. In order to test the real-time ability ETL algorithm, we also implement ETL algorithm and TL algorithm separately based on Webit&NEU OS and evaluate the real-time localization ability while the number of Webit&NEU devices is increased continuously, and the experimental results measured are shown in Figure 18.

Comparison of localization time.
As we can see from the above results, while the number of Webit&NEU devices is 3, 4, and 5, the localization time for these two localization algorithm is almost the same, but with the increase of the number of Webit&NEU devices, the localization time of ETL algorithm increases exponentially while ETL algorithm increases correspondingly smoothly.
From the above analysis we can know that ETL algorithm is better than TL algorithm in terms of good-time ability and higher localization accuracy [17, 18]. Due to these features of good real-time ability and less localization error, thus ETL algorithm can be better executed for Webit&NEU in the practical application [19].
5. Conclusions
Webit&NEU is a new device designed to be used in the IoT in order to implement smart management of devices. This paper mainly introduces its hardware architecture, software system, wireless communication module, RFID module, and network protocol module. In order to evaluate its real application value, we improve traditional localization algorithm used for Webit2.0 and propose an ETL algorithm, and the experimental results show that ETL algorithm has good real-time ability and less localization error than the traditional one. Besides, experimental results in terms of task switching time, max interruption inhibit time, network response time, network upload rate, and network download show that it works well and can also meet the basic application requirements for the IoT. The Webit&NEU OS can well be executed in some experimental tests, but it still will be continuously optimized so as to better be applied to IoT.
The design and implementation of embedded device Webit&NEU will provide a good solution for the IoT. The widely application of Webit&NEU will undoubtedly bring great convenience for people to implement smart management of devices. At the meantime, the design aim of light weight and low cost will certainly facilitate the widely usage of Webit&NEU.
Footnotes
Conflict of Interests
The authors declare that there is no conflict of interests regarding the publication of this paper.
Acknowledgments
This work is partly supported by the National Natural Science Foundation of China (no. 61101121), Fundamental Research Funds for the Central Universities of China under Grant no. N110404002, Key Laboratory Project Funds of Shenyang Ligong University under Grant no. 4771004kfs03, Educational Committee of Liaoning Province Science and Technology Research Projects under Grant no. L2013096, and Cultivation Fund of the Key Scientific and Technical Innovation Project, Ministry of Education of China (no. 708026). The authors thank Jan Vitek, Ales Plsek, and Lei Zhao for their help during studying at Purdue University from September 2010 to September 2012. The authors also thank the anonymous reviewers for their valuable comments.
