Serverless architecture for monitoring and controlling IOT Devices

Krishna SL
@DivumCorp
Published in
3 min readAug 13, 2018

The world has gone fully connected! The world of internet has sneaked into every device beyond the mobile and the computers!

This brought a new era of INTERNET of THINGS. A thing can be any device where it performs some digital operation and sense parameters around it. Sensors can be a temperature sensor, a pressure sensor, a light sensor, an accelerometer, a vibration sensor, a voltage or a current sensor.

Gone are the days where the data at the device need to be taken to be wired to see the data. With IOT, the data is uploaded to the cloud directly.

This also has paved us a way to monitor the device remotely and control it dynamically. But the data from sensors like vibration sensors, temperature sensors or light sensors keeps sending data at a heavy rate which the traditional REST based APIs are not suffice to handle it.

This calls for a protocol called MQTT where the data from the device is transferred over MQTT protocol and is saved in the server.

Cloud service providers like AWS and Azure have given out products like IOT Gateway(AWS) and IOTHub(Azure) to stream this to the server.

When there was a need for us to solve this for an African market to track and control the water pumps remotely, a solution to stream the data from the device to the server and do some actions out of it was required. This is where the centre of excellence team at Divum played a critical role in putting together a solution architecture to make this happen. This was a completely serverless architecture which made it highly scalable and performant.

The data from the sensors is sent over MQTT protocol to AWS IOThub. The rule set at iothub triggers and streams the data to a Lambda function.

Lambda is a serverless version of the compute instances of AWS. Lambda auto scales and when these data streams from IOTHub comes at a rapid rate, Lambda was the best choice to process these data and then decide where it has to be added.

DynamoDb, a NoSQL database was used to store the data from these devices.

The data from these devices are raw and needs to be saved instantly. Post processing of these data was required.

A DynamoDB trigger function was called to send this to another lambda function to further process these saved data into a meaningful dashboard and send an alarm when something is not right.

On the other end, mobile apps can see these data anytime. Using the sdks provided by DynamoDB, the mobile apps directly communicates with DynamoDb and get the history of the data.

AWS IOTHub SDKs on the mobile helps directly control the devices by sending in the desired values for the device to maintain.

The project wouldn’t be complete without the admin dashboards. Admin dashboards were built of ReactJS and deployed as a static hosting in S3 and used Cognito/API Gateway to access the data from DynamoDb through lambda.

Serverless architectures has a great future and this saves a lot of time in maintenance for every Devops guy.

If you are interested in talking more on creating a serverless architecture for your product, reach us at getmyproduct@divum.in

--

--