You are on page 1of 5

Data and Network Communication Name Lee Khee Mahendra

NIM 22 02 0104
Lab
Title IoT Practice No. 11

Introduction
In the ever-expanding landscape of technology, the Internet of Things (IoT) has emerged as a
transformative force, connecting devices and enabling data exchange like never before. One of the notable
players in this realm is the Node MCU, a compact and powerful platform that facilitates IoT
development. Additionally, Arduino's Network Shield and PLC's Network Port add further dimensions to
networking capabilities in different domains.
Unveiling the Power of IoT: Internet of Things (IoT)
The Internet of Things (IoT) refers to a network of interconnected
devices and objects that can communicate, collect data, and share
information over the internet. This paradigm shift has paved the way for
smarter homes, cities, industries, and more. IoT allows devices to gathe r
and exchange data, enabling automation, remote control, and data-driven
decision-making.
Node MCU: Empowering IoT Innovation
Node MCU is a compact development board that combines an ESP8266 Wi-Fi module with an
integrated microcontroller. This versatile platform simplifies IoT development by providing built-in Wi-
Fi connectivity and programmability. Developers can leverage Node MCU to create IoT devices that
gather data from sensors, communicate over Wi-Fi, and interact with the internet to provide real-time
insights and control.

Arduino Network Shield: Extending Arduino's Networking Capabilities


Arduino, known for its open-source hardware and software, offers a Network Shield that expands
the networking capabilities of Arduino boards. This shield provides Ethernet connectivity, enabling
Arduino devices to connect to local networks and the internet. It facilitates data exchange, remote control,
and integration with online services, making it a valuable tool for projects that require network
communication.
PLC Network Port: Enabling Communication in Industrial Settings
In industrial environments, Programmable Logic Controllers (PLCs) play a pivotal role in
automation. A PLC's Network Port serves as a communication interface, allowing PLCs to connect to
larger network infrastructures. This enables PLCs to exchange data with other devices, control systems,
and central servers. The Network Port ensures seamless integration of industrial processes, contributing to
efficient operations and data-driven decision-making.
Tools and Material
1. Node MCU
2. Virtual Box
3. Node MCU
4. Laptop

Work Steps

1. Code the nodeMCU/PLC to send the data to MYSQL


2. Test the nodeMCU can send the sensor data to MYSQL

Experiment Result

I don’t have a NodeMCU so I used my phone to communicate and input the data that could’ve
been inputted by a NodeMCU. I’m using an app called “TCP Client”, by using my computer’s IP and the
configured amounts of ports that is set, my phone can communicate or insert an input to the node red in
my laptop. In this practice, we have to insert the data to mysql. In order to do that I used Node Red as the
connector between my phone and mysql. Here’s the configurations that I’ve made to make the connection
happen.
Description of the Function node:

1. Extracting Data from a Message: This code takes a message (msg.payload) that contains a
string like "IN: 3, OUT: 0, AVAIL: 1." It then looks for specific numbers after "IN," "OUT,"
and "AVAIL" and saves these numbers as variables.
2. Creating a New Message: It creates a new message (msg) with the extracted numbers. So,
instead of the original string, the new message contains something like { inn: 3, out: 0, avail:
1 }.
3. Getting the Current Date and Time: It figures out the current date and time, in a format
suitable for MySQL databases. For example, it might create a string like "2023-09-15
15:30:00."
4. Building an SQL Query: It constructs a query in the SQL language that's used to insert data
into a database table. This query is designed to insert the current date and time along with the
extracted numbers into a table called "parkir."
5. Assigning the Query to the Message: It attaches the SQL query to the message, specifically in
msg.topic. This is done so that the query can be used by another part of the program to
interact with a database.
6. Returning the Message: The modified message (now containing the extracted data and the
SQL query) is sent forward for further processing, often to a component that interacts with a
database to actually perform the data insertion.

Reflection
Engaging in this practice turned out to be less challenging than initially anticipated. The key lies
in our attention to detail during each step of the process. During my initial attempt to establish a
connection with the switch, I encountered a setback, but with a more meticulous approach, I eventually
achieved success. It became evident that the issue stemmed from a cable that hadn't been securely latched
into place. This experience taught me an invaluable lesson: in the face of numerous trials and tribulations,
it is essential to maintain resilience and continue forward, even when obstacles seem relentless. This
steadfast commitment to pushing through adversity truly defines our determination and perseverance.

Conclusion
As technology evolves, connectivity becomes a key factor in driving innovation and efficiency.
From the IoT's transformative capabilities to Node MCU's simplicity in IoT development, and Arduino's
Network Shield expanding networking horizons to PLC's Network Port enabling industrial
communication, the power of connectivity is evident. These tools empower individuals and industries to
create interconnected ecosystems that enhance our daily lives and optimize processes. In a world where
devices and systems interact seamlessly, the potential for innovation knows no bounds.

You might also like