Today’s Hardware Friday is of a kind I’ve not seen before. Sure, we’ve seen the Chat to Hardware, Hardware to Chat projects, but I don’t think I’ve seen that uses Lync and the Unified Communications Web API.
Plus I’ve missing blogging about .Net Gadgeteer projects… 🙂
Today, most people think of Lync and Skype as tools for Unified Communications – Instant Messaging, Audio and Video conferencing, Application Sharing and in some instances telephony solutions.
Lync (and soon Skype for Business, the next version of Lync) can also be used as the end-point for receiving and processing a wide range of modalities, including Instant Messaging.
Instant Messaging is a simple and effective means for receiving alerts, notifications and information, and has a number of benefits over traditional methods.
Lower cost (IM is effectively free) and more reliable (IM can fail over to Email or SMS in the case an end-user is not online)
How important is IoT in the future? A video from fw:Thinking
It is predicted that by 2020, there will be 50 billion devices connected to the Internet. In this video from Fw:Thinking, Jonathan Strickland takes us on a tour through a living room of the future to see how this "Internet of Things" will impact our daily lives.
So how does IoT and Lync fit together?
By using one of Lync’s built-in or 3rd party API’s, it’s surprisingly easy to use Lync as a notification and messaging platform for physical hardware and IoT devices.
For this article, I’m using the Fez Spider, from GHI Electronics. The Fez runs the .Net Micro Framework 4.3, which is an open source framework supported by Microsoft’s Open Technologies group.
What can we monitor?
The .Net Gadgeteer supports a huge range of sensors and modules, all of which can be controlled by a few lines of C# or VB code. Some of the sensor modules available are listed below.
There are four simple steps for getting started .Net Gadgeteer.
Connect our modules
Connect to a network (wired or wirelessly)
Receive and process inputs from our modules
Send the output in a useful format, then wait for more inputs
Step 0 – Starting Off
There’s a great tutorial on MSDN showing how to get started with GHI’s FEZ Spider Kit and the .Net Gadgeteer framework available here . To avoid reinventing the wheel, below is a summary of the steps needed to build a basic IoT application.
I’ve put together a basic Gadgeteer Fez Spider board with an Ethernet Module, T35 LCD Display (for debugging), Button Module, MQ-3 Gas Sendor Module and a LED Strip (for testing).
Step 1 – Connecting our Modules
With the .Net Gadgeteer framework installed, Visual Studio provides a simple method for connecting your modules using drag & drop. This is available when you open the program.gadgeteer file.
Step 2 – Connect to a Network
There are a number of modules available that provide network connectivity, including physical Ethernet and Wifi. I’ve chosen an Ethernet module for simplicity, and allocated it a static IP address on my private network. Both modules fully support DHCP, which is more practical in a mobile environment.
Enabling a network connection is straight forward and follows a simple process.
Step 3 – Periodic updates and processing
In a practical sense, we would want to check the values periodically. To do this, we need to implement a timer method within our application.
The Gadgeteer has its own timer class, which exposes the underlying .Net Micro Framework timer class. We can create a timer object as follows.
Step 4 – Send the Output
Aside from sending the results to the debug console, it would be far more useful to send the output as an IM to Lync – that way we have an alert presented when the level reaches a value that you are concerned about.
Integration with Lync using UCWA
The Unified Communications Web API (UCWA), is a platform development created by Microsoft that exposes Instant Messaging and Presence capabilities of Lync.
This API can be used to send IMs from your backend server or device to a federated Lync client.
Learn more about using UCWA on the Lync Web Developer website.
Integration with Lync using Lync Agent
Integrating with Lync Agent is possibly the easiest method for sending instant messages from your IoT project – whether this be status updates (a button was pushed) or frequent counters or metrics (temperature, etc.)
Lync Agent is a hosted SaaS that provides a simple API for delivering Lync and Skype messages. Check it out at http://ift.tt/1y7Rooe
The simplest method is to use Lync Agent’s GUID-based HTTP API, allow for messages to be sent from a single HTTP POST. Here’s an example:
The Resulting Output
The sensor values retrieved above from the Gas Sensor module as are passed to Lync in realtime via the API calls.