Adding sensors and actuators

The basic steps are:

  1. When deciding which components to add to your project, some useful questions to ask are:
    • Is the sensor or actuator already supported by the UPM sensor library? Browse the list of supported sensors in the Sensor Library Explorer to find out.
    • Is example code available? Modifying an example is often faster than writing code from scratch. See the Sensor Library Explorer for code examples that you can paste directly into your project.
  2. Connect the components to your board. The exact steps to do this vary depending on your sensor or actuator, and whether you're using a kit such as the Grove* - Starter Kit Plus: Intel® IoT Edition or connecting components using a breadboard and jumper wires.
  3. Write or modify your project code to interact with the sensor or actuator.

For a quick example of adding a new sensor to your project, see Example: Adding a light sensor to your project.

The Intel IoT Developer Kit provides several ways to get started adding sensors:

If you want access to individual I/O pins rather than sensors, the MRAA I/O library (also called libmraa) is a low-level library that provides a way to interact with GPIO pins. For best practices to write code using MRAA, see Using MRAA to Abstract Platform I/O Capabilities. There is currently no JavaScript*-specific API documentation for MRAA, but the method names and signatures are the same as seen in the Python documentation.

Examples using MRAA code for the Grove - Starter Kit Plus: Intel IoT Edition are included in Creating JavaScript*-based Intel® IoT projects with the Grove* - Starter Kit Plus.

For a list of sensors supported by UPM and JavaScript, Python*, and C++ example code for each sensor, see https://software.intel.com/en-us/iot/hardware/sensors.

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