Читать книгу The Smart Cyber Ecosystem for Sustainable Development - Группа авторов - Страница 23

1.5.2 Raspberry Pi

Оглавление

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 and plotting of data. Due to lack of data, there may be a chance of incomplete or corrupted data so to overcome such data, and we need preprocessing activity such as cleansing and to do so we use filtering over here. To plot the 2D data at the server end, a Python library MATPLOTLIB can be utilized.


Figure 1.5 Raspberry Pi 4 [24].

Figure 1.6 DHT sensor [29].

In this way, using a DHT sensor with Raspberry Pi, we can monitor the value of humidity and temperature on screen with the help of GUI. Even we can extend/update the script and instruct the rotary motor as an actuator to actuate (start fan) when certain room temperature increases. So, these are some of the modest applications of IoT in real-world environments that can be implemented using Raspberry Pi.

The Smart Cyber Ecosystem for Sustainable Development

Подняться наверх