Hardware Configuration of the IoT System
Functions of Five Layers of the Architecture of IoT
- Perception Layer:It consists of sensors, edge devices, and actuators used to interact and collect information about the surrounding based on the need of the IoT system (Woungang, Dhurandher, and Visconti, 2021). The data collected includes temperature, humidity, movement, or sound.
- Transport layer:In this layer, the data from the preceding perception layer is combined and converted into a digital format that is sent to the processing layer for analysis using wireless (Zigbee, Bluetooth, Wi-Fi, etc.) and wired technologies (LAN) via a network gateway (Sethi and Sarangi, 2012)
- Processing Layer: The layer processes the data received so that appropriate action can be taken. The layer comprises special properties such as data storage, analytics, and processing so that end-users respond appropriately (Kumarand Mallick, 2018)
- Application Layer: It offers application-specific services depending on where and how the IoT system has been deployed, such as smart homes, cities, or healthcare.
- Business Layer: It takes care of the IoT ecosystem as a whole through management of all the application of the system including the business and profit models of the system (Kumarand Mallick, 2018).
The role and possible risks of the modules used in IoT
- Connectivity: The role of connectivity is to provide a medium through which the data from the sensors can be sent to a cloud infrastructure for storage and processing. It is the connection of all the IoT ecosystem devices achieved through cellular, Bluetooth, Zigbee, or RFID technology. The risks involved are that the connectivity methods are vulnerable to attacks such as spoofing and denial-of-service (DoS) attacks, thereby presenting severe threats to the security of the whole IoT system and laying a foundation for an unstable network system (Aikins,2019).
- Data Processing: the role of data processing is to act on the data from the sensors and actuators to analyze/process the data and send the desired outputs. The processing can involve checking sensor values against the set threshold or identifying objects using computer vision. The risk involved here is that the cloud-based data storage and processing are potential for data breaches and data compromise because there is usually no encryption and access controls before data is entered into the IoT ecosystem (Wheelusand Zhu, 2020). Moreover, there is the risk of inaccurate data processing, resulting in incorrect results.
- User-Interface: the role of the user interface is to provide a platform through which the end-user can see the output of the IoT system and make adjustments if necessary. For example, the user interface can be a mobile phone, a television screen, a computer, or a tablet. The risk involved here is that the user interfaces can introduce a new entrance for attackers to access and breach the IoT system. For example, a weak password in the user interface can allow a non-authorized user to access the system and change optimum settings, posing a significant threat to the entire system.
Part A: Diagram of Hardware Components.
The Hardware configuration of the IoT system is illustrated in the figure below;
Figure 1: Hardware Connection of Distance Measurement System
In the diagram above;
- The red LED is connected to the microcontroller’s pin 4.
- The blue LED is connected to the microcontroller’s pin 3.
- The green LED is connected to the microcontroller’s pin 2.
- The "Trig" pin of the ultrasonic sensor is connected to the microcontroller’s pin 9.
- The echo pin of the ultrasonic sensor is attached to the microcontroller’s pin 8.
- The ultrasonic sensor is supplied by 5V at the "VCC" terminal and grounded at the "GND" terminal.
Part B: Code and Testing
The Arduino C-code for the system above is shown below;
The testing of the code was done in proteus professional v.8. The distance was varied using a potentiometer.
- Distance less than 100cm.
It is expected that when the distance of the obstacle from the sensor is less than 100cm, the red LED should flash. The same is shown below;
Figure 2: Code Testing when distance is less than 100cm
- Distance between 100cm and 250cm
It is expected that when the distance of the obstacle from the sensor is between 100cm and 250cm, the blue LED should flash. The same is shown below;
Figure 3: Code Testing When Distance is between 100cm and 250cm
- A distance greater than 250cm
It is expected that when the distance of the obstacle from the ultrasonic sensor is more than 250cm, the green LED should flash. The same is shown below;
Figure 4: Code Testing When Distance is Greater than 250cm
Part C: Disadvantages of Ultrasonic Sensors.
- Limited Testing Distances: The distance of measurement is limited to the probe's reach. For example, the testing data is limited to the scanner's arm size when using an ultrasonic arm scanner.
- Ultrasonic sensors have the potential for inaccurate results: Ultrasonic sensors can produce erroneous results if the test object has an odd formation such that waves cannot penetrate the material composition of the test object, and if the item is inaccessible to the measuring probe (Kaur and Singh, 2021).
- Inflexibility:Usually, ultrasonic sensors are fixed with rigid probes, which cause the inability to control wave emission during measurements leading to the production of a limited scale of an object's structural profile. Additionally, the rigid nature of ultrasonic testing can cause it to overlook minor flaws in the test object.
Question 1 Part A: Description of MQTT main terms
- Broker: It is an intermediary server that allows the MQTT clients to communicate effectively by receiving the messages published by the client, filtering the messages by topic, and distributing them to subscribers.
- Client: Any device in the MQTT configuration links to the broker over a network and runs the MQTT library.
- Topic: it is a UTF-8 string that the broker utilizes to filter each of the linked client's information.
- Publish: A publisher is a client which sends information to subscribers via the topic. Thus, to publish is to update information associated with a topic on the broker.
- Subscribe: A subscriber is a client who receives the published message via the topic.
- QoS: The quality of service defines the reliability of the messages passed between the publisher and the subscriber.
Part B: Working of MQTT
Messaging Queuing Telemetry Transport (MQTT) is a publish/subscribe messaging protocol that functions above the TCP/IP protocol. It offers resource-constrained network clients an easy way to share telemetry via a server referred to as the broker (Bernstein, Brush, and Gillis, 2021). The publisher requires no information about the number or position of the subscribers in the network. Similarly, the subscribers do not require any information about the publisher. The broker serves as a link between the subscriber and the publisher.
When the publisher intends to pass data, it publishes to a specific topic. After that, the broker transmits the data to the subscribers that have subscribed to that particular topic (Spofford, 2019). The publisher sends the quality of service level together with the message. The quality of service level provides the guarantee of the delivery of the message. If the connection between the subscriber and the broker is broken, the broker server buffers the messages and delivers them when the connection is restored. Conversely, if the link between the publisher and the broker is terminated without no notice, the broker closes the connection and sends a cached message to the subscriber. The message sent contains the directives from the publisher (Bernstein, Brush, and Gillis, 2021).
The figure below shows a schematic of the MQTT protocol used in temperature sensors in an IoT application.
Figure 5: Application of MQTT in IoT (Bernstein, Brush, and Gillis, 2021)
In the figure above, the publisher is the temperature sensor, while the subscribers are the mobile device and the backend system server. The temperature sensor publishes the temperature reading on the topic temperature. At the same time, the mobile device and the backend system server subscribe to the topic temperature hence receiving the temperature reading via the broker server.
Coding the Distance Measurement System with Arduino C-Code
Example codes for working of MQTT in Arduino to facilitate communication via ethernet for temperature, humidity, and gas level sensors are shown below.
Publisher code
Subscriber Code
Running the above code would provide an output as shown below;
In the case of the code presented above, the real_unique_topic would be temperature, real_unique_topic_2 would be humidity, and real_unique_topic_3 would be gas level.
Part C: Most Important Challenges in Using MQTT protocol for IoE
- Scalability: developing a globally scalable network is more complex using the MQTT protocol than competing protocols.
- Lack of Security encryption: the protocol is primarily unencrypted despite using a secure sockets layer and transport layer security. As a result, the protocol is vulnerable to data breaches (Silveiraand Gradvohl, 2021).
- Slower transmit cycles: the protocol has lower transmit cycles than the constrained application protocol (CoAP), making it a less reliable connection involving greater than 250 devices.
Part D: Why MQTT is the preferred protocol in IoT
- It offers efficient communication through low data and low energy utilization, making it suitable for real-time, text-based messaging applications for connected devices.
- The MQTT protocol provides the ease of implementing remote sensing and control for IoT devices.
- MQTT utilizes lower data packets leading to reduced network usage in IoT applications.
- The protocol is secure. For instance, in a home security system, the quality of service feature in MQTT can assess whether crucial messages have been delivered successfully, ensuring a proper alert for danger.
Part A: Wireless Technologies in Internet of Everything
BluetoothBluetooth is a high-speed, low-power wireless technology used to exchange data between electronic devices over short distances. The IEEE standard for Bluetooth technology is IEEE 802.15.1. It uses the UHF radio waves from 2.402 GHz to 2.480GHz. Bluetooth piconets use the master/slave configuration to regulate the transmission and reception of data. A single "master" is linked with up to seven "slaves in the configuration." The purpose of the master in the design is to coordinate the communication throughout the piconet by sending or requesting data from any slave in the piconet (Agarwal, 2017). On the other hand, the slaves only transmit to and receive data from the master but cannot communicate with each other.
Creating a communication link between Bluetooth devices involves three progressive states. The first state is known as the inquiry state. In this stage, the master sends an inquiry request to all the other components within its access point range. The devices that receive the inquiry reply with their address. The second stage is known as paging. Paging involves the creation of a connection between the devices. The link is only created for devices that know the address of each other, as was found in the inquiry state. The third and final state is the connection state. While in this state, the Bluetooth devices can either actively participate in the communication or be put into a low-power sleep mode (Karacheva, 2021).
Over the recent years, Bluetooth has become a household name in the IoT because of its no-internet function and the ability to create large-scale device networks via the Bluetooth mesh. The pros of using Bluetooth include low power consumption, zero interference from nearby wireless devices, better communication distance than infrared communication, and low cost (Mohamed, 2021). On the other hand, the disadvantages of using Bluetooth devices include slow data speeds, poor data security, and short battery life in Bluetooth modules.
Bluetooth Low Energy (BLE)
It uses the same technology as regular Bluetooth but utilizes much less power (Mackey and Spachos, 2018). Consequently, it is slower compared to the standard Bluetooth and is not suitable for file transfers involving large files. The technology has gained popularity in small IoT devices such as sensors and tags that require communication without too much power consumption.
BLE operates on the same 2.4GHz radio waveband as the regular Bluetooth. Contrary to the standard Bluetooth, BLE uses the 40 2-MHz channels to transmit information by applying the Gaussian frequency shift modulation, which produces fewer interference issues than the standard Bluetooth (Jeon, She, Soonsawad, and Chet, 2018). Additionally, BLE utilizes the direct sequence spread spectrum to reduce interference from the signal transmission. This is different from the regular Bluetooth, which uses the frequency-hopping spread spectrum (FHSS); a technology that suffers significant interference.
Messaging Queuing Telemetry Transport (MQTT) Protocol in IoT Applications
BLE device discovery involves broadcasting the advertising packets over three different frequencies. This aids in limiting interference. The devices transmit a repetitive packet of data over any of the three channels at specific advertising intervals. The transmitted packets are discovered by other devices that intend to connect to the BLE transmitter. The devices that want to connect scan for BLE signals by opening a scan window and scan-interval to identify signals for communication. When a signal is discovered and paired, a connection is said to have been established (Medel and Brito, 2021).
Part B: The Working of I2C and SPI Protocol.
SPI ProtocolSPI is commonly used in SD card reader modules, 2.4GHz wireless transmitter/receiver modules, and RFID card reader modules. The devices use the SPI protocol to communicate with the microcontroller. SPI protocol used a configuration in the form of a master and a slave relationship. The microcontroller which acts as the master provides instructions to the slave. A slave can be a sensor, a microchip, or a sensor.
Figure 7: SPI Communication Protocol Configuration (Campbell, 2021)
The MOSI is the abbreviation of “master output/slave input.” It a channel used by the system’s master to transmit information to the system’s slave.
The MISO is the abbreviation of “master input/slave output.” It is a channel used by system’s slave to deliver information to the system’s master.
The SCLK is the channel for the clock signal.
The SS/CS is the abbreviation of “slave select/chip select.” It is the channel that the system’s master device utilizes to choose the slave to send information to in a case where multiple slaves are involved.
The master triggers SPI communication through configuration and generation of the clock signal which syncs the output bits of information from the system’s master to the sampling bits of the system’s slave. The master selects the slave it intends to pass information to by turning the slave's CS/SS channel to a low voltage level (Campbell, 2021). After that, the master transmits the data bit by bit to the system’s slave together with the MOSI channel, which reads the bits as they have come. If a reply is required, the slave transmits it bit by bit to the master together with the MISO channel, which reads the bits as they come.
I2C protocol
The protocol entails the combination of the best properties of the SPI and UARTs. The connection can be between numerous slaves and one master or between numerous masters with a single or multiple slave. Unlike the SPI protocol, the I2C protocol uses two wires for communication between devices (Subero, 2017). The I2C configuration is shown below;
Figure 8: I2C communication Protocol Configuration (Campbell, 2021)
SDA or the Serial Data is the line through which the system’s master and the system’s slave transmit and receive information. The SCL (Serial Clock) line is used for the clock signal.
In this communication method, data is passed as messages that are broken down into frames of data. The message comprises the binary address of the system’s slave and the frames that possess the information under transit. Additionally, the message contains the start and stop conditions, the read/write bits, and the acknowledge (ACK)/not-acknowledge (NACK) bits.
Bluetooth Communication Protocol in IoT Devices
During I2C communication, the systems master transmits the start condition to all the slave devices in the system. This is done by switching the SDA from high to low prior to switching the SCL channel from high to low. After that, the master transmits to every slave the 7- or 10-bit address of the specific slave it requires pass information to, along with the read/write bit. The slaves cross-check the address received against their addresses. If the addresses are the same, the slave returns the acknowledgment bit by pulling the SDA channel low for a single bit. However, when the addresses don't match, the slave does not interfere with the state of the SDA. The master transmits or receives the data frame, after which the receiving device returns another acknowledgment bit to confirm that it has successfully received the frame. The end of the communication is marked by the master sending a stop condition to the slave device by switching SCL to a high status before switching the SDA to a high position (Campbell, 2021).
Part C: Advantages and Disadvantages of I2C and SPI protocol
The pros of the I2C protocol are;
- It is flexible. The I2C protocol provides the flexibility to choose between transmission rates based on the requirements.
- The protocol helps in error handling by providing acknowledgment (ACK) and not-acknowledgment (NACK) features.
- The I2C protocol can handle multiple masters and slaves on the same I2C bus.
The cons of the I2C protocol are;
- The I2C protocol comprises the open-drain topology, consuming more power than other serial communication busses.
- It is only suitable for short distances.
The advantages of the SPI protocol are;
- It offers a high data transfer rate than the I2C protocol.
- Data can be sent and received simultaneously because of the distinct MISO and MOSI lines (Gadreand Gupta, 2017).
The disadvantages of the SPI protocol are;
- It can only allow for one master.
- Complex wiring in case of multiple slaves involved in communication.
References
Aikins, S. K. 2019. Managing risks of networks in the IoT environment. Security, Privacy, and Trust in the IoT Environment, 3-23. doi:10.1007/978-3-030-18075-1_1
Agarwal, T. 2017. Bluetooth technology construction, working, and its application. Retrieved from https://www.efxkits.co.uk/how-bluetooth-technology-works/
Bernstein, C., Brush, K., and Gillis, A. S. 2021. What is MQTT, and how does it work? Retrieved from https://internetofthingsagenda.techtarget.com/definition/MQTT-MQ-Telemetry-Transport
Campbell, S. 2017. Basics of the I2C communication protocol. Retrieved from https://www.circuitbasics.com/basics-of-the-i2c-communication-protocol/
Campbell, S. 2021. Basics of the SPI communication protocol. Retrieved from https://www.circuitbasics.com/basics-of-the-spi-communication-protocol
Gadre, D. V., and Gupta, S. 2017. Serial communication: SPI and I2C. Getting Started with Tiva ARM Cortex M4 Microcontrollers, 211-238. doi:10.1007/978-81-322-3766-2_15
Jeon, K. E., She, J., Soonsawad, P., and Chet, P. N. 2018. BLE beacons for Internet of things applications: Survey, challenges, and opportunities. IEEE Internet of Things Journal, 5(2), 811-828. doi:10.1109/jiot.2017.2788449
Karacheva, E. 2021. Bluetooth - How it works. Retrieved from https://ccm.net/contents/69-bluetooth-how-it-works
Kaur, M., and Singh, M. 2021. Internet of things: Challenges and research opportunities. Wireless Sensor Networks and the Internet of Things, 343-350. doi:10.1201/9781003131229-24
Kumar, N. M., and Mallick, P. K. 2018. The Internet of things: Insights into the building blocks, component interactions, and architecture layers. Procedia Computer Science, 132, 109-117. doi:10.1016/j.procs.2018.05.170
Mackey, A., & Spachos, P. (2018). Energy consumption and proximity accuracy of BLE beacons for Internet of things applications. 2018 Global Information Infrastructure and Networking Symposium (GIIS). doi:10.1109/giis.2018.8635746
Medel, A., and Brito, J. 2021. A comparison among Wi-Fi direct, classic Bluetooth, and Bluetooth low energy discovery procedures for enabling massive machine-type communications. Proceedings of the 6th International Conference on Internet of Things, Big Data and Security. doi:10.5220/0010399001640169
Mohamed, K. S. 2021. An introduction to Bluetooth. Bluetooth 5.0 Modem Design for IoT Devices, 1-32. doi:10.1007/978-3-030-88626-4_1
Sethi, P., and Sarangi, S. R. 2017. Internet of things: Architectures, protocols, and applications. Journal of Electrical and Computer Engineering, 2017. Retrieved from https://doi.org/10.1155/2017/9324035
Silveira, M. F., and Gradvohl, A. L. 2021. Security analysis of the message queuing telemetry transport protocol. Revista Brasileira de Computação Aplicada, 13(2), 83-95. doi:10.5335/rbca.v13i2.12163
Spofford, D. 2019. What is MQTT in IoT? Retrieved from https://www.verypossible.com/insights/what-is-mqtt-in-iot
Subero, A. 2017. USART, SPI, and I2C: Serial communication protocols. Programming PIC Microcontrollers with XC8, 209-276. doi:10.1007/978-1-4842-3273-6_9
Wheelus, C., and Zhu, X. 2020. IoT network security: Threats, risks, and a data-driven defense framework. IoT, 1(2), 259-285. doi:10.3390/iot1020016
Woungang, I., Dhurandher, S. K., and Visconti, A. 2021. Internet of things design, architectures, and protocols. Internet of Things, 14, 100267. doi:10.1016/j.iot.2020.100267
To export a reference to this article please select a referencing stye below:
My Assignment Help. (2022). Hardware Configuration And Implementation Of IoT System With MQTT And Bluetooth Communication Protocol, An Essay.. Retrieved from https://myassignmenthelp.com/free-samples/qac020x355a-designing-and-developing-products-for-the-internet-of-everything/iot-communication-layers-file-A1DB68C.html.
"Hardware Configuration And Implementation Of IoT System With MQTT And Bluetooth Communication Protocol, An Essay.." My Assignment Help, 2022, https://myassignmenthelp.com/free-samples/qac020x355a-designing-and-developing-products-for-the-internet-of-everything/iot-communication-layers-file-A1DB68C.html.
My Assignment Help (2022) Hardware Configuration And Implementation Of IoT System With MQTT And Bluetooth Communication Protocol, An Essay. [Online]. Available from: https://myassignmenthelp.com/free-samples/qac020x355a-designing-and-developing-products-for-the-internet-of-everything/iot-communication-layers-file-A1DB68C.html
[Accessed 21 November 2024].
My Assignment Help. 'Hardware Configuration And Implementation Of IoT System With MQTT And Bluetooth Communication Protocol, An Essay.' (My Assignment Help, 2022) <https://myassignmenthelp.com/free-samples/qac020x355a-designing-and-developing-products-for-the-internet-of-everything/iot-communication-layers-file-A1DB68C.html> accessed 21 November 2024.
My Assignment Help. Hardware Configuration And Implementation Of IoT System With MQTT And Bluetooth Communication Protocol, An Essay. [Internet]. My Assignment Help. 2022 [cited 21 November 2024]. Available from: https://myassignmenthelp.com/free-samples/qac020x355a-designing-and-developing-products-for-the-internet-of-everything/iot-communication-layers-file-A1DB68C.html.