IoT Devices

As part of the NETLab Toolkit’s growing orientation for the Internet of Things, we support (as of v5.3.1) the newest class of networked microcontrollers such as the Arduino Yún, Intel Galileo, and (soon) Tessel. Our approach is to build standard protocols and implementations across these Internet of Things devices. This means that you can create a project with whatever hardware is most appropriate, and it will work seamlessly with any other hardware using the protocol.

iotn Protocol Family – Starting with iotnREST

We’re calling these protocols iotn (for Internet of Things NETLab), and have implemented an initial version using the http REST protocol. This first protocol in the iotn family is called iotnREST, and is based on a simple URL format that draws loosely on the Arduino Yún Bridge example. For example, to get the value of the device analog input port 0, the following url format is used:

http://deviceIPaddress/arduino/analog/0

This simple REST protocol can be typed directly into a standard web browser, and can be implemented in any language that supports HTTP requests. While REST is not the most efficient communication method for realtime implementations, it is very simple to implement and test, and provides a solid baseline protocol for IoT applications. In the future, we plan to add a Web Sockets version of iotn called iotnWS. The NETLab Toolkit widgets currently support the iotnREST protocol.

iotnREST Protocol

Standard iotnTREST methods currently provided (prefixed by deviceIPaddress/arduino/):

"analog/2" -> analogRead(2)
"analog/99 -> generates a response for first 6 analog inputs - e.g. 100 110 120 130 140 150
"analog/2/123" -> analogWrite(2, 123)
"digital/13" -> digitalRead(13)
"digital/13/1" -> digitalWrite(13, HIGH)
"mode/13/input" -> pinMode(13, INPUT)
"mode/13/output" -> pinMode(13, OUTPUT)
"servo/3/180 -> servo.write(180) for port 3
"user/0" -> read user method - user URLs provide a method stub for users to create their code interface
"user/0/100" -> write user method - e.g. this could be used to talk to an I2C device, port 0, value 100

Widget Setup

Untitled-3_The NETLab Toolkit widgets (Flash and HTML5) support the iotnREST protocol. To connect to an iotnREST device, in the NETLab Toolkit widget, make the following settings to access a networked device:

  1. Set controller to iotnREST
  2. Set controllerIP to the IP address of the remote device
  3. Change the urlString only if you are using the iotnREST protocol in a non-standard manner

Device implementations

Each device requires a somewhat different implementation based on its hardware and software architecture. Our goal is to hide that from users, and expose the exact same interface through a simple to install set of software on each device. For example, in the case of the Arduino Yún, the user uploads an Arduino sketch (NETLabYun.ino) and that’s it. We’re trying to avoid modifications to the system software and other customizations that make it harder to quickly get started and maintain a reliable system.

Download the iotn software for the supported devices on the download page.

Arduino Yún

The IoTnREST implementation for the Yún uses the standard Bridge capability, and does not require any change on the Linux side of the device.

  1. Connect to the network – Set up the Yún to connect to your network via Ethernet or WiFi
  2. Upload the Arduino Sketch – Open the NETLabYun.ino file in the Arduino IDE (1.5.6 r2 for the Yun), and compile/upload the file to the Yún
  3. Get the Yún IP – Put this IP in the widget controllerIP parameter or use in a web browser
    1. If on a home network, you can probably just use arduino.local
    2. If on an institutional network (school or company) arduino.local may not work due to network restrictions on the multicast protocol. In this case you’ll need the actual IP address that the Yún got through DHCP
      1. Open Tools>Serial Monitor in the IDE and set the Line Ending to Newline (bottom of serial window)
      2. Type in the Linux command ifconfig
      3. This will display the current network connections, and you should see an IP address you can use

Intel Galileo Arduino

The IoTnREST implementation for the Galileo uses an Arduino sketch plus a Node.js server on the Linux side. It also includes an alpha version of the HTML5 widgets that are served directly by the Galileo Node server.

  1. Connect to the network – Set up the Galileo to connect to your network via Ethernet or WiFi – You’ll need to run the larger SD card version of the OS.
  2. Upload the Arduino Sketch – Open the NETLabGalileo.ino file in the Galileo compatible Arduino IDE, and compile/upload the file to the Galileo
  3. Upload Linux files –  SFTP the server.js file and html directory to the /home/root directory
    1. The standard Galileo Linux distribution does not have SFTP enabled – follow this post to get it running
  4. Get the Galileo IP – Put this IP in the widget controllerIP parameter or use in a web browser
    1. Determine the actual IP address that the Galileo got through DHCP
      1. Open Tools>Serial Monitor in the IDE and set the Line Ending to Newline (bottom of serial window)
      2. Type in the Linux command ifconfig
      3. This will display the current network connections, and you should see an IP address you can use
      4. If none of the network interfaces show a valid IP, you may need to tell the interface to request an IP
        1. In the Serial Monitor, type in ifup eth0 (for ethernet) or ifup wlan0 (for wireless)

To use the HTML5 widgets on the Galileo, type the IP address of the Galileo into any web browser and the widget authoring system will be served up.

http://galileoIP/

Tessel

Coming soon.


Last modified July 14th, 2014