Building an Object Counter with AWS IoT Greengrass and CloudRail
Introducing AWS IoT Greengrass on the CloudRail.Box
With the latest version of CloudRail (v1.6), we brought AWS IoT Greengrass on the CloudRail.Box. This article covers Edge Computing in general, AWS IoT Greengrass and how easy it works using the CloudRail.Box as an Edge Gateway. We’ll connect an IO-Link laser distance sensor to AWS IoT Greengrass to realize a simple object detection which reports calculated sums to AWS IoT Core.
What is Edge Computing?
Edge computing is a particularly promising approach to modern smart industrial solutions. On one hand, edge computing makes the devices smarter and provides richer insights, while on the other, the user can still use the cloud for device management and analytics. By striking a good balance between computing locally and using the power of cloud connectivity, a lot more can be achieved using the same set of devices. No wonder, more and more industries are trying to adopt edge computing technology in their factories.
Getting started with an edge computing solution usually requires three main things:
- Getting the sensor data into the system
- Deploying and applying computational logic to the generated data
- Ability to manage the devices from the cloud
How should Edge Computing be like?
While the above three challenges might seem overwhelming at first sight, it is not so with the advent of Industry 4.0 technologies. All of the above can be achieved in a matter of a few minutes using the CloudRail.Box. This is, in part, possible because the Box comes preloaded with AWS IoT Greengrass.
In the video below, we walk you through the exact steps involved in connecting a distance sensor to AWS and using it as a smart counter that counts the production output using the Cloudrail.Box. All of that, within a matter of minutes.
Enabling AWS IoT Greengrass on your CloudRail.Box
Our first step involves enabling the CloudRail.Box for interacting with AWS IoT Greengrass in the CloudRail Device Management Cloud. This is a one time action that makes the CloudRail.Box ready for working with a Greengrass Group.
This is followed by configuring the IO-Link photoelectric distance sensor to transmit data to the AWS Greengrass Group using CloudRail’s Device Management Dashboard.
Once this is done, we go to the AWS Management Console for creating, configuring and deploying edge computing logic to the CloudRail.Box.
We create a lambda function on AWS that contains the Greengrass SDK to make it Greengrass compatible.
Here is the code:
This lambda function contains the logic of the counter. Once our lambda function is created and published, we add it to the Greengrass Group.
On the Greengrass Group, we configure it as a long-lived function. This allows it to perform the counting when data starts arriving from the sensor.
We then create subscription rules in order to trigger the lambda function whenever some data arrives. We also add a subscription from the lambda function to the AWS IoT Core so that we can get our computed sum to the cloud.
Finally, we deploy all our changes to the CloudRail.Box.
This completes our setup for using the IO-Link photoelectric distance sensor as a counter. We can continue to make changes and deploy them to the Cloudrail.Box via the AWS IoT Greengrass dashboard. Our entire setup can be managed remotely.
In this tutorial, we connected an industrial IO-Link laser distance sensor to AWS IoT Greengrass which runs on the CloudRail.Box to provide a very simple object counter. Using CloudRail made the entire process extremely simple and fast, while still leveraging the power of AWS IoT Greengrass. This is just a very simple example of Greengrass in combination with the CloudRail.Box and a sensor. CloudRail works with over 12.000 industrial sensors covering use cases like vibration, distance, temperature, pressure, identification and so much more. Get started today with a CloudRail Starter-Kit or learn more about the CloudRail.Box.