Android controlled Zigbee motes for Wireless Sensor Networks

B. Sree Charan Teja Reddy, N. Sai Teja and G. V. V. Sharma Electrical Engineering Department Indian Institute of Technology, Hyderabad Yeddumailaram, India 502205 Email: {ee12m1010, ee11b022, gadepall}@iith.ac.in

Abstract—This demo describes the implementation of a peer wired serial communication through Universal Asynchronous to peer message chatting application in the android platform over Receiver/Transmitter (UART) [3] port. IITH-mote can be pro- Wireless Sensor Networks (WSNs). Using the IIT-H Zigbee motes grammed using TinyOS [4] or assembly language. We use we show how to the android platform with the Zigbee TinyOS platform for programming the motes. motes and the different modes of communications involved. TinyOS is a free and open source used for I.INTRODUCTION embedded systems. One special feature of TinyOS is, it is a component-based . We can structure the WSNs are primarily used in applications where low bit problem into component implementations and reuse them. rate, low cost, low complexity and more lifetime are required. This is the optimal way to design and combine the code. WSN nodes usually consist of an 8 or 16 bit microcontroller NesC (Network Embedded System ) [5] is the programming and a short range transceiver in order to create a low cost language used in this embedded operating system. TinyOS network with maximum lifetime. Traditionally, WSNs have supports a variety of microcontroller families and radio chips. been used for sensing and reporting. Recently, however, there It efficiently manages the limited power available and renders is a great demand to support a short range communication excellent support for wireless networking. system in WSNs for use in educational institutes, residential areas and even in emergency situations. Voice over WSNs was implemented in [1]. However, this implementation was done on II. DEMO proprietary hardware. In this demo we use the android platform along with Zigbee protocol both of which are quite popular and open in nature.

Fig. 2: Text messaging between two android devices (Aakash tablet) through IIT-H motes

Fig. 1: IITH-mote Fig.2 shows peer to peer communication between android devices.Here the android devices used are Aakash tablets [6] The communication between motes is based on the Zigbee In this demo, we use IIT-H motes as nodes in the network standard. The IITH-mote is connected to the android device (see Fig. 1). IITH-mote is a 2.4 GHz mote used for enabling through microUSB serial port. low-power WSNs. It works on 8 MHz atmega microcontrollers with 8 KB RAM. It has a 6 pin usb interface jack for serial A. Radio communication communication and uses IEEE 802.15.4 [2] compliant RF (Radio Frequency) Transceiver for radio communication. IIT- Radio communication between the IIT-H motes is done H mote supports two ways of communication. One is wireless through packets. This packet based communication is com- communication through RF transceiver. The other way is pletely controlled by the TinyOS application. TinyOS application: A basic TinyOS application for radio B2B writes the message to the micro usb port byte by byte. communication contains 4 files. RS232 chip receives the bytes and convert them into UART 1. Configuration file format and sends byte by byte serially to the mote. 2. Module file 3. Make file C. Message structure 4. Header file While creating the WSN each node is given a unique identification called node ID with which user is identified. This Configuration file contains the components that are used node ID is used as source address and destination address while on IIT-H mote. Module file contains variables, code logic and messaging. B2B application provides a text field for writing the interfaces. Makefile allows platform selection and includes message. After completion of writing, touch send button next rules required to make the application. Header file contains to the text field to send the message. Text messaging follows packet structure which is important. Following is an example a message structure shown in Fig. 3. of packet structure.

#ifndef PACKET_STRUCTURE_H #define PACKET_STRUCTURE_H typedef nx_struct AmMsg { Fig. 3: Message structure nx_uint8_t counter; } AmMsg; #endif /* PACKET_STRUCTURE_H */ III. ADVANTAGES ZigBee provides low cost and low power connectivity In the above example, packet contains a single identi- devices where lifetime lasts for months but does not provide fier named ’counter’ of nx_uint8_t data type. Data type bit rate as high as those enabled by . But the bit rate nx_uint8_t in TinyOS is equivalent to unsigned character provided by Zigbee is sufficient for text chatting. Zigbee uses data type. The default maximum payload size of a packet in an unlicensed globally compatible ISM band ranging from 2.4 TinyOS is 28 bytes. In this demo we use maximum payload GHz to 2.4835 GHz. So a low cost communication system can size. be developed for use in residential areas. Since the android platform is now interfaced with WSNs, it should be possible to incorporate this in mobile devices on a large scale at low B. Serial communication cost. Serial communication is helpful in communicating with external devices. In general, a WSN will have a gateway IV. CONCLUSION for collecting data, observing network traffic and sending In this demo we implemented a peer to peer message commands to the network. A gateway is nothing but a com- chatting application in android platform over wireless sensor puting device connected with a node of that WSN. Here the networks. Since we use low power nodes with IEEE 802.15.4 communication between node and computing device is serial compliant RF Transceiver for radio communication, the range (UART) communication. TinyOS provides two different types of a node is limited to few tens of meters. The range of the of serial communication. They are packet based and packet network can be increased by using multiple hops in between. less serial communication. We can implement different topologies with good networking to cover larger areas. The realization of such a network in 1) Packet based serial communication: In Packet based residential areas should be the focus of future research. serial communication, both computing device and mote com- municate using packets. TinyOS platform on computing device V. ACKNOWLEDGMENT provides different tools for packet based serial communication. These tools help in creating, sending packets to the mote, We thank Department of Electronics and Information Tech- parsing the packet sent by mote and analyzing the data. nology, Govt of India for funding this research.

But the disadvantage of this mode is that there are no REFERENCES sophisticated tools in android platform for supporting packet [1] R. Mangharam, A. Rowe, R. Rajkumar, and R. Suzuki, “Voice over based communication. Hence we use packet less serial com- sensor networks,” Real-Time Systems Symposium, 2006. munication between IIT-H mote and tablet. [2] J. T. Adams, “An Introduction to IEEE STD 802.15.4,” Aerospace conference, December 2006. 2) Packet less serial communication: In this mode raw data [3] http://tutorial.cytron.com.my/2012/02/16/uart-universal-asynchronous- sent from tablet is converted to serial data by RS232 FTDI receiver-and-transmitter/. chip. It does not follow any packet structure. Every serial [4] P. Levis and D. Gay, TinyOS Programming, 1st ed. Cambridge communication will have a baud rate and IITH-mote supports University Press, July 2009. a baud rate of 57600. For this purpose an android application [5] D. Gay, P. Levis, R. von Behren, M. Welsh, E. Brewer, and D. Culler, called B2B was developed for this demo. This application is “The language: A holistic approach to networked embedded developed based on a demo application ’TN 147 java D2XX’ systems.” [Online]. Available: http://www.tinyos.net/papers/nesc.pdf [7] provided by FTDI. B2B will automatically detect the device [6] http://www.akashtablet.com/akashview.php. whenever mote is connected to the tablet. This application has [7] http://www.ftdichip.com/Support/SoftwareExamples/Android default settings of baud rate, data bits and parity bit to be used. JAVA D2XX Projects.htm.