Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/261037291

A data/image transmission device based on TCP/IP protocol

Conference Paper · September 2012


DOI: 10.1109/WiCOM.2012.6478277

CITATIONS READS

6 2,818

5 authors, including:

Bo Shang Yunzhou Zhang


Missouri University of Science and Technology Northeastern University (Shenyang, China)
15 PUBLICATIONS 74 CITATIONS 158 PUBLICATIONS 1,407 CITATIONS

SEE PROFILE SEE PROFILE

Some of the authors of this publication are also working on these related projects:

Fractional order flight control View project

Person re-identification View project

All content following this page was uploaded by Bo Shang on 07 July 2014.

The user has requested enhancement of the downloaded file.


A Data/Image Transmission Device Based on TCP/IP
Protocol
Bo SHANG, Chengdong WU, Tingting MENG, Chengxi GAO, Yunzhou ZHANG
College of Information Science and Engineering
Northeastern University
Shenyang 110819, China
cnpcshangbo@gmail.com

Abstract—In order to collect energy monitoring data of large-


ZigBee Power supply 220V Watchdog
scale public buildings, a data/image transmission device based on
circuit

Data acquisition unit


embedded TCP/IP protocol is designed and made in this paper.
This device was designed with STM32 chips, receiving data or

Internet
original images from meter reading device wirelessly, and ZigBee STM32F103RDT6 Network
transferring the data and images to monitoring center with module interface
TCP/IP protocol through the existing Internet communication
backbone creatively. The results of the studies showed that the
wirelessly effective distance is 90m, Internet communication LCD display Function keys SD card file system
average transmission rate reaches 11.53 KB/s and this device has
a high accuracy, low power consumption, a good stability and Figure 1. System function structure
supports communications across the gateway, which are suitable
for using in consumption monitoring system in large-scale public
buildings. A. Core processor
STM32F103 is selected as core processing chip, which has
Keywords-Energy Monitoring; TCP/IP Protocol; Data/Image a high-performance ARM® Cortex-M3 32-bit RISC core. This
Transmission; Embedded System; Communications across the chip works at 72MHz and has built-in high-speed memories
Gateway (flash memory as high as 128K bytes and SRAM as high as
20K bytes). The communications between the core processing
I. INTRODUCTION chip and peripherals are realized with 2 integrated SPI ports, a
Ethernet technology obtained fast development because of UART asynchronous serial interface, etc. The resource
its low price and high degree of flexibility. It is not only widely allocation is shown in Table 1.
used in the business office area, but also in a dominant position
of the upper network communication market in commercial TABLE I. PROCESSOR RESOURCE ALLOCATION
computer network communications and industrial control
Then Functional
systems. Its application in embedded devices is becoming if Pin is And Application is
configuration is
wider and wider and its market share is getting higher and PA4-PA7 SPI SD card file system
higher [1-3]. PB10, PB11 UART ZigBee communication module
PB12-PB15 SPI TCP/IP protocol PHY module
Energy monitoring for large public buildings is not only PC0-PC15 16 bits parallel LCD display
one of the social development trends, but also the future
development direction of the public sector achieving modern B. Peripheral circuit design
management [4]. This paper introduces a design of data/image The power modules use a level transition chip AS1117-3.3
transmission device based on embedded TCP/IP protocol. This to convert a 5V power supply to a 3.3 V one which is used by
device can receive data from energy monitoring meter through the whole board. AS1117-3.3 is an efficient DC/DC converter
ZigBee wireless communication, which avoids troublesome with MOSFET and perfect protection function.
integrated wiring [5-7].
The display module adopts a 2.8 inch TFT LCD screen,
which has 320 * 240 pixels and displays 262K colors. This
II. SYSTEM ARCHITECTURE AND HARDWARE DESIGN module adopts 3.3 V power supply and uses 16 parallel bus to
The hardware of the intelligent device designed by this communicate with the core processor.
paper mainly includes micro controller, ZigBee communication
module, power supply circuit, function keys, SD card file There are two interfaces (SD bus and SPI bus) to
system, TCP/IP protocol PHY module, etc. Its function and communicate between the core processor and the SD card file
hardware architecture is shown in Fig. 1. system and the SPI interface is chosen.
4 pins have been used by SPI communication. Every pin
needs to be connected with a 45k pull-up resistor to ensure the
communication.

Study of multidimensional information perceptual system on the disaster


site based on UAV and sensor network, Numbers: RLO200913. (National key
laboratory of robotics)

978-1-61284-683-5/12/$31.00 ©2012 IEEE


CC2430 chip is used in the ZigBee module, which meets 2) Having error checking and flow control mechanism;
the 2.4 GHz ZigBee technology standards. UART
asynchronous serial interface is used to communicate the core 3) Reliable.
processor with CC2430. Considering the characteristics of TCP and UDP protocol,
TCP protocol is chosen in this paper.
C. Ethernet interface design
Embedded network interface usually has the following B. Wireless communication protocol choice
kinds: Data transmission device designed in this article needs to
z Using network interface chips such as RTL8019 collect data from the field instruments wirelessly, therefore a
which has MAC layer protocols. This method has a low price, short-distance, low power consumption, low transmission rate,
whereas software development is relatively complicated. low cost wireless communication technology is needed in order
to guarantee the system reliable and safe. Contrast and analysis
z Using network interface chips such as W5100 which on existing different protocols are shown as following [8]:
has TCP, UDP protocol. This method costs slightly higher than
the first one, nevertheless, the complexity of software (1) Bluetooth technology. It works in 2.4 GHz ISM free
development is relatively lower. frequency band with low power consumption and it supports
network in small scale less than 10 meters. Therefore Bluetooth
Important protocols such as TCP and UDP are realized technology is technically complicated with a high cost and a
through the hardware in W5100 and hardware is more short transmission distance;
responsible than software, therefore the W5100 method is
chosen in this paper as a result of ensuring the system (2) GPRS/CDMA technology. The network environment
reliability. needs to be paid. It is suitable for long-distance transmission
with high power consumption, small size of networks and a
System hardware is shown as Fig. 2. wide range[9];
(3) WLAN technology. It works in free frequency band
with high power consumption and high transmission rate[10];
(4) ZigBee protocol. The network security is high with
high capacity and low cost.
Through the contrast and analysis, ZigBee protocol is
chosen in this paper.

C. ZigBee Data agreement

In order to ensure the efficiency and reliability of


communication, communication protocol between data sending
nodes and data receiving nodes is designed as following. Each
Figure 2. System hardware packet consists of 8 bytes and the meaning of each byte is
shown in Table 3.

III. COMMUNICATION PROTOCOL DESIGN


TABLE III. PACKET FORMAT OF TRANSMITTING NODE
A. Ethernet communication protocol choice Energy
Order Integer part Decimal
consumption meter ValidationStop bit
type of Data part of Data
type
In Ethernet communication, two kinds of agreements are
Order Type Data1 Data2 Data3 Data4 Check End
most commonly used. They are TCP protocol and UDP
protocol. The characteristics of two kinds of protocol are In this agreement, command character and command values
shown in Table 2. are shown in Table 4.

TABLE II. COMPARISON BETWEEN TCP AND UDP TABLE IV. COMMAND CHARACTER AND COMMAND VALUES

TCP UDP Order Value(decimal) Function


Connection Yes No TEST 0 Used to test whether the chip works
Error checking and Flow control Yes No SEND 1 Send mode
load Heavyweight Lightweight RECEIVE 2 Receive mode
Reliability Reliable Unreliable SLEEP 3 Sleep mode
RETAIN1 4 User-defined
In this paper the requirements of Ethernet communication RETAIN2 5 User-defined
are shown as following:
Energy consumption meter types and values are shown in
1) Communication connection is stable; Table 5.
TABLE V. ENERGY CONSUMPTION METER TYPES AND VALUES
Start
Type Value(decimal) Description
GAS 0 Gas meter
ELEC 1 Electric meter Read configuration
WATER 2 Water meter
from SD card
KEEP1 3 Undefined
KEEP2 4 Undefined
The checking data is the sum of seven digits in the data Initialization
packet, which is in decimal.
According to the order type, sending node can choose
different modes to transmit data through ZigBee. When the
receiver receives the packet, it will send a packet back for N Receive
response. The format of the data packet in which receiving data/image from
node sends back is shown in Table 6. ZigBee?

Y
TABLE VI. REPLY PACKET FORMAT
Store data/image in
Beginning Receive Status User-defined Ending SD card
Begin Status Keep End
The value of "Beginning" and "user-defined" are defaulted
to 0. The value of "Ending" is defaulted to 1. Receive status is Whether data/ N
divided into two types. The one is to successfully receive and images reached the
marked with OK, whose value is 0; the other is to biggest number?
unsuccessfully receive and marked with ERROR, whose value
Y
is 1.
Sent data/images
IV. SYSTEM SOFTWARE DESIGN to destination PC

A. Software architecture design


The main function is receiving data/image information
from data acquisition device through ZigBee wirelessly and Display the number
passing on this information to PC monitoring center on the of images stored
Internet. Main function flow of system software is shown in
Fig. 3. The control process of this device can be divided into
three procedures.
Figure 3. Main program flowchart

Procedure 1: Power up the device, initialize the device as


the configuration information stored in the SD card.
The information include three parts: ZigBee transfer mode,
TCP transfer mode, IP configuration.
ZigBee transfer mode is used to configure the number of
ZigBee devices connected with this device, ZigBee device ID
and the receiving frequency.
The period of receiving can be calculated as in (1).
1
TZigBee = (1)
f ZigBee
f ZigBee
is the receiving frequency.
TZigBee
is the receiving period.
TCP transfer mode is used to configure the TCP connection
frequency. TCP connection frequency must be lower than the
ZigBee receiving frequency.
TCP connection period can be derived as in (2).
1 (2) A socket of W5100 binds IP for 192.168.1.100, and
TTCP = port for 5100;
f TCP (2) (3) This socket launch request to PC
(192.168.3.110:30000);
f TCP is TCP connection frequency,
(4) The socket in PC allows the connection request, and a
TTCP is TCP connection period. TCP connection is established;
(5) Both sides use this connection to send data;
The biggest number of data/image storage can be calculated
as in (3). (6) When one side launches request to disconnect,
connection breaks.
TTCP
n max = C. SD card file system design
TZigBee
(3) FatFs library is used in the SD card operating module as an
interlayer driver. It is a general file system module, used in
n max is the biggest number of data/image storage. If the embedded systems to realize FAT file system. FatFs follows
number of storage reaches the biggest, the data and images ANSI C standard, therefore it does not rely on hardware
should be transferred through TCP. platform. Using the file system is to allow the SD card to be
read or written by most devices, which means the information
IP configuration information includes local IP address, on the SD card written by the embedded system can be read
local port, destination IP address and destination port. with Windows or Linux.
In the flow, the initialization includes chip clock
configuration, chip pins configuration, SPI bus initialization, V. EXPERIMENTAL DATA AND ANALYSIS
W5100 initialization, LCD initialization and SD card In order to validate the communication performance of the
initialization. device, two experiments are designed as following:
Procedure 2: The loop body. (1) Data transmission test. Data terminal sends data by
This device can operate as the configuration stored in SD ZigBee module. The device receives data through ZigBee
card. If the device receives data/images, it stored them in SD module and passes on data to PC through Ethernet;
card. Then it updates the number of stored images on LCD. (2) Image transmission test. PC transfers the pictures to the
If the number of stored images reaches the biggest number, device via Ethernet.
this device transfers the information through TCP.
A. Data transmission test
Procedure 3: Go to the next loop.
Data transmission process is: (1) Data terminal collects
data; (2) Data terminal transmit data through ZigBee; (3)
B. TCP protocol communication mechanism across gateway TCP/IP transmitting device receive data from ZigBee receiver;
In actual use, many types of equipment are not directly (4) TCP/IP transmitting device pass data on to PC receiver.
connected to the Internet, but through LAN. Therefore, Therefore, Data transmission test can be divided into ZigBee
communications across gateway need to be considered in the wireless communication test and TCP data communication test.
design.
Fig. 5 shows the PC data receiver, the main functions are:
In Fig. 4 gray boxes represent routers. Communications
between PC monitor center and the W5100 chip belong to a) Show local IP address when system starts;
communications across gateway. W5100 chip must launch b) Default port is 30000;
request to PC when they need to communicate.
c) Show the program state;
d) Operation control is available with simple buttons;
e) The current data are shown with large font;
f) The data histories are displayed with receiving time;
g) A database is used to store data and receiving time.

Figure 4. Connecting across gateway schemes in TCP protocol layer

The communication procedures are as follows:


(1) PC(IP:192.168.3.110) binds its socket for 30000;
Connect the device and a PC to the same network, use TCP
image sender to send the images. Fig. 6 shows that the picture
is transferred successfully from PC to device.

Figure 6. Image transmission test from PC to device

2) TCP transmission efficiency


The TCP transmission efficiency range from 11.43 KB/s to
11.56 KB/s when different sizes of image files are used to
experiment. The average transmission efficiency is 11.53 KB/s,
which shows the transmission is pretty stable. The statistics are
shown in Table 7.

TABLE VII. DOCUMENT TRANSMISSION TEST DATA THROUGH TCP

No. Size(B) Time(ms) Speed(KB/s)


1 1829 160 11.43
2 11122 972 11.44
3 20264 1757 11.53
4 32236 2788 11.56
5 42351 3666 11.55
Total 107802 46736 11.53
With the data, we can draw a graph as Fig. 7, we can realise
that there is a proper amount of file size that can lead to the
Figure 5. PC data receiving system interface highest speed. The proper amount of file size is near 32236 B.
11.58
The experiment shows that the TCP communication is well 11.56
and the PC data receiving system works properly to display and 11.54
log data.
Speed(KB/s)

11.52
11.5

B. Image transmitting experiment 11.48


11.46
1) Image transmitting process 11.44
The image transmitting process is that PC image sender 11.42

transfers the pictures to the device, which can show a picture 0 20000 40000 60000
File Size(B)
80000 100000 120000

on LCD after receiving a whole image.


Main functions of TCP image sender are:
a) Show local IP address when system starts;
b) Default port is 30000; Figure 7. Relationship between file size and speed
c) The source directory is the file folder storing the
pictures being transferred; When file size is between 0 to 32236 B, the speed increases
as the file size increases, because the larger the file size is, the
d) Display the file size of the picture; more message can be transferred at once. When the file size is
e) Display the time used to transfer each file; more than 32236 B, the file is divided into too many pieces,
and the pieces conflict with each other which results in a longer
f) Show the program state;
delay. Therefore, the figure is like that.
g) Provide friendly user interface;
3) Relation between TCP transmission efficiency and sub
h) Preview the picture being transferred; packet size
i) Log the operations and the TCP transmission In the transmission efficiency experiment, sub packet size
efficiency to a predetermined file. can influence the transmission efficiency.
Therefore, the sub packet size is set to be 200 B, 400 B, 600 This work is supported by the Chinese Academy of
B, 800 B, 1000 B and 1200 B separately, and measure the time Sciences and directed by Professor Wu and Lecturer Zhang.
used to transfer 21 files. The relation between TCP
transmission efficiency and sub packet size is shown in Table REFERENCES
8.
[1] D'Ambrosia, J. “THE NEXT GENERATION OF
TABLE VIII. RELATION BETWEEN TCP TRANSMISSION EFFICIENCY
ETHERNET”. Communications Magazine, IEEE, Vol.
Sub packet Speed(KB/s) 46, No. 1, pp. 8-15, 2008.
File size(B) Time(ms)
size(B) [2] Sommer J, Gunreben S, Feller F, Kohn M, Mifdaoui A,
200 538975 55327 9.74 Sass D, Scharf J. “Ethernet – A Survey on its Fields of
400 538975 50406 10.69
600 538975 48178 11.19 Application”. Communications Surveys & Tutorials,
800 538975 47299 11.40 IEEE, Vol. 12, No. 2, pp. 263-284, 2010.
1000 538975 46736 11.53 [3] Nan Xie, Haibo Zhang, Weimin Chen, Yan Ma, Jinghua
1200 538975 46456 11.60 Tian. “Research and Design of Industrial Ethernet
1400 538975 46315 11.64
Intelligent Gateway Based on ARM”, The 2008
International Conference on Embedded Software and
12 Systems Symposia, Chengdu, Sichuan, China: ICESS,
11.5
pp.324-327, 2008.
[4] Perumal T, Ramli A R, Chui Leong. “Design and
Speed(KB/s)

11 implementation of SOAP-based residential management


for smart home systems”, Consumer Electronics, IEEE
10.5
Transactions, Vol. 54, No. 2, pp. 453-459, 2008.
10 [5] Limeng ZHAO, Yunzhou ZHANG. “Design and
Research of Digital Meter Identifier Based On Image and
9.5 Wireless Communication”. International Conference on
0 200 400 600 800 1000 1200 1400 1600
Sub packet size(B)
Industrial Mechatronics and Automation, 2009.
[6] Mohd Adib B. Sarijari, Rozeha A.Rashid, Mohd Rozaini
Abd Rahim, et al. “Wireless Home Security and
Figure 8. Relationship between sub packet size and speed Automation System Utilizing ZigBee based Multi-hop
Communication”. Proceedings of IEEE20086th National
Fig. 8 shows that transmission efficiency increases when Conference on Telecommunication Technologies and
the sub packet size increases. The reason is the larger the sub IEEE2008 2nd Malaysia Conference on Photonics.
packet size is, the more data can be transferred through one Putrajaya, Malaysia, pp.242-245, 2008.
communication. However, the device can not show the entire [7] ANG Zhimin, JIN Haihong, FAN Zhiguo, DUAN Yong.
picture when the sub packet size is over 1600 B, because of the
“WSN Node Design and Communication Realization
limitation of the chip buffer. The chip buffer is 2000 B, but
some of the space is used by the TCP protocol head, which is Based on ZigBee Protocol”, Modern Electronics
not real data [11]. In order to ensure the data integrity, the sub Technique, Vol. 10, pp.47-50, 2007.
packet size is defined as 1400 B after verification test. In this [8] Soo Young Shin, Hong Seong Park, Sunghyun Choi,
way, the highest transmission efficiency is 11.64KB/s. Wook Hyun Kwon. “Packet Error Rate Analysis of
ZigBee under WLAN and Bluetooth Interferences”,
Wireless Communications, IEEE Transactions on, Vol. 6,
VI. CONCLUSIONS
No. 8, pp.2825-2830, 2007.
This paper focuses on communication between embedded [9] Zhen-qian Hua, Ya-dong Zhang. “Security protection
system and PC through TCP/IP protocols. A device that can discuss of power load management (LM) based on
realize this communication is accomplished. The software in GPRS/CDMA”, Electricity Distribution, 2008. CICED
the embedded system and the PC client are debugged. The 2008. China International Conference on, pp.1-3, 2008.
experiments show that this system has a high accuracy, low [10] Smadi, M., Azhari, V.S., Todd, T.D., Kezys, V. “A Study
power consumption, a good stability and support
of WLAN-to-Cellular Handover Using Measured
communications across the gateway, which is suitable for using
Building-Exit Data”, Vehicular Technology, IEEE
in consumption monitoring system in large-scale public
buildings. Transactions on, Vol. 58, No.4, pp.2044-2054, 2009.
[11] Xie Xiren, 2008. Computer Network(In Chinese).
Beijing: Electronic Industry Press.
ACKNOWLEDGEMENT

View publication stats

You might also like