Friday, July 15, 2016

Device Management using IBM Watson IoT Platform


The IBM Watson Internet of Things Platform (WIoTP) is a fully managed, cloud-hosted service that makes it simple to derive value from Internet of Things (IoT) devices. One can register 'n' number of Devices to WIoTP and publish the data / events. While the Applications can subscribe to the WIoTP and fetch the Device data for it's consumption. 

The device management feature enhances the IBM Watson IoT Platform service with new capabilities for managing devices. The WIoTP facilitates Device Management, by hosting the DM Server on the Platform and DM Agent on the Devices. With this, you now have the luxury to manage 'n' number of the Devices through the Platform, without logging into any of them.

The Watson IoT Recipe 'Connect Raspberry Pi as Managed Device to IBM Watson IoT Platform' demonstrates, how you can make use of a Raspberry Pi Device set up with Git and Maven environment, a IBM Bluemix account, to come up with a Managed Device that can be managed remotely using the Watson IoT Platform. Here, the Recipe details on the step by step process to register the Raspberry Pi Device to the WIoTP as a Managed Device and how you can now manage the Device by performing the following through the WIoTP Dashboard:
  • Manage
  • Firmware Update
  • Device Reboot
  • Location Update
  • Diagnostic update
  • Unmanage
The sample code for this recipe is written using the Java Client Library for IBM Watson IoT Platform and is made available on Github, which can be either downloaded directly or cloned to the target systems.





Firmware Management using IBM Watson IoT Platform


In this ever growing digital market, the gadgets, devices, sensors, actuators, etc are being built to be smarter, act independently and be part of the interconnected world. This growing trend is well appreciated.

With the emergence of different players, availability of digital equipment & software, the adoption of the technology to make things automated, yet keep it simple, has increased multi-folds over a period of time. Keeping yourself updated with the cutting edge technologies, ensuring your offering is up to date with the latest technologies and keeping up with the pace of the competition, has been the need of the hour, to survive in this competitive world.

Releasing a product / offering to the market is only the beginning. All the efforts put in, till the time of release, will go in vain, if the product fails to upgrade itself, provide bug fixes, add new features to meet the latest requirements and catch up with emerging trends. This is where, Firmware Management proves to be tricky, critical for sustainability and yet plays a crucial role in the success of the product / offering.

There are many players, who handle Firmware Management in different ways. Server pushing the updates to the Client devices (Ex: App updates to Smartphones, Set-Top boxes, etc), Client requesting the Server for updated software (OS updates, patches, Anti-Virus updates, etc), and few more are various means of handling updates. Over The Air (OTA) is one of the most adopted mechanism to distribute the software and perform the updates.

The Device Management feature enhances the IBM Watson IoT Platform (WIoTP) service with new capabilities for managing devices. These were detailed out in the blog post Device Management using IBM Watson IoT Platform.

Continuing the discussion on Device Management, this blog post highlights the Advanced Device Management features:

  • Firmware Update
  • Firmware Roll Back 
  • Factory Reset



Firmware Update:
In the earlier section, we had referred to Firmware Management scenarios, being initiated by Server and by Client. Two of the Watson IoT Recipes, depict both the scenarios in detail.

The Watson IoT Recipe 'Device Initiated Firmware Upgrade' refers to the scenario, where a Device is registered to WIoTP as a managed device. The Device keeps publishing the events to the Platform Dashboard. Here, the Device keeps snooping the defined Firmware Repository at regular intervals. If the Firmware Repository has a newer release, then, the Device initiates Firmware Upgrade operation. The source code for the same is written in Java and is made available on the Github repository.

Another Watson IoT Recipe 'Platform Initiated Firmware Upgrade', refers to the scenario in continuation with the setup of 'Device Initiated Firmware Upgrade', with the Application now connected to the WIoTP as well. The Application subscribes to the events published by the Device and publishes the commands to be executed on the Device, through the WIoTP.

Here, the Application snoops the Firmware Repository at regular intervals, to check, if a newer version of Firmware is available. If yes, then, the Application initiates the Firmware Upgrade operation and triggers the command to the Device, through the WIoTP. As the operation progresses, the events published by the Device are subscribed by the Application for it's consumption. The source code for the same is written in Java and is made available on the Github repository.

Firmware Roll Back & Factory Reset:

The above section helped you with Firmware Upgrade scenarios, both from Device side and from the Platform side. While it is important to upgrade the Device(s) to the latest available Firmware, the operation may not always complete successfully, owing to a lot of components (Network failure, poor bandwidth, inadequate space, forced and unforced aborts, etc) that influence the outcome. In such cases, the priority is to retain the existing setup intact, without any loss to the data and configurations. In case of corrupt systems, a facility that allows you to start all over again, will be of great help.

The Watson IoT Recipe 'Roll Back & Factory Reset' walks you through both the scenarios and helps you to be better equipped to handle the failed upgrade scenarios. The Recipe showcases, how you can safely put back the current setup in case of a failed upgrade and how to handle a scenario, where the setup is completely corrupt ( numerous changes to the configurations and cases where you are unable to perform Roll Back operation) using the Factory Reset. The source code on the Github repository  is written in Java and should give you a glimpse into the source code part.

Conclusion:

This series on Device Management in WIoT Platform, split in three recipes, successfully showcased the Firmware Update scenarios, by having them demonstrated with step by step process in the following set of Watson IoT Recipes: