This page describes the Intel® XDK "template" samples which can be used to create a Node.js* Internet of Things (IoT) project.
The source code for these templates can be found at https://github.com/gomobile?query=iotapp or by clicking the GitHub* icon located at the lower right corner of each sample's description box, when viewing the samples from within the Intel® XDK (from the Projects tab, choose Start a New Project > select the Templates group > find the Internet of Things Embedded Application section).
The "template" samples included with the Intel XDK are a collection of small, easy to understand, examples that show how to access digital and analog I/O as well as sensors attached via the I2C* and SPI* peripheral buses. These samples use the MRAA* sensor communication library for low-level communication. The MRAA library is designed to make it easier for developers to communicate with sensors and actuators in high-level languages on those IoT platforms that support the MRAA library.
Each of the "template" samples requires that the MRAA library and the Intel XDK daemon (aka xdk-daemon) be installed on your IoT board. These two software components are generally included in the default Linux image distributed with Intel IoT boards.
The Intel XDK will attempt to determine the existence and version of the MRAA library and xdk-daemon on your board, when you connect to your IoT board. It will automatically update and/or install those components onto your IoT board (with your permission) if it determines they are missing or out-of-date. See Updating the libmraa and libupm libraries if this automatic detection and installation mechanism fails.
Development and Testing
All of the "template" samples have been tested on the Intel® Galileo Board for Arduino (generation 1 and 2 boards) and the Intel® Edison Board for Arduino. A subset of these samples have been tested on the Intel® Joule™ 570x Developer Kit.
Select "galileo," "edison" or "joule" from the Filter by keyword pulldown at the upper right corner of the samples selection window (see the image above) to quickly identify which samples have been tested on your IoT board. If you are using a board that does not show up in the filter list, but your board does support the MRAA library, you may be able to make the sample work by modifying the sample's initialization code.
Basic I/O samples
- OnBoard LED Blink -- Blinks the onboard LED. This sample is the easiest sample to get started with and is recommended for testing your board and learning how to use the Intel XDK with an IoT device. It does not require external sensors or actuators.
- Analog Read -- Reads data from an analog input pin (ADC) on your IoT device.
- Digital Read -- Reads data from a digital input pin on your IoT device.
- Digital Write -- Writes data to a digital pin on your IoT device.
- PWM -- Writes a varying PWM signal to a PWM output on your IoT device. Optionally, can be used to control the intensity of an attached LED, when driven by the PWM output.
- UART Serial Write -- Demonstrates writing data via the serial port (aka UART) on select Intel IoT boards.
- IoT DevKit -- Demonstrates the use of multiple components in a single project: a light sensor, LED and an LCD.
- LCD with backlight driver -- Drives a JHD1313M1 LCD display connected via the I2C interface (for example, the LCD display in the Grove* - Starter Kit Plus). For important considerations, see the sample README and source code.
- SPI - Serial Peripheral Interface -- Communicates with SPI slaves as the master SPI device. Serial Peripheral Interface (SPI) is a synchronous serial data protocol used by microcontrollers for communicating with one or more peripheral devices over short distances.
- ISR - Interrupt Service Routine -- Calls an Interrupt Service Routine (ISR) when an external interrupt is triggered.
- Servrotary -- Rotates a servomotor connected to your IoT board when you turn the knob on a rotary angle sensor.
- BLE-iBeacon -- Create a Bluetooth* Smart/Low Energy (BLE) iBeacon* application, advertising the board's presence as a BLE device. Once the application is running, you can use a mobile app to scan for and measure the distance between the mobile device and your board.
- Device to Hub -- Pass sensor data from an IoT Device to the Microsoft Azure Hub. The hub then encrypts the data and allows you to either store or read the information received from the device.
- Hub to Device -- Retrieve data from the Microsoft Azure Hub. Use the similar "Device to Hub" app to send IoT device data to the hub.
Samples that work with a mobile companion app
- Local Temperature -- Take temperature readings with the Grove* - Temperature Sensor and graph the data on a mobile device running the mobile companion app.
- Touch Notifier -- Monitor the status of a touch sensor in a remote location with a companion app on a mobile device. When the sensor is touched, the mobile companion app displays a notification on the mobile device and a buzzer connected to the board sounds.
- BLE-Peripheral -- Create a Bluetooth* Smart/Low Energy (BLE) peripheral application. This application can advertise the board as a BLE peripheral. Read and write data via a service with the corresponding mobile companion app.
Templates for the web
- IoT Web Server -- Creates a very simple web server on your IoT device using the libmraa and libupm libraries for Node.js.
- Web Sockets -- Uses the socket.io Node.js module to enable real-time communication between your IoT board and a client web browser. You can use a client-side web application to turn your board's on-board LED on and off.