Project Report: IoT Sensor Network Using AWS

Facebook
LinkedIn
Twitter
Email

How IoT devices can interface with AWS services

 
 

Introduction

The integration of IoT technology into all facets of life is progressing at a rapid rate, with use cases found in almost every industry and facet of life. To better understand this growing ecosystem, I created a simulated Internet of Things (IoT) sensor array using a Linux virtual machine (acting as the sensor) and a virtual server (where the sensor information is received and processed). To communicate, I used Amazon IoT and its MQTT protocol.

This project was the culmination of several smaller sub-projects, with each sub-project building the framework needed to implement the final project. The objective for this final project was to implement an actual use case of this IoT network. For this project, I created a model of a temperature monitoring network with Fahrenheit-Celsius conversion capabilities, as well as min/max/avg tracking. This project demonstrates essential IoT concepts, including sensor data simulation, cloud communication, and real-time data processing.

The Project

Two virtual IoT devices, one running in a Linux-based virtual machine, and the other on a cloud-based virtual server, communicate using the AWS IoT MQTT protocol. The first IoT device simulates a temperature sensor by generating an array of four random room temperature readings (68–77°F) when prompted. This data is then transmitted via MQTT to the second IoT device, which processes the received values by converting them to Celsius and storing them in a temperature log. Additionally, the system calculates real-time temperature statistics, including the average, minimum, and maximum values, while implementing a capped storage mechanism to optimize memory usage.

Results from the “temperature sensor” (image 1) and results from the virtual server (image 2)

Design Considerations

When designing this situation and the corresponding code, several considerations were made for the sake of practicality. Firstly, the generated data sequences were made to be of length 4. This number was chosen out of practicality’s sake for the implementation of this project; in the real world, the virtual server may receive temperature data from many sensors (thus the data points sent/received would be greater than 4 per transmission). This value can be easily changed in the device’s code to an arbitrary number.

To implement the actual temperature values, a random variable from values 68 to 77 was repeatedly generated. This simulates the range of temperatures a room may experience for a standard “room temperature” in degrees Fahrenheit (note 68-78 degrees Fahrenheit corresponds to 20-25 degrees Celsius). Note that in the real world, the sensors may pick up values outside of this range; the usage of a random variable is ultimately to simulate these temperature variations. For further simulation accuracy, an additional random variable representing sensor noise could be added, though this could be argued to be already included through the generation of the initial random value.

Additionally, in order to limit spam and avoid unintended data usage, the data values are only generated upon user request by entering ‘generate’ into the virtual machine terminal. In a real-world setting, such temperature data would likely be sent periodically at a defined rate without user intervention.

Finally, the code includes some rudimentary data storage capabilities, measuring the minimum, maximum, and average value of the received temperature values. To limit the size of the received information log, the maximum number of data points is capped to a defined value (max_entries), which is 100 for this lab. As an observation, assuming the number of stored data points is large enough, the average value of the temperature (in degrees Celsius) should converge to $μ=(b-a)/2=(25-20)/2=22.5$ degrees Celsius. This average is almost achieved in the results, with the last average being recorded at 22.36 degrees Celsius, 0.14 degrees Celsius off the expected result.

Conclusion

This project saw the implementation of a simulated IoT system under the scenario of a temperature sensor and a data-processing remote server performing unit conversion/data tracking system. While this example is simple in nature, it is easy to see the capability to scale this solution to a large sensor network able to collect large amounts of information and send them to the cloud for further data processing. For additional optimization, certain levels of edge or fog computing could also be implemented, especially for more sophisticated data types.

Facebook
LinkedIn
Twitter
Email