Você está na página 1de 4

Thin Layer Protocol for an Embedded Network

1
Cibin D Loui .G#, 2Suresh .A#
#
Jeppiaar Engineering College
Chennai
1anamicamails@gmail.com
2 suresharjunan2@gmail.com

Abstract— The idea is behind is to develop an network


which is not heavy (Thin Layer) to be used in Embedded
Controllers. This is done because the normal network
layers are very heavy and occupy more space and
computing power. The network is applied for automating
the home.

Keywords— Network Layers, Home Automation, Thin


layer network, Kernel Device Driver, Protocol Design.

I. INTRODUCTION
Normally Networked Home Automation Systems
will use Ethernet (LAN) to communicate between them. This
will need a lot of space and computing power for the systems.
Also the Ethernet cable costs a lot. In our system we
implement an network layer ourself which occupies very less
space. Instead of using Ethernet cable we use normal cables.
This fairly reduces the cost of the implementation. It has
Nodes, Network and an Server.
Fig 1. A Single Node in the Network
II. NODE same bus/network i.e.) they listen to what ever they send. This
Each node is really an 8051 micro-controller is used for collision detection. If one node sends others don't
(PV89V66X is used for implementation. See [1],[2] for details disturb the bus/network i.e.)They don't disturb the bus when it
of the micro-controller) which communicates with external is busy. When the node sends data and while listening it get
world. For example this micro-controller can switch a light on some other data the node decides that there is collision.
and off by using its ports. Similarly the other node also finds about the collision then
It can also read the sensor inputs like fire alarm, LDR (Light they stop sending after a definite time the server ends the
Dependent Resistor). Using this the Node can also control the message. Now any of the nodes can send the data from start.
devices without using the network. For example the
Node/Micro-controller can switch on the light when light
intensity is low by reading the LDR. This is done by using an
ADC (Analog to Digital Converter) and reading it in the
port [3].The node remains in the Network communicating
with server now and then. To increase the address space of the
micro-controller extra EEPROM can be added.

III. NETWORK
Network is implemented using C on both server and client.
In server side the network is implemented as Device Driver.
Protocol is made simple in order to make the code light
weight.
A. Protocol Fig 2. Communication between two 8051 micro-controller
The idea behind the protocol is analogous to that of our
Formal communication. Every node listens and sends in the
Fig 2. shows how Tx (Transmission) pin and Rx
(Receiving) pins are short circuited so that the node (8051
micro-controller) can listen what ever it sends.
When Node 1 communicates or uses the bus Node 2 does
not disturbs it. If both nodes sends the message at same time
then when they listen they find that the message they send and
they where listening where different so they stop using the
bus. After a certain time Server will free the bus by sending an
End message.
Fig 3. shows an complete network with an server and three
Nodes. One Node has an fire sensor. When fire sensor is
triggered that Node finds it and sends the data to Server,
which in turn sends all the Nodes to ring Alarm.

Fig 4.Start Message


B. Implementation of Protocol
2) To Address: 16 bit address specifying the receiver
Each message send and received from 8051 has 10 bits. In
address. At present implementation only server address is
which first and last bits are used as start and end bit. We are send while an Node communicates since Node can only
not interested in this two bits because they are used by
communicate with server. In future Nodes/Systems may
hardware to start and end an message. Over all Message is communicate with each other. If the message is from server
called an Packet. Each Packets have five messages to be send
this field will be that of the Node to which it communicates.
they are explained below.
Since there are 16 bits in address field 2 16 address
possible hence there are 216 nodes possible in the network.
1) Start Message: This is the starting of an packet i.e.) for (65535 Nodes and one Server).
an packet this eight bits forms the starting. Its a message 0X01
sent from the sender. This message intimates all the Nodes 3) From Address: Specifies the sender address to the
and server that the Network is busy at present. So that they receiver. Its also 16 bits. If the message is to server using this
don't use the bus/network for sending message. Start message the server understands the node and act accordingly. This
is shown in the Fig 4. gives the necessity of this message in an packet. If the

Fig 3.Entire Network with Server and Nodes


message is to an Node this address will be the address of the
server. Since the From Address is 16 bit in length two 8 bit
messages are send.
4) Device Number and Control: This Message is also
16 bits in length used to give acknowledgement or Device
number. Each device in the Node (Micro-Controller) will be
given a number with 16 bits. (e.g. An alarm connected in the
node may be given 0x0010). So roughly there can be 65536
devices in each node. In practical this is mostly not likely to
happen except for special cases. Since the Device Number and
Control is 16 bit in length two 8 bit messages are send.
5) Data about Device: Again this is sixteen bits. This
sixteen bits are used to control a device. For example to
switch an switch an light on the control data may be 0x0001
and to switch an light off data may be 0x0000. For more

complex devices there may be a need of more number of


control data. Data may be send to or from the physical device.
6) End Message: This message releases the bus so that
other devices can send or receive messages. End message is 8
bits in length and corresponding end message is 0XFF.Shown
in the Fig 5.

Fig 5. End Message

An Entire Packet is explained in the Fig 6. First an 8 bit


Start message is send. Then an 16 bit To Address is send
followed by 16 bit From Address, followed by 16 bit Device
number then 16 bit Data about device is send. Finally an End
message is send.
TABLE I
LENGTH OF MESSAGES IN THE PROTOCOL

Bit Message Name Message


Length
8 Start Message 0x01
16 To Address 0x0000-
0xFFFF
16 From Address 0x0000-
0xFFFF
16 Device No. &Control 0x0000- Fig 6. A complete packet
0xFFFF
16 Device data 0x0000-
0xFFFF
8 End Message 0xFF
C. Server Arm board can also be used for running the server. First the
Server can be a PC or an ARM board running Linux. In board must be made to run Linux for that the following steps
server side TTL logic network is converted to serial USB. A must be done. Example explained in [5]
Device Driver is wrote over the USB device driver to receive • First download an Bootstrap loader in the ARM
and send messages (Explained in [4],[6]). An application board.
software communicates with the device driver to send and • Then download or Flash the Boot-Loader(U-Boot)
receive messages. Network layer is implemented as the device in the ARM board.
driver. The Device Driver remains as a part of kernel in the • Compile the kernel (also adding the device driver
Linux OS as modules, which can be loaded and removed from into it) and Flash the Kernel to the Board.
kernel (Module can also be permanently loaded into the
Kernel). The Device layer implements the network. The
application software must send, receive and process messages.
When the application needs to send data to a Node to control
any device it must open the device driver file. Then it must
send the control data to the file. Using this file the device
driver will send the message to the Network (Since all devices
are files in Linux this procedure is used).
To receive the messages the application must create a
thread or a process and must be reading from the device file.
When a message is received it must process it and give an
acknowledgement for that message.
Server should also detect collision. If a packet is not
received completely then server understands collision has
occurred in the bus which sends the End message to free the
bus.

IV. CONCLUSIONS
In this paper we have reduced the weight of the network
layer to optimise the cost of Home automation and Embedded
Networking. We have also planned to develop an application
software for this Network so that these devices an be
controlled through internet in near future.

REFERENCES
[1] Philips Nxp website Available: ics.nxp.com
Fig 7. Device Driver and Application in Server [2] Philips 8051 datasheet
[3] Zilogic website Available: www.zilogic.com
[4] Peter Jay Salzman, Michael Burian, Ori Pomerantz, The Linux Kernel
Module Programming Guide, 2007-05-18 ver 2.6.4
[5] Vijay Kumar .B, Embedded Programming with the GNU Tool chain
[6] Jonathan Corbet, Alessandro Rubini, and Greg Kroah-Hartman, Linux
Device Drivers, Third Edition.

Você também pode gostar