Enable your Legacy device to Modern IoT Cloud through TCP Connection

The usage of IoT devices is increasing in many verticals, and at the same time, it is entering newer verticals at a good pace too. In the last few years, the number of IoT devices has been multiplied by manifolds.

Organizations of all kinds are looking for opportunities to use IoT in their business processes. After all, it could improve their operations, automate tasks better, increase revenue and get faster access to real-time data.

But there is a problem!

Most of the enterprises are using legacy systems, old networks for communication, and outdated devices.

Considering the modern standards of security and networking, such aids cannot be used directly with the IoT infrastructure. Also, you cannot suddenly replace all your devices and migrate all existing data for the sake of digitizing the business as per the most recent technology standards. Even if (though very impractical) you did so, you will have to repeat it very frequently.

The Solution – Data Ingestion and Modern IoT Cloud

There is a lot of data and operations that rely on your legacy systems, so enterprises can set up data ingestion tools, such as Edgeline.

Or, just like Automation that used IoT cloud & OneEdge to fix the HTTP disconnection problem for its legacy devices and people on the field, you may do the same.

Data ingestion provides organizations with a medium/framework to upload, import, gather, process, send and integrate their data, spread across multiple devices/systems. They are capable of working with (and fetch data through) a rich range of legacy protocols & interconnects. With these tools, you can ingest a wide variety of industrial data.

Once ingested and kept in the modern IoT cloud, your enterprise data can be handled without hassles. You will be able to use it with IoT devices (e.g., sensors), modern streaming platforms (e.g., Kafka), and protocols (e.g., TCP/IP).

In short, your legacy system architecture’s data will be extended using a pipeline and cloud storage in order to make your business’s communication with the rest of world smoothly.

Modern IoT Cloud, such as AWS IoT Core can be used for this purpose. You may also use IoT platforms that let modern and legacy protocol sensors connect securely.

How Modern IoT Cloud improves security?

Your enterprise may have hundreds of legacy systems, sending data to your Ingestion tool. Now, for modern networks, this ingestion tool acts as a gateway. Those networks don’t consider that the data is coming from diverse sources but one source.

An ingestion tool can be integrated with or feed the data to a modern & secured system for further usage. As an IoT Cloud is secure and has a good potential to handle multiple interactions, it naturally becomes a good choice for legacy devices.

This architecture lets a good range of devices and cloud services use the fetched data with modern protocols for efficient and faster communication.

If you are looking for a very flexible and cost-effective system IoT architecture, Microsoft Azure will be a good choice.

Why TCP Connection for modern IoT Cloud & Legacy Devices?

As the device-to-cloud communication happens over the transport layer, enterprises might either use TCP or UDP.

TCP is indeed a better choice here because the protocol allows connection-oriented transmission of data. It implies that each successfully-sent data packet will be acknowledged. This will prevent your packets from getting lost.

While you may think that the overhead of using the Transmission Control Protocol (TCP) is very high for IoT applications in this case, but for legacy systems, streaming the data through reliable mediums is always preferred.

At the application layer, HTTP will be our pick between the 2 protocol bridges (TCP Bridge and MQTT Bridge) the modern IoT clouds generally utilize. The MQTT Bridge requires device connection while HTTP works using a connectionless communication method (request/response). Besides that, an HTTP Bridge utilizes a half-duplex TCP connection and is light-weighted.

The Process to Enable Legacy Device to Modern IoT Cloud through TCP

There is AWS IoT and a few other modern clouds that you might choose for your enterprise.

To enable your legacy device to modern IoT cloud, you will have to do 2 things:

  1. Data Inquisition (as explained above)

As we know the legacy systems and devices might have incompatibility as a security issue, an enterprise must use a gateway, edge server, or data inquisition tool to gather and process the device data. The fetched data can be further used with the IoT Cloud.

  1. Connecting your Data Inquisition Gateway to the IoT Cloud

There are multiple libraries (C, Python, JavaScript, etc.) to choose from, as provided by the IoT Device SDK of your chosen IoT Cloud service. We will be using the JSON format.

Now that we have to explain the steps, let’s consider AWS as your IoT Cloud service provider here. For other IoT clouds, the process will vary a bit. Here are the steps to connect legacy devices to IoT Cloud over TCP:

Get the AWS CLI installed. Keep the default location as ‘us-east-1’. Create a user and its credentials and configure it properly. After receiving the Access ID and Key, use this command:

AWS configure

To get permission to download the IoT tools, you will need certifications. For that, follow these steps:

  • Create a folder in order to keep your certifications using the ‘mkdir’ command.
  • Now, enter this folder using the command ‘cd’ and generate a private key using these lines:

openssl genrsa -out privateKey.pem 2048

openssl req -new -key privateKey.pem -out cert.csr

  • Go to the certOutput.txt file and check the value of Certificate ID. Copy the ID from here.
  • Thereafter, run these lines (replace cert_ID with the copied text here):

aws iot –endpoint-url https://i.us-east-1.pb.iot.amazonaws.com describe-certificate –certificate-id <cert_ ID> –output text –query certificateDescription.certificatePem > cert.pem

  • Create a policy document using the ‘vi policy.doc’ command and insert this text:

“Version”: “2021-02-21”,

“Statement”: [{

“Effect”: “Allow”,

“Action”:[“iot:*”],

“Resource”: [“*”]

}]

}

Save and quit the document by using the ‘:wq’ command.

  • Run this command:

aws iot –endpoint-url https://i.us-east-1.pb.iot.amazonaws.com create-policy –policy-name PubSubToAnyTopic –policy-document file://policy.doc

  • Go to the outputCert.txt and copy the value of certificateArn field. Use the below command while replacing this value in <pri_arn> field:

aws iot –endpoint-url https://i.us-east-1.pb.iot.amazonaws.com attach-principal-policy –principal-arn <pri_arn> –policy-name “PubSubToAnyTopic”

  • Install the needed SDK for the IoT Cloud on the client or your legacy device data/inquisition tool.
  • Finally, to create the device-side application, you will have to:
  1. Add a module to the client code in the IoT Cloud.
  2. Instantiate this code using the private key & certification you created in the initial steps.
  3. Start a connection. Use TCP to publish it to the IoT cloud and for subscribing.
  4. Determine a callback mechanism to fetch back the data.
  5. Define the messages as needed by your application.

The Final Word

While you might need to enable your legacy device with the Modern IoT Cloud using the TCP connection, there are possibilities that you will hesitate or get stuck when following the procedure because it is not very straight-forward. If you are unsure about handling secure IoT enablement process for your enterprise, hire experts from Stridely Solutions to do it fast, securely and smoothly.

Request a Consultation

Our Resources

Explore our hub of resources across different industries for real-life