Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / IoT

IoT Reference Implementation: Making of an Environment Monitor Solution

5.00/5 (2 votes)
27 Mar 2017CPOL11 min read 13K  
This IoT reference implementation builds on the existing Intel® IoT air quality sensor code samples to create a more comprehensive Environment-Monitor solution.

This article is for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers

Get access to the new Intel® IoT Developer Kit, a complete hardware and software solution that allows developers to create exciting new solutions with the Intel® Galileo and Intel® Edison boards. Visit the Intel® Developer Zone for IoT.

To demonstrate the value of Internet of Things (IoT) code samples provided on Intel‘s Developer Zone as the basis for more complex solutions, this project extends previous work on air quality sensors. This IoT reference implementation builds on the existing Intel® IoT air quality sensor code samples to create a more comprehensive Environment-Monitor solution. Developed using Intel® System Studio IoT Edition and an Intel® Next Unit of Computing (Intel® NUC) as a gateway connected to sensors using Arduino* technology, the solution is based on Ubuntu*. Data is transferred to the cloud using Amazon Web Services (AWS)*.

Visit GitHub for this project’s latest code samples and documentation.

IoT promises to deliver data from previously obscure sources, as the basis for intelligence that can deliver business value and human insight, ultimately improving the quality of human life. Air quality is an excellent example of vital information that is all around us but often unseen, with importance that ranges from our near-term comfort to the ultimate well-being of our species, in terms of pollution and its long-term effects on our climate and environment.

In the context that IT infrastructure has historically been seen as having a negative environmental footprint, IoT can therefore be seen potentially as a vital inflection point. That is, as we strive for greater understanding of the world and our impact on it, technology is being developed to give us information that can drive wise decisions.

For example, IoT sensors gather data about levels of carbon dioxide, methane, and other greenhouse gases, toxins such as carbon monoxide, hexane, and benzene, as well as particulate irritants that include dust and smoke. They can also be used to capture granular information about the effects of these contaminants over vast or confined areas, based on readings such as temperature, light levels, and barometric pressure.

Building on a Previous Air-Quality Sensor Application

Part of the Intel® Developer Zone value proposition for IoT comes from the establishment of seed projects that provide points of entry into a large number of IoT solution domains. These are intended both as instructive recipes that interested developers can recreate and as points of departure for novel solutions.

The Existing Air Quality Sensor Application

The Environment Monitor described in this development narrative is an adaptation of a previous project—a more modest in scope air-quality sensor implementation. The previous air-quality sensor solution was built as part of a series of how-to Intel® IoT code sample exercises using the Intel® IoT Developer Kit.

Further information on that application can be found in the GitHub repository: https://github.com/intel-iot-devkit/how-to-code-samples/blob/master/air-quality-sensor/javascript/README.md

Its core functionality of the application is centered on a single air-quality sensor and includes the following:

  • Continuously checking air quality for airborne contaminants, based on whether any of several gases exceeds a defined threshold.
  • Alerting with an audible alarm whenever an alert is generated based on one of the threshold values being exceeded, which indicates unhealthy air.
  • Storing alert history in the cloud, tracking and providing an historical record of each time an alert is generated by the application.

The application code is built as a Node.js* project using JavaScript*, with MRAA (I/O library) and UPM (sensor library) from the Intel® IoT Developer Kit. This software interfaces with the following hardware components:

  • Intel® NUC
  • Arduino 101*
  • Grove* Starter Kit

Note: Here, we use an Intel® NUC but click here for other compatible gateways.

You can also use the Grove* IoT Commercial Developer Kit for this solution. The IDE used in creating the application is the Intel® System Studio IoT Edition.

The air-quality sensor application provides a foundation for the Environment Monitor.

Adapting the Existing Project to Create a New Solution

This document shows how such projects such as the previous air-quality sensor can readily be modified and expanded. In turn, the new Environment Monitor solution, shown in Figure 1, extends the IoT capability by adding additional sensors and provides the user flexibility in the choice of operating system (i.e., you can use Intel® IoT Gateway Software Suite or Ubuntu* Server).

Image 1

Image 2

Figure 1. Enhanced Environmental Monitor Solution

Image 3

Figure 2. Sensor Icons

Table 1. Sensor Icon Legend

Image 4Image 5Image 6Image 7
DustGasTemperatureHumidity

The relatively simple scope of the existing air-quality sensor application allows significant opportunity for expanding on its capabilities.

The team elected to add a number of new sensors to expand on the existing solution’s functionality. The Environment Monitor solution includes new sensors for dust, temperature, and humidity.

In addition to the changes made as part of this project initiative, interested parties could make changes to other parts of the solution as needed. These could include, for example, adding or removing sensors or actuators, switching to a different integrated development environment (IDE), programming language, or OS, or adding entirely new software components or applications to create novel functionality.

Hardware Components of the Environment Monitor Solution

  • Intel® NUC
  • Arduino 101*
  • Grove* sensors

Based on the Intel® Atom™ processor E3815, the Intel® NUC offers a fanless thermal solution, 4 GB of onboard flash storage (and SATA connectivity for additional storage), as well as a wide range of I/O ports. The Intel® NUC is conceived as a highly compact and customizable device that provides capabilities at the scale of a desktop PC. It provides the following key benefits:

  • Robust compute resources to ensure smooth performance without bogging down during operation.
  • Ready commercial availability to help ensure that the project could proceed on schedule.
  • Pre-validation for the OS used by the solution (Ubuntu).

The Arduino 101* board makes the Intel® NUC both hardware and pin compatible with Arduino shields, in keeping with the open-source ideals of the project team. While Bluetooth* is not used in the current iteration of the solution, the hardware does have that functionality, which the team is considering for future use.

The Intel® NUC and Arduino 101 board are pictured in Figure 3, and the specifications of each are given in Table 2.

Image 8

Figure 3. Intel® NUC Kit DE3815TYKHE and Arduino* 101 board.

Table 2. Prototype hardware used in the Environment Monitor solution

 Intel® NUC Kit DE3815TYKHEArduino 101 Board
Processor/MicrocontrollerIntel® Atom™ processor E3815 (512K Cache, 1.46 GHz)Intel® Curie™ Compute Module @ 32 MHz
Memory8 GB DDR3L-1066 SODIMM (max)
  • 196 KB flash memory
  • 24 KB SRAM
Networking / IOIntegrated 10/100/1000 LAN
  • 14 Digital I/O pins
  • 6 Analog IO pins
Dimensions190 mm x 116 mm x 40 mm68.6 mm x 53.4 mm
Full Specsspecsspecs

For the sensors and other components needed in the creation of the prototype, the team chose the Grove* Starter Kit for Arduino*(manufactured by Seeed Studio*), which is based on the Grove* Starter Kit Plus used in the Grove* IoT Commercial Developer Kit. This collection of components is available at low cost, and because it is a pre-selected set of parts, it reduces the effort required to identify and procure the bill of materials. The list of components, their functions, and connectivity are given in Table 3.

Table 3. Bill of Materials

 ComponentDetailsPin ConnectionConnection Type
Base SystemIntel® NUC Kit DE3815TYKHEGateway  
 Arduino* 101 boardSensor hub USB
 Grove* - Base ShieldArduino 101 Shield Shield
 USB Type A to Type B CableConnect Arduino 101 board to Intel® NUC  
SensorsGrove - Green LEDLED indicates status of the monitorD2Digital
 Grove - Gas Sensor(MQ2)Gas sensor (CO, methane, smoke, etc.)A1Analog
 Grove - Dust SensorParticulate matter sensorD4Digital
 Grove - Temp&Humi&Barometer Sensor (BME280)Temperature, humidity, barometer sensorBus 0I2C

Using that bill of materials and connectivity schema, the team assembled the bench model of the Environment monitor, as illustrated in the figures below.

Image 9

Figure 4. Intel® NUC, Arduino* 101 board, and sensor components.

Image 10

Figure 5. Pin Connections to the Arduino* 101 Board

Image 11

Figure 6. Sensor callouts.

Software Components of the Environment Monitor Solution

Apart from the physical model, the Environment monitor solution also includes a variety of software components, which are described in this section. As mentioned above, the solution includes an administrative application running on the Intel® NUC, as well as a mobile customer application for general users, which is designed to run on a tablet PC or smartphone.

The previous air quality sensor application runs on Intel® IoT Gateway Software Suite. In contrast, the Environment monitor solution uses Ubuntu* Server.

The IDE used to develop the software for the Environment monitor solution is Intel® System Studio IoT Edition that facilitates connecting to the Intel® NUC and developing applications.

Like the previous air-quality sensor application, this solution uses MRAA and UPM from the Intel® IoT Developer Kit to interface with platform I/O and sensor data. The MRAA library provides an abstraction layer for the hardware to enable direct access to I/O on the Intel® NUC, as well as Firmata*, which allows for programmatic interaction with the Arduino* development environment, taking advantage of Arduino’s hardware-abstraction capabilities. Abstracting Firmata using MRAA enables greater programmatic control of I/O on the Intel® NUC, simplifying the process of gathering data from sensors. UPM is a library developed on top of MRAA that exposes a user-friendly API and provides the specific function calls used to access sensors.

Administrative Application

A simple administrative application built into the solution, the user interface of which is shown below runs on the Intel® NUC. This application provides a view of the data from the solution’s sensor array, with the ability to generate views of changes to that data over time. It also provides buttons that can be used by an administrator to trigger events by generating simulated sensor data that is outside preset "normal" ranges. This application is built to be extensible, with the potential to support additional types of sensors in multiple geographic locations, for example.

Figure 7 shows the main window of the administrative application, simulating normal operation when sensor data is all within the preset limits. This window includes controls to set the thresholds for alerts based on the various sensors, with display of the thresholds themselves and current sensor readings.

Image 12

Figure 7. Main administrative window showing status of sensors within normal parameters.

In Figure 8, one of the buttons to generate a simulated event has been pressed. The active state of that button is indicated visually, the data reading is shown to be outside normal parameters, and the alert indicator is active. The operator can acknowledge the alert, dismissing the alarm while the application continues to register the non-normal data. Once the sensor data passes back into the normal range, the screen will return to its normal operating state.

Image 13

Figure 8. Main administrative window during generation of a simulated alert.

The administrative application also provides the ability to view time-series sensor data, as illustrated in Figure 9. Using this functionality, operators can track changes over time in the data from a given sensor, which provides simple trending information that could be augmented using analytics.

Image 14

Figure 9. Log-file screen showing historical sensor data.

The Environment monitor solution uses AWS* cloud services to provide a central repository for real-time and historical sensor data. This cloud-based storage could be used, for example, to aggregate information from multiple sensors as the basis for a view of contaminant levels and resultant effects over a large geographical area. Analytics run against either stored or real-time streaming data could potentially generate insights based on large-scale views of substances of interest in the atmosphere.

Using capabilities such as these, development organizations could establish a scope of monitoring that is potentially open-ended in terms of the factors under investigation and the geographic area under observation. The administrative application takes advantage of cloud-based resources in order to support large-scale analytics on big data, as the foundation for future innovation.

Note: The administrative application can access data on AWS* using either a backend datastore or data storage using Message Queue Telemetry Transport* (MQTT*), a machine-to-machine messaging server. Implementation guidance for those options is available at the following locations:

Conclusion

The solution discussed in this development narrative provides an example of how existing IoT solutions provided by Intel can provide a springboard for development of related projects. In this case, a relatively simple air-quality sensor application is the basis of a more complex and robust Environment Monitor solution, which incorporates additional sensors and more powerful system hardware, while retaining the ability of the original to be quickly brought from idea to reality. Using this approach, IoT project teams working on the development of new solutions don’t need to start from scratch.

More Information

For more complete information about compiler optimizations, see our Optimization Notice.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)