Arul Prabaar A, Brahmaandha Prabhu b C-DAC, Noida, India aruiprabahar@cdacnoida.in, brahmanandha@cdacnoida.in Absnuc|- We describe a low cost distributed data collection system based on embedded Ethernet. Embedded Ethernet is nothing but a microcontroller which is able to communicate with the network. Low cost microcontrollers have memory limitations, and therefore, have limited connectivity options. Enabling a microcontroller to communicate to a data communication network would allow greater fexibility and enhance their usage in several applications that require distributed data collection, monitoring or controlling such applications. Inde Term-Embedded Ethernet, UDP, TCP/IP. I. INTRODUCTION T he reason for acquiring distributed data is nothing but to enhance the operations perfoned on the data remotely. For example, PIR sensor (Passive Infa Red) is interfaced with the microcontroller to collect the intrusion data. If the microcontroller is capable of Etheret connectivity or some other kind of data communication with exteral world, we can monitor the secured premises for any intrusion fom the remote location. We target to develop a system which has the following parts. Atmega16 microcontroller, a low cost 8-bit microcontroller fom ATMEL, ENC28J60 Etheret controller IC fom Microchip and a Parallax PIR sensor. Etheret is the global standard for data communication. It is suitable to use Etheret for distributed data collection system. TCP/IP protocol suite is the basic sofware requirement for Etheret communication. Etheret driver to control the operation of Etheret controller is also required. Both Atmega16 microcontroller and ENC28J60 Etheret controller are having SPI interface (Serial Peripheral Interface) and communication between both takes place through SPI Interface. We have limited our work to studying the implementation of distributed data collection system for Surveillance monitoring and motion detection based on PIR sensors. The main contribution of our work is that we have shown that it is possible to use an embedded Etheret device for Surveillance monitoring application. This paper is organized as follows, Section 2 discusses about basic system design. Section 3 gives the details about development of Etheret module. Application development over TCP/IP stack is given in section 4. Section 5 comments on the perfonance of the system. Section 6 gives ideas for fture work. Finally, the paper is summarized and concluded in section 7. II. BASIC SYSTEM DESIGN C5Ol MOOUlC 1 C5O! MOOUlC Z _ _ _ __ _ C5Ol MOOUlC o C5Ol MOOUlC4 Figure I:Distributed daa collection system Figure 1 shows the basic system diagram of the distributed data collection system. The system uses LAN (Local Area Network) infastructure as the backbone for distributed data collection system. The microcontroller modules with PIR sensors are called as sensor modules. The sensor modules are connected to the LAN as nodes. A PC for data monitoring is also connected to the same LAN network. A application program to monitor the data fom sensors is running on the PC. The sensor modules will be kept at different places like Entrance of the building, rooms and hallways where LAN cabling is available. As TCP/IP stack is ported in the microcontroller, each sensor module acts as a true Etheret device. The sensor modules are checking for PIR sensor data and transmitting the data to the remote PC which is also connected to Etheret. .l , !Q! E nC28j6o ! ATM EGA16A PlRppqj Rpmq!6 PC Figure 2: Hadware environment schematic Figure 2 shows the hardware environment of the system. A PIR sensor is interfaced with microcontroller. PIR sensor is capable of detecting the infa red rays radiated fom human body. PIR sensor is the basic building block of Surveillance monitoring system which detects the human motion detection. 978-1-4244-9799-71111$26.00 20 11 IEEE 97 III. DEVELOPMENT OF ETHERET MODULE 1L el+e L RJ45 Jack Figure 3: Design of Ethemet module using ENC28J60 Etheret controller is interfaced with an RJ-45 port through an Etheret transformer IC for connection to an Etheret network. The ENC28J60 is an IEEE 802.3 compatible Etheret controller which supports one 10 BASE-T Etheret port. The basic send ad receive fnctionalities of Etheret are controlled by sending appropriate commands to the ENC28J60 and confguring the registers of ENC28J60 through SPI port. Atregal6 microcontroller performs as SPI master and ENC28J60 IC acts as SPI slave. Etheret communication between the ATMEGA16A and the PC is accomplished by porting TCP/IP stack on the microcontroller and implementing User Datagram Protocol (UDP) over the TCP/IP stack. The Remote PC IP address (destination IP address), sensor module IP address (Source IP address), destination port and source port are confgured on the TCP/IP stack. The program which resides on the microcontroller reads the data fom the PIR sensor and encodes the same as UDP data packet (Figure 4). The program initiates and performs all data exchange to and fom the microcontroller, in UDP datagram format via ENC28J60 Etheret controller chip [1]. An application program on the remote PC, handles the UDP communication fom PC side. This program is responsible for monitoring PIR sensor data at the remote location and taing necessary actions like making alarm on and sending waring signal. The A TMEGA 16A microcontroller communicates with the remote PC by creating, interpreting, sending and receiving UDP datagram packets. A UDP datagram packet is a sequence of binary bits via the Etheret network. In the beginning of the datagram packet, an IP header and an UDP header are there. They contain information about the destination address, the source address and the data checksum. Payload portion contains the actual data fom sensor. FigA shows the generic UDP datagram packet. UDP checksum calculation is handled by the program running on microcontroller. IV. APPLICA nON DEVELOPMENT Figure 4: UDP Datagram Format The UDP protocol is used for transmitting sensor data, because of the datagram packet's compact size compared to other transmission protocols, e.g. Transmission Control Protocol (TCP). The application sofware on the microcontroller reads the PIR sensor continuously. It formats the UDP header and inserts the sensor data in the place of UDP data and also calculates the UDP checksum. Finally it hands over the formatted packet to the TCP/lP stack. TCP/IP stack flls the required felds in IP header like source ip address, destination ip address, source port no, destination port no, length and checksum. Etheret driver which resides on the microcontroller takes the control over the packet and transmits the packet to Etheret controller through SPI interface. Now Etheret packet to be transmitted is stored in the transmit buffer of the Etheret controller. By giving Transmit command to the Etheret controller, the packet is sent over the Etheret. Etheret controller takes care of the hardware level CRC check. Microcontroller I nitialization Read sensor output Z! Z ' c C!
Figure 5: Flow of events in the microcontroller program The remote PC gets the PIR sensor data in terms of UDP packet. The application program running on remote PC monitors the UDP packets and if there any data higher than threshold level, ensures the motion detection and raises the alarm. 98 V. PERFORMANCE OF THE SYSTEM Figure 6: Original Hardware The real picture of the data collection system developed by us is given in fgure no 4 (without PIR sensor). We constructed the system initially with P89C52 microcontroller. P89C52 microcontroller does not have SPI port. We had to transfer the data fom the micro controller to ENC28J60 bit by bit. It afected the system performance heavily. We observed that the microcontroller took 6 ms to reply back to a ping request. We decided to use another microcontroller which has SPI port. Atmega16 microcontroller was chosen. It supports SPI Interface. In this case, Atmega16 Microcontroller is working on 11.0592 Mz fequency. SPI Interface operates at around 5.5 Mz half of the SPI Master fequency. The sensor module is able to reply back to a ping request within a millisecond and it supports 10Mbps Etheret connection. We can connect this hardware with the real world network. It can act as a true etheret device. Although UDP is connection less protocol, it is sufcient for the applications which are not critical. VI. FUTUR WORK We have developed an embedded Etheret module which is capable of acquiring data fom various sensors and transmitting the data to the remote server or PC for fher processing. If we connect a temperature sensor with the microcontroller, we can monitor the room temperature remotely. If a light sensor is connected with the microcontroller, Intelligent Lighting System can be made out of this module. Like these examples, different sensors can be interfaced with the microcontroller to make different kind of applications. This Embedded Etheret module paves the way to numerous applications to be developed in the area of home monitoring and automation. VII. SUMMARY AND CONCLUSIONS We have shown that it is possible to develop a Surveillance monitoring system based on Embedded Etheret. These embedded Etheret modules are having the capacity to perform as a true etheret device. It is possible to interface diferent kind of sensors with these modules and make vaious applications. We can construct a distributed data collection system by connecting several embedded Etheret modules on the network. VIII. ACKNOWLEDGMENT The authors are gratefl to Mr.V.B.Taneja, Director (A&R), Mr.Sourish Bahera, Project Manager and Mr. Rakesh.M, Scientist-C, CDAC-Noida for their encouragement and guidance to present/publish this paper. REFERENCES jI| W.R.Stevens, TCP/IP Illustrated Volume I, Addison-Wesley, Boston, May 1994. j/| A. Dunkels. uIP - a TCPIIP stack for 8- ad 16-bit Micro controllers. Web page. 2010-10-14. UR: http://duokels.com/adauip/ '- Atmel Corporation. Embedded web server. A VR 460, January 20 I 0, Available from www.atmel.coll. 99