18 Jul Smart monitoring system prototype using internet of things and Amazon Web Services
Smart monitoring system prototype using internet of things and Amazon Web Services
Internet of things (IoT) is the network interconnection between objects or “things” through identifiers such as sensors, RFID (Radio-frequency Identification) labels and IP addresses (Internet Protocol). IoT has had a great growth in the recent times. It is estimated that by the year 2020, around 31 billions of IoT devices will be connected to internet. Such growth is due to the many applications and solutions that could be built in health, marketing, agriculture, smart cities, home and industry automatization.
Some activities are needed to develop the prototype.
The Wemos D1 Mini was chosen to build a quick prototype. This is a microcontroller based on the Esp8266 chip, with an integrated wifi antenna that allows an easy communication with the internet. A temperature and humidity sensor DHT22 was also used, throughout a shield easily integrated with the Wemos.
The link between physical devices and AWS is handled by AWS IoT service, which handles the communication and security of these. Also, Mongoose OS is used in order to communicate the Wemos device with AWS IoT. This platform manages the whole programming and integration with AWS.
In order to create the API (Application Programming Interface), AWS Lambda service is used, which allows handling a serverless architecture by creating independent functions. About database storage, AWS DynamoDB (a NoSQL cloud database system) performs great at storing lots of data without having to define a complex structure. Moreover, AWS Api Gateway service is deployed to ease the API management.
In order to store the data registered by the sensor properly, AWS IoT is configured along with some database rules focused on saving the data inside the Dynamo database as the information from the sensor is received. To retrieve the registered data, a Lambda function is created: this gets the values from Dynamo and expose them to the client through API Gateway.
The general architecture for the prototype is shown above:
This diagram shows how the “things” communicate with AWS IoT through a protocol called MQTT (similar to HTTP but lighter), which works under a publisher – subscriber paradigm. Whenever a sensor sends a value to AWS IoT, this updates its shadow (Entity that store the last device state) and publish it in a topic that can trigger some previously defined rules, like store the value on Dynamo, or activate a lambda function.
The web application is created using ReactJS, a framework to create dynamic interfaces, Redux, to manage the application state, Ant Design, to use beautiful components and styles, and Recharts, library what allow create dynamic charts to display data.
Internet of things is an efficient tool to optimize the measuring process, bringing great advantages to manage and analyze sensors data, saving time and money. Using cloud platforms like Amazon Web Services helps a lot to develop this kind of applications because of its many services that meet all the needs, also it allows comfortably scaling, with fair prices, not worrying about the infrastructure.