Tag Archives: IoT Core

Windows Developer Awards: Honoring Windows Devs at Microsoft Build 2017

As we ramp up for Build, the Windows Dev team would like to thank you, the developer community, for all the amazing work you have done over the past 12 months. Because of your efforts and feedback, we’ve managed to add countless new features to the Universal Windows Platform and the Windows Store in an ongoing effort to constantly improve. And thanks to your input on the Windows Developer Platform Backlog, you have helped us to prioritize new UWP features.

In recognition of all you have done, this year’s Build conference in Seattle will feature the first-ever Windows Developers Awards given to community developers who have built exciting UWP apps in the last year and published them in the Windows Store. The awards are being given out in four main categories:

  • App Creator of the Year – This award recognizes an app leveraging the latest Windows 10 capabilities. Some developers are pioneers, the first to explore and integrate the latest features in Windows 10 releases. This award honors those who made use of features like Ink, Dial, Cortana, and other features in creative ways.
  • Game Creator of the Year – This award recognizes a game by a first-time publisher in Windows Store. Windows is the best gaming platform–and it’s easy to see why. From Xbox to PCs to mixed reality, developers are creating the next generation of gaming experiences. This award recognizes developers who went above and beyond to publish innovative, engaging and magical games to the Windows Store over the last year.
  • Reality Mixer of the Year – This award recognizes the app demonstrating a unique mixed reality experience. Windows Mixed Reality lets developers create experiences that transcend the traditional view of reality. This award celebrates those who choose to mix their own view of the world by blending digital and real-world content in creative ways.
  • Core Maker of the Year – This award recognizes a maker project powered by Windows. Some devs talk about the cool stuff they could build–others just do it. This award applauds those who go beyond the traditional software interface to integrate Windows in drones, PIs, gardens, and robots to get stuff done.

In addition to these, a Ninja Cat of the Year award will be given as special recognition. Selected by the Windows team at Microsoft, this award celebrates the developer or experience that we believe most reflects what Windows is all about, empowering people of action to do great things.

Here’s what we want from you: we need the developer community to help us by voting for the winners of these four awards on the awards site so take a look and tell us who you think has created the most compelling apps. Once you’ve voted, check back anytime to see how your favorites are doing. Voting will end on 4/27, so get your Ninja votes in quickly.

Cortana to open up to new devices and developers with Cortana Skills Kit and Cortana Devices SDK

We believe that everyone deserves a personal assistant. One to help you cope as you battle to stay on top of everything, from work to your home life. Calendars, communications and commitments. An assistant that is available everywhere you need it, working in concert with the experts you rely on to get things done.

We’re at the beginning of a technological revolution in artificial intelligence. The personal digital assistant is the interface where all the powers of that intelligence can become an extension of each one of us. Delivering on this promise will take a community that is equally invested in the outcome and able to share in the benefits.

Today we are inviting you to join us in this vision for Cortana with the announcement of the Cortana Skills Kit and Cortana Devices SDK.

The Cortana Skills Kit is designed to help developers reach the growing audience of 145 million Cortana users, helping users get things done while driving discovery and engagement across platforms: Windows, Android, iOS, Xbox and new Cortana-powered devices.

The Cortana Devices SDK will allow OEMs and ODMs to create a new generation of smart, personal devices – on no screen or the big screen, in homes and on wheels.

Developers and device manufacturers can sign up today to receive updates as we move out of private preview.

Cortana Skills Kit Preview

The Cortana Skills Kit will allow developers to leverage bots created with the Microsoft Bot Framework and publish them to Cortana as a new skill, to integrate their web services as skills and to repurpose code from their existing Alexa skills to create Cortana skills. It will connect users to skills when users ask, and proactively present skills to users in the appropriate context. And it will help developers personalize their experiences by leveraging Cortana’s understanding of users’ preferences and context, based on user permissions.

In today’s San Francisco event, we showed how early development partners are working with the private preview of the Cortana Skills Kit ahead of broader availability in February 2017.

  • Knowmail is applying AI to the problem of email overload and used the Bot Framework to build a bot which they’ve published to Cortana. Their intelligent solution works in Outlook and Office 365, learning your email habits in order to prioritize which emails to focus on while on-the-go in the time you have available.
  • We showed how Capital One, the first financial services company to sign on to the platform, leveraged existing investments in voice technology to enable customers to efficiently manage their money through a hands-free, natural language conversation with Cortana.
  • Expedia has published a bot to Skype using the Microsoft Bot Framework, and they demonstrated how the bot, as a new Cortana skill, will help users book hotels.
  • We demonstrated TalkLocal’s Cortana skill, which allows people to find local services using natural language. For example, “Hey Cortana, there’s a leak in my ceiling and it’s an emergency” gets Talk Local looking for a plumber.

Developers can sign up today to stay up to date with news about the Cortana Skills Kit.

Cortana Devices SDK for device manufacturers

We believe that your personal assistant needs to help across your day wherever you are: home, at work and everywhere in between. We refer to this as Cortana being “unbound” – tied to you, not to any one platform or device. That’s why Cortana is available on Windows 10, on Android and iOS, on Xbox and across mobile platforms.

We shared last week that Cortana will be included in the IoT Core edition of the Windows 10 Creators Update, which powers IoT devices.

The next step in this journey is the Cortana Devices SDK, which makes Cortana available to all OEMs and ODMs to build smarter devices on all platforms.

It will carry Cortana’s promise in personal productivity everywhere and deliver real-time, two-way audio communications with Skype, Email, calendar and list integration – all helping Cortana make life easier, everywhere. And, of course, it will carry Cortana expert skills across devices.

We are working with partners across a range of industries and hardware categories, including some exciting work with connected cars. The devices SDK is designed for diversity, supporting cross platforms including Windows IoT, Linux, Android and more through open-source protocols and libraries.

One early device partner, Harman Kardon, a leader in premium audio, will have more news to share next year about their plans, but today provided a sneak peek at their new device coming in 2017.

The Cortana Devices SDK is currently in private preview and will be available more broadly in 2017. If you are an OEM or ODM interested in including Cortana in your device, please contact us using this form to receive updates on the latest news about the Cortana Devices SDK and to be considered for access to the early preview.

Windows IoT Core Extension for Visual Studio Code

About the Windows IoT Core Extension for VS Code

Visual Studio Code is the first code editor and first cross-platform development tool – supporting OS X, Linux, and Windows – in the Visual Studio family.

Windows 10 IoT Core already supports popular boards like Raspberry Pi2, MinnowBoard Max and DragonBoard, and because Node.js continues to see a lot of excitement in the maker community, we have been continuously improving and expanding the Node.js support for Windows 10 IoT Core.

Using Visual Studio Code and the new Window Iot Core Extension for VS Code, you can write a Node.js script, deploy it to a Windows IoT Core device and then run it from the development machine of your choice, whether it runs OS X, Linux or Windows.

Install VS Code

To get VS Code go to http://code.visualstudio.com. The setup is quick and easy! If you are new to VS Code, I suggest you check out VS Code Tips and Tricks: https://github.com/Microsoft/vscode-tips-and-tricks

Install Windows IoT Core Extension for Visual Studio Code

  • Start VS Code
  • Press F1
  • Type “Install extensions” and press enter
  • Type “iot” in the edit box at the top of the list
  • Click the install button on Windows IoT Core Extension for Visual Studio Code

Install Node

  • Go to https://nodejs.org/ in a browser
  • If you aren’t sure which version to install, then install the LTS version

Deploying the Hello World Sample to Windows IoT Core

To create a simple web server that displays “Hello World,” open a command prompt and execute the following commands:

  • md c:hello (directory name/location isn’t important)
  • cd c:hello
  • npm init (accept all defaults)
  • code . // code <space> <period/dot>
  • F1 -> iot: Initialize settings.json
  • Enter device IP address and desired name
  • Enter the username and password to log into the device with. The defaults are “Administrator” and “[email protected]” If you prefer not to have your username and/or password in a plain text file, delete these lines from the generated .json file and you will be prompted each time they are needed.
  • Verify that settings.json is correct by pressing F1 and then typing “iot: Get Device Info.” If the command succeeds you should see output similar to the following:

IMAGE1

  • Change LaunchBrowserPageNo in settings.json to LaunchBrowserPage
  • Add a new file to the workspace by clicking the icon found here. Name it index.js or whatever filename you provided in npm.init.

IMAGE2

        var http = require('http');
        http.createServer(function (req, res) {
            res.writeHead(200, { 'Content-Type': 'text/plain' });
            res.end('Hello World!n');
        }).listen(1337);

  • To enable logging of your project set the start script in package.json file. The log file will be written to C:datausersDefaultAccountAppDataLocalPackagesNodeScriptHost_dnsz84vs3g3zpLocalStatenodeuwp.log on the device.
{
    &amp;quot;scripts&amp;quot;: {
        &amp;quot;start&amp;quot;: &amp;quot;node --use-logger index.js&amp;quot;
    }
}

  • F1 > “iot: Run Remote Script”
  • Navigate to http://${deviceip}:1337/ in a browser

Deploying the Blinky Sample to Windows IoT Core

  • md c:blinky (directory name/location isn’t important)
  • cd c:blinky
  • npm init (accept all defaults)
  • code . // code <space> <period/dot>
  • F1 -> iot: Initialize settings.json
  • Enter device IP address and desired name
  • Enter the username and password to log into the device with. The defaults are “Administrator” and “[email protected]”. If you prefer not to have your username and/or password in a plain text file, delete these lines from the generated .json file and you will be prompted each time they are needed.
  • Wire your circuit as described at https://developer.microsoft.com/en-us/windows/iot/samples/helloblinky
  • Add a new file to the workspace by clicking the icon found here. Name it index.js or whatever filename you provided in npm.init.

IMAGE3

    // Copyright (c) Microsoft. All rights reserved.
    var http = require('http');
    var uwp = require(&amp;quot;uwp&amp;quot;);
    uwp.projectNamespace(&amp;quot;Windows&amp;quot;);
    var gpioController = Windows.Devices.Gpio.GpioController.getDefault();
    var pin = gpioController.openPin(5);
    var currentValue = Windows.Devices.Gpio.GpioPinValue.high;
    pin.write(currentValue);
    pin.setDriveMode(Windows.Devices.Gpio.GpioPinDriveMode.output);
    setTimeout(flipLed, 500);

    function flipLed(){
        if (currentValue == Windows.Devices.Gpio.GpioPinValue.high) {
            currentValue = Windows.Devices.Gpio.GpioPinValue.low;
        } else {
            currentValue = Windows.Devices.Gpio.GpioPinValue.high;
        }
        pin.write(currentValue);
        setTimeout(flipLed, 500);
    }

  • F1 > “iot: Run Remote Script”
  • You should see the LED blinking

Quick Tour of IoT Commands

All of the commands contributed by this extension are prefixed with “iot:”. To see a list of commands that are contributed by this extension, press F1 and then type iot. You should see something like this:

iot: Get APPX Process Info    // get information about UWP applications running on the device

iot: Get Device Info          // get information about the Windows IoT Core device

iot: Get Device Name          // get the Windows IoT Core device name

iot: Get Extension Info       // get information about this extension

iot: Get Installed Packages   // get a list of APPX packages installed on the device

iot: Get Process Info         // get a list of processes running on the device

iot: Get Workspace Info       // get information about the workspace currently open in VS Code

iot: Initialize settings.json // initialize the project settings with iot extension defaults

iot: List Devices             // List Windows IoT Core devices on the network

iot: Restart Device           // Restart the Windows IoT Core device.

iot: Run Command Prompt       // Prompt for a command and then run it on the device

iot: Run Command List         // Show a list of commands from settings.json and run the one that is picked

iot: Run Remote Script        // Run the current workspace Node.js scripts on the Windows IoT Core device

iot: Set Device Name          // Set the device name using the IP Address and name provided

iot: Start Node Script Host   // Start the Node.js script host process that works with this extension

iot: Stop Node Script Host    // Stop the Node.js script host process that works with this extension

iot: Upload Workspace Files   // Upload the files for this workspace but don’t run the project

Get started with Visual Studio.

Introducing Arduino Wiring on Windows 10 IoT Core

Developers targeting Windows 10 IoT Core can use a programming language of their choice. Today, this includes C#, C++, Visual Basic, JavaScript, Python and Node.js, but we’re not stopping there. Arduino Wiring is the latest addition to IoT Core.

Arduino is one of the most popular platforms among makers. Its community has produced a large number of libraries to interface with peripherals such as LED displays, sensors, RFID readers and breakout boards. One of the main drivers for Arduino’s adoption is its simplicity. With Windows 10 IoT Core, you can now create or port Arduino Wiring sketches that will run on supported IoT Core devices, including Raspberry Pi 2, 3 and Minnowboard Max.

Creating your first Arduino Wiring sketch for IoT Core

You can find the detailed steps for creating Arduino wiring sketches in the Arduino Wiring Project Guide. In addition, here is a quick summary:

IMAGE1

  • Upon project creation, a sketch file with the same name and the extension ‘.ino’ will be created and opened by default. The sketch includes a template for Arduino Wiring using a classic hello world LED blinking code. More details about the Arduino Wiring template and required device setup can be found at the Hello Blinky (Wiring) page.

IMAGE2

  • Before deploying, make sure to change the driver on the target device to DMAP. For more details, follow the instructions in the Lightning Setup Guide.
  • Finally, select your remote machine and press F5 to build and deploy your app to your device. Go back to the Arduino Wiring Project Guide for additional guidance.

How does an Arduino Wiring sketch run on an IoT Core device

On an IoT Core device, an Arduino Wiring sketch runs as a background application (headless); i.e. there is no UI visible on an attached monitor. This is similar to running a sketch on an Arduino device such as the Arduino Uno for example. However, you can still debug the sketch as you would any other app under Visual Studio by inserting breakpoints and/or stepping through the code. Additionally, to enable verbose output logging, Serial.print() and Serial.println() have been updated to send their output to Visual Studio’s debug pane when the sketch is running under the debugger (the output will also be sent to the serial pins). The Log() function can be used to output to debug as well. Check the Arduino Wiring Porting guide for more details on using Serial.print*() on IoT Core devices.

Porting an Arduino wiring sketch or library to Windows 10 IoT Core

For many Arduino Wiring sketches, simply copying the source code from the existing one to a new Arduino Wiring project in Visual Studio editor and replacing the pin numbers with the ones on your device would suffice.

However, while we have tried to make our implementation as close as possible to other Arduino-based devices, in some cases, a few modifications need to be made to your sketch to make it compatible with the Windows IoT Core OS, the C++ compiler or the board the sketch is running on. The Arduino Wiring Porting Guide covers many of those modifications needed and solutions to problems you may face while porting your sketch.

To use an existing Arduino library, you simply need to copy and add the header (.h) and source file (.cpp) for the library to your project, then reference the header file. Again, most libraries should work with no or very few modifications. However, if you face any issues, please check the Arduino Wiring Porting Guide.

Writing Windows 10 IoT Core specific code

For your scenario, you may want to write code parts that target Windows 10 IoT Core only, but at the same time maintain compatibility with other devices. For that, you can use the _WIN_IOT macro; e.g.:

#ifdef _WIN_IOT
// Windows IoT code only
#else
// Other platforms code
#endif

Arduino Wiring and the Universal Windows Platform (UWP)

Arduino sketches runtime behavior on IoT Core devices is similar to other Arduino devices, with every function implemented to work the same way when interacting with the various controllers. However, Arduino Wiring sketches are also Windows UWP apps and thus can be extended to call any UWP APIs such as networking, storage, Bluetooth, media, security and others; for example, you can communicate with Bluetooth devices, connect to Wi-Fi network or even create a OneNote app using Arduino Wiring.

Additionally, you can wrap your sketch inside a WinRT library and use it in any UWP app, including UI apps. Building Arduino Wiring Libraries guide details the steps needed to create Arduino Wiring based libraries.

Additional Resources:

Here are additional resources to assist with creating/porting Arduino Wiring apps running on Windows 10 IoT Core:

Also, check out these Arduino Wiring samples:

OneNote Cloud Services Weather Station Stepper Motor
RGB Pixel LCD Text Display DC Motors

Finally, please add your questions/comments below or send your feature requests to the Lightning repository on GitHub.

Get started with Visual Studio.

Windows 10 IoT Core Blockly

In this blog post you’ll learn about IoT Core Blockly, a new UWP application that allows you to program a Raspberry Pi 2 or 3 and a Raspberry Pi Sense Hat using a “block” editor from your browser:

IMAGE1

You create a program with interlocking blocks, which will run on the Raspberry Pi. For example, you can control the LED matrix on the Sense Hat and react to the inputs (buttons, sensors like temperature, humidity, etc.).

IMAGE2

IoT Core Blockly was inspired by these other super interesting projects:

In this blog post, we will show you how to set up your Raspberry Pi with IoT Core Blockly and get coding with blocks.

Also, we’ll open the hood and look at how we implemented IoT Core Blockly leveraging Windows 10 IoT Core, Google Blockly, the Sense Hat library and the Chakra JavaScript engine.

Set up IoT Core Blockly on your Raspberry Pi

What you will need:

  • A Raspberry Pi 2 or 3
  • A Raspberry Pi Sense Hat
  • A clean SD Card (at least 8 Gb) to install Windows IoT Core 10 Insider Preview
  • A computer or laptop running Windows 10, to install the IoT Dashboard

First, unpack your Sense Hat and connect it on top of the Raspberry Pi (having four small spacers is handy, but not required):

IMAGE3

IMAGE4

Now you will need to install the latest Windows IoT Core 10 Insider Preview on your SD card. Follow the instructions at www.windowsondevices.com in the “Get Started” section:

  • If you have a Raspberry Pi 2, go here
  • If you have a Raspberry Pi 3, go here

At this point, you should have the IoT Dashboard up and running on your Windows 10 desktop (or laptop) and your Raspberry Pi connected to the network (either Ethernet or Wireless). You should be able to see your Raspberry Pi on the IoT Dashboard “My devices” section:

IMAGE5

In IoT Dashboard, go to the section called “Try some samples.” You will see the IoT Core Blockly sample:

IMAGE6

Click on it and follow the instructions to install the UWP application onto your Raspberry Pi. After a few seconds, IoT Dashboard will open your favorite browser and connect to the IoT Core Blockly application running on your Raspberry Pi:

IMAGE7

Press the “Run” button and the IoT Core Blockly application will start the “Heartbeat” program, and you should see a blinking red heart on your Sense Hat!

Try some other samples (the green buttons on the top). Select a sample, inspect the “blocks” in the editor and press the “Start” button to start this new program.

Try modifying an example: maybe a different image, color or message. IoT Core Blockly remembers the last program you run on the Raspberry Pi and will reload it when you start the Raspberry Pi again.

Under the hood

How does IoT Core Blockly work? How did we build it?

The code is on GitHub: https://github.com/ms-iot/samples/tree/develop/IoTBlockly.

You can clone the https://github.com/ms-iot/samples repo and load the IoTBlockly solution using Visual Studio 2015 Update 3.

The structure of IoT Core Blockly is simple:

  • The main app starts a web server which serves the Blockly editor page on port 8000.
  • At this point, you can browse to your Raspberry Pi <ip-address>:8000 from a browser and access the Blockly editor.
  • We created custom blocks for specific Sense Hat functionalities (e.g. the LED display, the joystick, the sensors, etc.) and added them to specific “categories” (e.g. Basic, Input, LED, Images, Pin, etc.)
  • Blockly makes it simple to translate blocks to JavaScript, so we could generate a runnable JavaScript snippet. You can see what your block program translates to in JavaScript by pressing the blue button “Convert to JavaScript” – note: to enable “events” like “on joystick button pressed” we have a few helper JavaScript functions and we pay special attention to the order of the various functions.
  • At this point, we have a block editor that can generate a runnable JavaScript snippet: We need something that can execute this JavaScript snippet on a different thread without interfering with the web server.
  • To run the snippet, we instantiate the Chakra JavaScript engine (which is part of every Windows 10 edition) and start the snippet. Chakra makes it easy to stop the snippet at will.
  • Many of the blocks interact directly with the Sense Hat. We could have written a bunch of JavaScript code to control the Sense Hat, but we leveraged the complete and easy to use C# SenseHat library from EmmellSoft. Bridging between JavaScript and C# was extremely easy leveraging a wrapper UWP library.
  • Last, we added some machinery to make sure the last “run” snippet is saved on the Raspberry Pi (both the blocks layout and the JavaScript snippet are cached) and run again the next time the IoT Core Blockly app starts (e.g. when you restart your device).

If you inspect the IoTBlockly solution from GitHub, you can see 4 different projects:

  • IoTBlocklyBackgroundApp: The main app that orchestrate the web server and the Chakra JavaScript engine. Google Blockly code is part of this project.
  • ChakraHost: A wrapper library to simplify the use of the Chakra JavaScript engine (inspired by the “JavaScript Runtime Sample” you can find at https://github.com/Microsoft/Chakra-Samples (full path at http://bit.ly/1QgvdWa).
  • IoTBlocklyHelper: A simple UWP wrapper library to bridge between C# code and the JavaScript snippet. The SenseHat library from EmmellSoft is referenced in this project.
  • SimpleWebServer: A rudimentary web server based on Windows.Networking.Sockets.StreamSocketListener.

Let us know if you want more details about how this works. We can definitely geek out more about this! J

Next steps

IoT Core Blockly is a functional sample, but we think we can do more. For example:

  • add more support for colors,
  • add support for sounds,
  • add support for voice (speech and speech recognition),
  • add more blocks for GPIO, ADC, PWM, SPI, I2C,
  • add blocks for other “hats” (for example, the GrovePi),
  • send/Receive data to/from the cloud, over BT, etc.,
  • leverage the io environment,
  • improve the stability of the web server.

First, though, we want to hear from you J How you use IoT Core? What would you change or improve?

Don’t forget, IoT Core Blockly code is here on GitHub, and we gladly accept help, contributions and ideas!

Thanks for trying this out, and get started with Visual Studio!

Announcing IntelĀ® Jouleā„¢ support in Windows 10 IoT Core Anniversary Edition

Two weeks ago I was excited to see us unveil Windows 10 IoT Core Anniversary Edition running on the new Intel® Joule™, built on the new Intel® Atom™ T5700 SOC. It took us a little over 6 weeks to bring up Windows 10 IoT Core and build Bamboo, the first Windows 10 IoT Core and Intel® Joule™ powered robot. We look forward to seeing what you think of Windows 10 IoT Core for the Intel® Joule™ when it becomes available as part of the Windows Insider Program release scheduled for September.

IMAGE1

Bamboo, the first Windows 10 IoT Core robot running on the Intel® Joule™

To give you a peek into what you can do with this we created Bamboo, a companion robotic panda. Running Windows 10 IoT Core on the Intel® Joule™ compute platform, Bamboo connects to cloud-based Microsoft Azure* and Cognitive Services, which provide sentiment analysis and translation, so you can speak to Bamboo in any language and she can translate into her native English and understand your mood via Twitter. Bamboo can move about and build an understanding of her environment with the compute platform and an Intel® RealSense™ camera. Additionally, she is animated via the EZ-Robot EZ-B control system.

All of this happened at the Intel Developer Forum 2016 in San Francisco. At that event, we also had a number of partners showing off what Windows 10 IoT Core can do.

EZ-Robot integrated the Intel® Joule™ with Windows 10 IoT Core into their EZ-B V5, making EZ-Robot the first custom integrator of the Intel® Joule™ using Windows 10 IoT Core. EZ-Robot displayed the new control module and multiple robots running on this new platform. Using the EZ-Builder software for Windows and a newly released EZ-Robot UWP library, you can design and animate your robots on a Windows PC, as well as auto-generate and export UWP control code to run on the EZ-B V5. We used this functionality to animate Bamboo. The bring up and integration of the EZ-B v5 took just under 6 weeks.

IMAGE2

Design Mill highlighted Torch, a mixed reality interactive gaming table. Built on the Intel® Joule™, Intel RealSense camera and Windows 10 IoT Core, Torch enables interactive gaming mixing perception, projection and blending the physical/digital divide.

IMAGE3

Joining our other outstanding partners like Raspberry Pi, Arduino, Adafruit and Seeed Studio, great partnerships like the ones we have with Intel, EZ-Robot and Design Mill that produce boards and systems, helps make Windows 10 IoT Core the best platform to build your IoT solutions on. When you add in Microsoft Azure IoT and Microsoft Cognitive Services, you get a cloud-connected, manageable, intuitive and, above all, human-like platform to build upon.

The Windows Insider program makes it very easy for you to get access to all of the above, as well as also the latest pre-releases of Windows 10 IoT Core (which will soon support the Intel® Joule™ module). Once you’ve installed the pre-release, we enable the OS to automatically upgrade so you’ll be able to try out the latest features in the next pre-release of Windows 10 IoT Core as we make each release – No more looking for updates on web pages or developer centers. We’re excited by this and we hope you’ll take the opportunity to join the many developers who are already using the Windows Insider Program.

We can’t wait to see what you make!

Building Secure Apps for Windows IoT Core

Secure communication in the cloud normally involves the following:

  • Data encryption: hiding what is sent
  • Data integrity: protecting data from being tampered with
  • Authentication: validating the identity of the parties in the communication

Using a cryptographic protocol such as the TLS takes care of data encryption and integrity, and also allows the client to validate the identity of the server by validating its digital certificate.

For IoT devices, validating the identity of the client presents a unique challenge. Unlike traditional consumer devices such as PCs and phones, IoT devices are typically not operated by humans who can enter a password, recognize a picture or solve a CAPTCHA.

In this post, we will look at how to write apps for Windows IoT Core that can authenticate to Azure, while protecting the security-sensitive information on the device.

TPM: Enterprise-Grade Security for Small Devices

Storing secure information, such as a password or a certificate, on a device could make it vulnerable to exposure. A leaked password is a surefire way to compromise the security of a device or an entire system. Human operators take pains to avoid divulging secret information and IoT devices should too, but they must do it better than humans.

In the Windows family, the technology that underpins the security of the OS – the Trusted Platform Module (TPM) – is also available on Windows IoT Core and can be used to secure IoT devices.

At a very high level, a TPM device is a microcontroller that can store data and perform computations. It can be either a discrete chip soldered to a computer’s motherboard, or a module integrated into the SoC by the manufacturer – an approach particularly well suited for small devices.

Inside the TPM

A key capability of the TPM is its write-only memory. If the data cannot be read once written, you might question how can it be useful. This is where TPM’s compute capability comes in – even though the security-sensitive data cannot be read back, TPM can compute a cryptographic hash, such as the HMAC, based on that data. It’s impossible to uncover the secret given the hash, but if the secret is known to both parties of communication, it is possible to determine whether the hash received from another party was produced from that secret.

This is the basic idea behind using cryptographic keys: the secret – called the shared access key – is established and shared between the IoT device and the cloud during the device provisioning process. From that point on, an HMAC derived from the secret will be used to authenticate the IoT device.

Device Provisioning

The tool that provisions Windows IoT Core devices is called the IoT Core Dashboard, and can be downloaded here.

The dashboard produces an image of the OS and securely connects your device to Azure by associating the physical device with the device Id in the Azure IoT Hub, and imprinting the device-specific shared access key to the devices’ TPM.

For devices that don’t have a TPM chip, the tool can install a software-emulated TPM that, while providing no security, allows you to use the same programming model as the one used for the hardware TPM. This way you can develop your app using a maker device (such as Raspberry Pi 2 or 3) and have security “light up” on a device with the hardware TPM, without having to change the app.

To connect your device to Azure, click on the “Connect to Azure” tab:

image 1

You will be asked to log in to your Azure account (you can get a free trial subscription here if you don’t have one already), pick the desired instance of Azure IoT Hub and associate your physical device with it.

If you don’t have any IoT Hub instances in your Azure subscription, the tool will let you create a free instance. You shouldn’t worry about accidentally running up a bill in your subscription – unless you explicitly ask for it, the dashboard will not create any paid services on your behalf.

Once you have selected the IoT Hub and the device ID to associate your device with, you can imprint the shared access key of that device on your TPM:

image 2

Reconfiguring the Device

Normally you would only use the dashboard for configuring your device for the first time. What if you need to reconfigure your device later? In that case, connect to your device using the Windows Device Portal and open the “TPM configuration” tab.

The Portal allows you to configure additional TPM properties, such as the logical device Id – this way your device can have several identities, which can be useful if you are running different apps that connect to Azure on behalf of different device Ids.

You can find more information on configuring TPM through the Windows Device Portal here.

Show Me The Code!

We have previously described how to connect to Azure using the device credentials retrieved from the IoT Hub. All of this continues to work, but now you can also use a new approach that doesn’t involve keeping the connection string in the app. This means that the same app can work on any provisioned device. You don’t have to insert the connection string in the code after checking it out from source control. No need to remember to remove it before checking the code back in.

When your app runs on a provisioned device, it can extract the device-specific connectivity information at runtime from the TPM.

To connect to Azure IoT Hub from a provisioned device, use the TpmDevice class from the Microsoft.Devices.Tpm library (available as the NuGet package). Get the device information stored in the desired slot (typically slot 0), then retrieve the name of the IoT Hub, the device Id and the SAS token (the string containing the HMAC produced from the shared access key) and use that to create the DeviceClient:

CODE

At this point, you have a connected deviceClient object that you can use to send and receive messages.

The full working sample is available here.

Where Do We Go from Here?

Clearly, security doesn’t end here. Having the token stored in the TPM means that it cannot be extracted or cloned – a bad guy cannot “put on the internet”. However, if the physical access to the device is unprotected, an attacker can install a malicious app on it. Likewise, a discreet TPM can be removed and plugged into another device running an unauthorized app.

If an important process decision depends on the data coming from a sensor (say, a thermometer) attached to the device, an attacker with a blow torch can make it produce wrong data.

Finally, if the health of your system depends on the condition of a particular device, it can be compromised by a low-tech attacker with a sledgehammer.

With all that in mind, using the TPM technology for storing device credentials is an important step towards productizing your IoT solution. TPM allows you to write secure code, so you can be assured that your cloud resources are only consumed by authorized devices and you can trust the data coming from these devices – if access to them has been physically protected.

Download Visual Studio to get started!

Post written by Artur Laksberg, a principal software engineer in Windows

Advancing Node.js for Windows 10 IoT Core

One of the latest trends that has excited many technology enthusiasts in the last few years is Internet of Things (IoT), which has the potential to transform how technology is consumed by enterprises and end users in the coming years. Windows 10 IoT Core already supports popular boards like Raspberry Pi2, MinnowBoard Max and DragonBoard, and because Node.js continues to see a lot of excitement in the IoT and the maker community, we have been actively updating the Node.js support for Windows 10 IoT Core for new scenarios since it was released last year.

Yesterday, Node.js support for Windows 10 IoT Core reached a new major milestone. The Chakra team submitted a Pull Request(PR) to mainline Node.js using the recently open sourced ChakraCore JavaScript engine. Once accepted, this PR will allow us to move at the speed of Node.js while accomplishing two goals. First, growing organically based on community feedback and, second, bringing innovation faster to the developers on Windows 10 IoT Core. As per our roadmap, detailed in this blog, the Chakra team will continue to work closely with the community and the Node.js Foundation to improve module compatibility and evaluate Node.js performance.

The September update for Node.js support for Windows 10 IoT Core made it easier to get started and improved compatibility of some key IoT specific npm modules. This project continues to make progress by keeping it current with Node.js and incorporating community feedback. Today, we are releasing the version 1.5 update to Node.js Tools for Windows IoT. The following are some of the highlights of this new release.

Console Apps

The console application model constitutes a majority of Node.js development on Windows 10 IoT today. This is a familiar Node.js experience wherein developers are used to working with their favorite editor and a command prompt across platforms. Windows 10 IoT Core supported this app model from the beginning, allowing the use of Node.js with Chakra and using PowerShell, SSH, or SMB file transfer to manually deploy their scripts on the device. This experience will continue to work in the 1.5 update using Node.js with ChakraCore. ChakraCore will be developed in the open, will see faster updates, and will work across different Windows OS starting from Windows 7 and higher. Node.js with ChakraCore is aligned with Node.js master and currently supports Node.js v6.0.0. Developers can get started and try it out even with the standalone installer for Node.js with ChakraCore. You can use some of the console app samples like MemoryStatus and Using Cylon, which are available at our site.

Universal Windows Platform (UWP) Apps

Node.js developers for Windows 10 IoT Core also enjoy the benefits of Universal Windows Platform (UWP) model using Node.js. This app model is central to the Windows 10 ecosystem and allows developers to target the entire family of Windows 10 devices. UWP apps built using Node.js are powered by the inbox Chakra JavaScript engine, and the Node.js Tools for Windows IoT v1.5 will install all the relevant tools and binaries needed to create a UWP app in Node.js. This option allows familiar Visual Studio experience. The latest release includes better debugging support, more templates to help developers get started easily, and Node.js support for the latest stable release. It requires Visual Studio 2015 Update 1. The following are some key improvements for this scenario:

Support for Node.js Tools for VS 1.1
The latest NTVS release brings more reliable debugging and IntelliSense, support for npm v3, code snippets, and general stability and performance improvements.

Support for Node v5.4.1
We always want to be on the cutting edge of node.js and the latest build of Node.js Tools for Windows IoT supports the latest stable version v5.4.1

Built-in Template for Johnny-Five
Johnny-Five, a popular JavaScript Robotics and IoT programming framework, is well supported with Windows 10 IoT Core; with this release, we are making it even easier to get started with it by including a built-in UWP template for Johnny-Five.

New project dialog inside Visual Studio 2015 showing Johnny-Five UWP template

New project dialog inside Visual Studio 2015 showing Johnny-Five UWP template

Candy Robot

Our goal is to continue improving and also provide great Node.js support in Windows 10 IoT Core. As a part of the ChakraCore launch, we recorded a demo that showcases Node.js with the ChakraCore console app running on Raspberry Pi2 with Windows 10 IoT Core. We call it the “Candy Robot.” The demo shown here uses 100+ dependent npm modules including cylon, serialport, firmata, and express (there is also a version which uses Johnny-Five instead of cylon at our repo), just to illustrate the breadth of module support that is already available.

The Candy Robot has a light sensor on it. When it moves, the robot uploads the light intensity data at a given point to a server. The server has an interface to view the average brightness data and exploration time. It further shows an early preview of the Time-Travel debugging feature, which we are working on and will be sharing more about as it evolves.

If you want to play with it yourself and hook it up with some more interesting sensors and functionality, here is the detailed step-by-step instruction for the demo.

How to Get Started?

Want to build something interesting? To get started using Node.js Tools for Windows IoT, here are the instructions to create a UWP app and Node.js with ChakraCore console app. The Docs and Samples page has some samples with detailed instructions and code to play with.

It’s a lot of fun working on this project, and we truly value your support and feedback so far, so please keep them coming on our issues page. You can also reach us on Twitter at @ChakraCore or visit ChakraCore’s GitHub repo and leave us a note by opening an issue.

Can’t wait to see what you build!

Written by Arunesh Chandra, a senior program manager on Chakra

Announcing DragonBoard 410c support in Windows 10 IoT Core, Arduino partnership updates

It’s been an exciting time over the last six months with our first release of Windows 10 IoT Core during //build/ 2015, the first public release in early August 2015, and most recently a new Windows Insider Preview release. Today I’m pleased to share what’s next for Makers on Windows 10 with new support for the DragonBoard 410c and an update for our Arduino partnership – with more to come.

DragonBoard 410c support

At WinHEC 2015 in Shenzhen, we announced with Qualcomm that support for Windows 10 IoT Core on the DragonBoard 410c was coming. The wait is over, and it is available today as a public preview through the Windows Insider Program!

Windows 10 IoT Core now supports the following capabilities of DragonBoard 410c above and beyond what’s already supported on other ARM platforms:

  • Onboard WiFi and Bluetooth
  • DirectX graphics

We are very excited to add the DragonBoard 410c, which features the Qualcomm® Snapdragon™ 410 processor to our family of supported Windows 10 IoT Core devices! You can get started here.
1_DragonBoard410
DragonBoard 410c

Arduino Partnership

At //build/ 2015 we announced our Windows partnership with Arduino, and Windows became the first Arduino certified OS. We also announced two bridging technologies designed to connect the physical world of Arduino with the Windows ecosystem and computing power – Windows Virtual Shields for Arduino and Windows Remote Arduino.

You can now get the Windows Insider Preview of Windows 10 IoT core with the next four technology investments as part of our Arduino partnership:

  1. Windows 10 IoT Core Universal Windows Platform (UWP) support for Arduino Wiring
  2. Windows 10 IoT Core Universal Windows Platform support for direct memory mapped UWP Providers
  3. Windows Store availability of the Windows Virtual Shields Application
  4. Windows Store availability of the Windows Remote Arduino Experience Application

Arduino Wiring

We want to make it easy for you to use existing Arduino Wiring Sketches, libraries, and hardware with Windows 10 IoT Core Universal Windows Apps (UWA) on a Raspberry Pi 2 or other supported board. By creating a new Visual Studio template, supporting NuGet Packages, and platform improvements we’re making it easier than ever to build on Windows 10 IoT Core.

Simply drag-and-drop (or cut-and-paste) your favorite and readily-available Arduino Wiring INO and library files into Visual Studio, connect your hardware over GPIO, SPI, I2C, ADC or PWM to your Raspberry Pi 2 or other supported Windows 10 IoT Core device, and run your code. Visual Studio and Windows will do all the heavy lifting to create a UWA and deploy it on your behalf, and you can also leverage the power of Visual Studio with Windows to debug your Arduino Wiring code.

With Arduino Wiring being supported as an extension to the Universal Windows Platform, you can even create a UWA that combines Arduino Wiring, C# and XAML. This enables you to build great projects with mixed mode programming like the plotter near the end of this video. Try out Arduino Wiring here.

2_plotter
Mixed mode plotter using a Raspberry Pi 2, Windows 10 IoT Core and Arduino Wiring

Windows Virtual Shields for Arduino Application

This technology lets you leverage sensors and actuators on your Windows 10 device from an Arduino over USB, WiFi, and Bluetooth. For example, you can access your Windows 10 Phone accelerometer or your Windows 10 Desktop Screen from an Arduino over WiFi.

The Windows Virtual Shields for Arduino application is now in the Windows Store, and has improved the workflow to get started. The app is all you need on the Windows 10 device. Try it out here.

3_slotCars
Windows IoT Core, Raspberry Pi 2 and Windows Phone controlling slot cars

Windows Remote Arduino Experience

This technology lets you develop on your Windows 10 device and access the physical world via an Arduino over USB, WiFi, and Bluetooth. For example, you can program in C# on your Windows 10 Phone and drive a servo connected on your Arduino over Bluetooth.

We also created a Windows app that enables you to explore GPIO, ADC, and PWM functionality without writing any code on your Windows 10 device. The Windows Remote Arduino Experience app is now available in the Windows Store. Give it a try!

High Performance Option for GPIO, SPI, and I2C

You can also get a Windows Insider Preview of a new, performant direct memory mapped driver model. This new memory mapped driver model that is 60-90 times faster than the inbox driver, resulting in GPIO pulse rates of over 4 MHz. If you’re using the Arduino Wiring support described above then you will be able to configure it to use this driver.

We have created UWP providers for the GPIO, SPI, and I2C busses that enable you to leverage the performance improvements of the direct memory mapped driver with only very small changes to your existing code. To learn more click here.

We can’t wait to see what you’ll make.