• Tiada Hasil Ditemukan

Protocols used in the system

In document DECLARATION OF ORIGINALITY (halaman 61-65)

Chapter 5: System Specifications and Implementation

5.1 Specification: Analysis and Design

5.1.1 Protocols used in the system

To design a system that the modules are able to communicate with each other, the system needs some protocols, in order for them to communicate and send data to each other. In a typical IoT system, protocols such as TCP/IP, UDP/IP, HTTP/HTTPs, would be used. In this section, the protocol that were implemented in the system will be discussed and analysed.

The list below shows the protocols that were used in the system:


Each of them will be discussed in detail to further investigate why and how it is used.

IP - “The Internet Protocol is where it all begins. IP is responsible for basic networking.

The core of the IP protocol works with Internet addresses and every computer on a TCP/

IP network must have a numeric address.” (Neale, G 2013) Every device that is connected to a network need to have an unique IP address within the network. IP addresses are used to identify each device and this will allow them to communicate with each other. In this case, the ip address will be assigned to the Arduino UNO, which is the base station, in order to grant it internet access to the local area network. After the IP is assigned to Arduino UNO, the station will be able to send its data to the device that is on the same network or different network by using port forwarding. On the other hand, Raspberry Pi, which is the central server, also need to have a IP address setup, in order for it to connect to the local network and make it accessible from the Arduino UNO.

When both devices are in the same network, the communication between both will be

can observe that the total length of ip is 32 bits, which included all the required information such as TTL, Source Address, Destination Address, etc.

Figure 5.1: The IPv4 protocol datagram

UDP - On top of IP protocol, UDP data transfer protocol is used to transfer the data from Arduino UNO to Raspberry Pi. UDP stands for User Datagram Protocol. The UDP works similar to TCP transport protocol, but it throws all the error checking staff out of the datagram. It will just send the data continuously from the source to the destination without checking whether the data is received by the destination (the receiver). The UDP saves its overheads by throwing away the checking staffs such as ack and fin hand-shaking protocols, etc. Hence, the devices can communicate with each other more quickly. “UDP is used when speed is desirable and error correction is not necessary.”

(Neale, G 2013) Due to this reason, UDP was used, as the system requires real-time monitoring, the UDP will provide such privileges to allow a quick data transfer between Arduino UNO and Raspberry Pi, miss of a little data is not that significant in this case.

The graph below shows comparison between TCP/IP and UDP/IP, it will shows why UDP is necessary as compared to TCP in this system.

Table 5.1: TCP/IP as compared to UDP/IP


1 Connection oriented protocol Connectionless protocol

2 Connection in byte stream Connection in message stream

3 Provides error-checking and control Error-checking and flow control is not provided

4 Induce more latency in transferring data Lower overheads mean faster data transfer

From the table above, one can see that UDP/IP is a connectionless protocol, which means it doesn’t care whether the receiver receive the data that was sent from the source, this is what make the UDP/IP to become a faster and a lower latency data transferring protocol.

The internet protocol layer model is as shown in below, it shows the relationship between TCP and UDP in typical internet layer model. One can see that both of them are on the same layer, which is Transport Layer.

Figure 5.2: Internet Protocol 5-Layer Model

MQTT - “MQTT is a machine-to-machine (M2M)/"Internet of Things" connectivity protocol. It was designed as an extremely lightweight publish/subscribe messaging transport. It is useful for connections with remote locations where a small code footprint is required and/or network bandwidth is at a premium.” (MQTT.org). In this project, MQTT is used to transfer the data from Raspberry Pi to Openhab. There are 2 main modes in MQTT protocol, one is MQTT Client, and the other one is MQTT Broker.

MQTT Client is the subscriber that request the data from MQTT Broker, where MQTT Broker is the Raspberry Pi and MQTT Client is Openhab in this system. The graph below

helps to demonstrate how the MQTT Client and Broker work together and their relationship in a nutshell.

Figure 5.3: The relationship between MQTT Client and MQTT Broker

From the diagram above, one can observe that the MQTT Broker is the Raspberry Pi, which will publish the data that is subscribed/requested by the MQTT Client (Openhab).

MQTT provides a transfer layer that is quick and secured, hence, the data transfer between the Client and Broker can be performed almost immediately and securely. This characteristic suits the application of the real-time processing which is used in this system. Once the MQTT Client requests the data from MQTT Broker, this action will immediately be performed, whether it is requesting data from, or sending data to MQTT Broker. The graph below demonstrate how the system work as whole with the protocols.

Figure 5.4: The whole system implemented with various protocols

The graph above shows the relationship between each module with different protocols.

The protocol used between Arduino UNO and Raspberry Pi is UDP/IP and the protocol

used between Raspberry Pi and Openhab is MQTT. This shows how the system work as whole and how the modules (Arduino UNO, Raspberry Pi and Openhab) work and communicate with each other.

In document DECLARATION OF ORIGINALITY (halaman 61-65)