Группа авторов

The Smart Cyber Ecosystem for Sustainable Development


Скачать книгу

create a simple IoT problem into a complex one that falls under the problem of interoperability.

      To resolve such user syntax interoperability problems worldwide, there are different solutions that provide unique device identification addresses to devices such as Electronic Product Codes (EPC), Universal Product Code (UPC), Uniform Resource Locator (URL), and IP addresses IPv6. For resolving syntactic interoperability problems there are different approaches such as Open standard protocol (IEEE 802.15.4, IEEE 802.15.1, and Wireless HART), Closed standard protocol (Z-Wave), Service Oriented Computing (SOC), and web services. But all these approaches have the problem of heterogeneity and, therefore, incompatible with each other to perform communication. So, we have certain middleware technologies such as Universal Middleware Bridge (UMB) that resolve such devices interoperability problems that have been generated due to heterogeneity amongst them. Thus, in this topic we have discussed IoT which is surrounded by heterogeneity problems, which can be resolved using interoperability features. The next topic explains about the programming technologies concerned with IoT.

      The programming technologies associated with IoT such as Arduino programming, Python programming, and Raspberry Pi are well known. Arduino programming can be done in consultation with the Arduino UNO board to accept analog and digital signals as input and generate desired output. Python is a lightweight programming language that is very much popular for IoT application development. Raspberry Pi is powerful compared to Arduino in terms of memory capacity and processing power. Raspberry Pi is a single-board, low-cost computer that provides easy access using GUI.

      1.5.1 Arduino

      Arduino is low resource consuming and cheaper in cost. Due to these two characteristics, it is popular worldwide for implementing the IoT. As shown in Figure 1.4, Arduino is an open source programmable board with a built-in microcontroller and the software (IDE). So, using this Arduino board, we can have input as analog or digital signals and produce digital signal as an output and there is no need to have a separate programmer to program it like traditional microprocessor 8051 and 8085. To program the Arduino microcontroller board, open source software of Arduino IDE is utilized using C or C++ programming language. IDE can be downloaded from Arduino’s official website [22].

Photo depicts Arduino UNO board.

      Figure 1.4 Arduino UNO board [21].

      Table 1.1 Arduino function and its description.

Function Function Description
pinMode(pin, Mode) Configure the input/output pin(s) with its pin number in the arduino board. pin = pin number on Arduino board, Mode = INPUT/ OUTPUT
digitalWriter() Write digital pin value (HIGH/LOW)
analogRead() Read from analog input pin
Delay() Provides a delay of specified time in milliseconds

      Using the above common function, we can write down a program in Arduino IDE that is used for “Blinking LED”. To perform this practical on an Arduino board, we require several objects/entities as hardware such as an Arduino micro-controller board, USB connector, LED, respective capacity of resistor, bread board, connecting wires, and as a software Arduino IDE as shown in Table 1.2.

      Table 1.2 Arduino programming requirement.

Activity Hardware Side Software Side
Prerequisite Arduino micro-controller board, USB connector, LED, respective capacity of Registers, Bread board, Connecting wires Arduino IDE
Process ✓ Using connecting wires, set LED on breadboard and connect it to Arduino Using USB connector, connects Arduino board to PC • Select Board and Port type • Write equivalent Sketch in Arduino IDE Verify sketch and upload it

      Sample Arduino “Sketch” for Blinking LED: void Setup( ) { pinMode(12, OUTPUT); // set arduino pin number 12 for digital output } void Loop( ) { DigitalWriter(12,HIGH); // Turn ON the LED Delay(500); // wait for 500 millisecond = 0.5 second DigitalWriter(12,LOW); //Turn OFF the LED Delay(500); // wait for 500 millisecond = 0.5 second }

      As shown in Figure 1.5 Raspberry Pi is a low-cost, single-board, palm-size computer that provides easy access. Raspberry Pi has higher processing capabilities and more features compared to Arduino [23]. So, such programming technology is better when we have more data for processing such as image and multimedia sensor data processing. To do so, we can download freely available Raspberry Pi–based operating systems which are GUI-based systems. For example, Raspbian and Noobs are officially supported OS for Raspberry Pi. Other operating systems that also support this technology are Windows 10 core, Snappy Ubuntu code, Ubuntu Mate, Pinet, and Risc OS. Supported programming languages for Raspberry Pi are C, C++, JAVA, Python, and Ruby. The following Raspberry device can act as a server as well as a node in IoT networking. So, we can create an interactive environment using such a network of connected devices.

      We can have an IoT-based system that can perform different tasks such as collecting data from connected sensors of the network, send such received data to a remote machine or server, process the data, and respond accordingly in the IoT network. For example, suppose we have a digital DHT (Digital Humidity Temperature) sensor that senses the data of the surrounding environment. Collected data is then transferred to server and saved on server for further processing and after processing such information is updated on screen based on responses available from the network.

      To do so, we require a digital humidity temperature sensor, register, jumper wires, and Raspberry Pi unit. As shown in Figure 1.6, DHT sensors have four pins numbered as 1, 2, 3, and 4. Pin 1 used for power supply of 3.3 to 5.0 V, pin 2 used for data, pin 3 is null, and pin 4 utilized for ground. So, connect pin 1 of DHT sensor to the 3.3V pin of Raspberry Pi, connect pin 2 of DHT sensor to any input pin of Raspberry Pi and connect pin 4 of DHT sensor to ground of Raspberry Pi. So, after establishing connection of DHT sensor with Raspberry Pi, reading data from sensor using “.read_retry” method consists in “Adafruit” library of DHT22 sensor. To transfer data to the server, we can establish a connection between client and server, send data from client to server and then save the data in a particular file at server end in the form of a log file. Data processing is done at server end that may include filtering