In my previous post I connected a Raspberry Pi to IBM Watson IoT platform now I’m going to show a Raspberry Pi as managed device to IBM Watson IoT Platform
I my first prototype I used the Quickstart connection to connect the device to platform and the steps are very very simple. To explore and make use of full capabilities of Watson IoT Platform it is necessary to register and to setup the device. You can read this article about how to register the device in IBM Watson Internet of Things Platform. When you register a device you can send commands to Raspberry device, for example you can reboot the device. To do this you can use a node-RED flow with the IBMIoT node.
The IBMIoT node is an “inject” node and where you can configure the event type and the data that contains the json format of a command, to reboot in a second the Raspberry the command is “{“d”:{“reboot”:1}}”.
An another way to send command to an IoT device is by the device management feature. The device management feature enhances the IBM Watson IoT Platform service with new capabilities for managing devices. For example for Raspberry Pi by the IoT platform you can use this feature to:
- Firmware Update
- Device Reboot
- Location Update
- Diagnostic update
You can read the complete documentation for detailed information about IBM Watson IoT Platform device management capabilities.
The managed devices have to contain a management agent which can understand the Internet of Things Foundation Device Management Protocol, and send a Manage Device request to the IoT Foundation Device Management server.
The Device Management Protocol defines a set of supported operations. A device management agent can support a subset of the operations, but the Manage device and Unmanage device operations must be supported. A device supporting firmware action operations must also support observation.
The Device Management Protocol is built on top of MQTT. In my Raspberry I installed the Java Client Library for IBM Watson IoT Platform .
In order to become a managed device you can follow these steps:
- connect by ssh you Raspberry Pi
- clone the IBM iot-device-samples project using git clone:
git clone https://github.com/ibm-messaging/iot-device-samples.git
- run the maven build:
run sudo apt-get install maven cd iot-device-samples\java\device-management-sample mvn clean package
- Modify the DMDeviceSample.properties file present under target/classes directory structure by entering your device information and registration details like Organization ID, Device Type, Device ID, Authentication Method and Authentication Token
## connectivity parameters Organization-ID = <Your Organization ID> Device-Type = <Your Device Type> Device-ID = <Your Device ID> Authentication-Method = token Authentication-Token = <Your Device Token>
Run the Device Management sample agent by specifying the following command:
mvn exec:java -Dexec.mainClass="com.ibm.iotf.sample.devicemgmt.device.SampleRasPiDMAgent"
Observe that the device connects to IBM Watson IoT Platform and lists down various device management operations that the sample agent can perform.
- type “manage” with an optional lifetime parameter (in seconds) to become a managed device:
manage 3600
Now in action menu you can initiate an action:
and you can reboot you device 🙂
Your Feedback is Welcome.
Newsletter
Get the next essay before it goes out anywhere else.
New essays and each new field guide, by email. Free, no ads, one-click unsubscribe.
Field guides only? Choose your list.
-
Book · Technology Culture
What Kirkus Reviews Said About My Book, Including the Part I Agree With
Kirkus Reviews has read Who Owns Memory Owns the Future and filed its verdict: Get It. The praise is welcome. The criticism is the more useful half.
-
Essay · Technology Culture
Will AI Replace Programmers? What Three Waves of Automation Taught Me
No, and yes. AI will not replace the programmer; it is replacing most of what programmers spent their day typing. I have watched this happen twice before, at IBM and in the cloud years. Here is what changed each time, and what to do now.
-
Explainer · Data & AI
What Is an AI Agent, Really? Agentic AI Explained Beyond the Buzzword
An AI agent is software that pursues a goal by deciding, acting through tools and checking the result, in a loop. Most of what is sold as agentic AI is not that. Here is the test, and what makes agents work in production.
-
Essay · Data & AI
12 Books on Data and Power
Twelve books, eleven from Wired’s seasonal thirty plus one of my own, on how compute, data and the state became one conversation.


