Search by Tags

Azure IoT device SDKs for Linux

 
Applicable for

Article updated at 28 Feb 2019
Compare with Revision




Subscribe for this article updates

Overview

The Azure IoT device SDKs are available for multiple platforms & programming languages. The following SDKs are supported by the Toradex Linux images:

  • C#
  • Javascript (node.js)

Below are instructions to quickly evaluate the various Azure IoT device SDKs on Toradex modules flashed with a V2.5 (or later) Linux image. These instructions require that you setup an Azure IoT Hub instance. Additionally, the Azure IoT Hub Device Explorer is used to verify functionality in all the proceeding examples.

C# with Mono

Setup Mono on the Device

Install Mono & related packages:

opkg update
opkg install mono mono-dev ca-certificates openssl

Import trusted certificates:

mono /usr/lib/mono/4.5/mozroots.exe --import --sync

Build C# Example Applications

On your host computer, use the Azure IoT C# Application Development guides to build C# applications. For samples, check out Azure IoT C# Samples.

Execute C# Example Application

Transfer the compiled C# example application to the device.

Start the Device Explorer application on your host machine.

Execute the C# example application (i.e. DeviceClientHttpSample.exe) on the device using Mono:

mono DeviceClientHttpSample.exe

Javascript with Node.js

Setup Node.js & the Azure IoT Javascript Libraries on the Device

Install Node.js & related packages:

opkg update
opkg install nodejs nodejs-npm python python-simplejson

Copy all the files from the Azure github samples directory into a directory of your choice. Then, inside this directory, install the required Node packages.

npm install

Configure & Execute Example Node.js Application

Edit the example javascript file(s) (e.g. simple_sample_http.js):

vi simple_sample_device.js

and locate the following line to change [IoT Device Connection String] to your connection string as provided by your IoT hub instance:

var connectionString = '[IoT Device Connection String]';

Start the Device Explorer application on your host machine.

Execute the sample application using Node.js:

node simple_sample_device.js