Overview

Skill Level: Intermediate

This recipe sends telemetry data (location, speed, altitude, battery information) from an operational Aerialtronics Zenith drone directly to an instance of the Watson IoT platform. Thumbnails of images taken in flight are also sent in realtime to Cloudant

Ingredients

  • Altura Zenith v1.2 with IBM leg update (with companion computer).
  • Instance of Watson IoT platform. 

The Altura Zenith v1.2 and all related products are offered globally by Aerialtronics and its distributor network. Please contact sales-ibm@aerialtronics.com for orders and inquiries about the Zenith and the ‘IBM leg’ hardware update, which ensures compatibility with IBM’s Watson IoT platform.

Step-by-step

  1. Setup Bluemix Iot service for connecting the drone.

    To create a new Iot platform service, follow the instructions below: 

    1. Log into Bluemix account
    2. Click Catalog in the top menu.
    3. Select Internet of Things Platform services.
    4. And click “Create” to create a new servies. This will create a new instance of Iot service platform. 
    5. Observe a welcome page to launch the service. Click “launch” to enter into the iotf service space. 

    This will lead to the watson iotf platform dashboard page as shown below: 

     

    The next step is to create a device type. Device types are intended to be groups of devices which share common characteristics. So in order to add devices in IBM Watson IoT Platform, one need to create a device type. Follow the instructions below to create a device type from the iot platform dashboard. 

    For a detailed set of instructions on creating a new data type and adding a new device, consult: 

    https://developer.ibm.com/recipes/tutorials/how-to-register-devices-in-ibm-iot-foundation/

     

    In summary:

    Create a device type:

    1. From the iot platform dashboard, click “devices”. 
    2. Choose “Device types”.
    3. Click “Create device types”. 
    4. A new panel opens for the creating device type. Choose “Create device types”. 
    5. Provide a name for the device type and click next. 
    6. The next set of tabs are optional and need not be modified for now. Click submit to finish the creation of device types.

    Add a new device:

    1. From the iot platform dashboard, click “Add device”.
    2. Choose the device type that was created in the previous set of instructions. 
    3. Provide an unique id for the device and create the new device. 

     

    Once a new device has been created, the credentials for the devices will be generated. These credentials will be used by the device ( in our case the drone) to connect to the cloud. 

    The companion computer is preconfigured to use embedded c MQTT client libraries to connect, publish, and subscribe to the IoT service (using the device credentials). No further action is required on the side of the drone to configure the connection.

    So, the drone is connected as any other device would connect to the IoT platform. 

  2. Cloud side application in Bluemix

    Create Node Red based dashboard to display the telemetry data and thumbnail:

    1. To create a Node Red instance: From dashboard->catlogs->Boilerplates->nodered appication 
    2. Configure the IoT node to receive telemtery data from the registered drone. 
    3. Use IoT node to extract the data uploaded by the drone. 
    4. Use contribui set of nodes to make a simple dash board to display telemetry data and thumbnails.

     

    The above set of instructions would help us to create a node red flow as displayed below. And the code given in the bottom can be used to import the flow into another node red instance. 

     

    Node-red-Sample-1

     

    [{"id":"df457a67.680bc8","type":"ibmiot in","z":"1912136b.e6644d","authentication":"boundService","apiKey":"","inputType":"evt","deviceId":"","applicationId":"","deviceType":"+","eventType":"+","commandType":"","format":"json","name":"IBM IoT","service":"registered","allDevices":true,"allApplications":"","allDeviceTypes":true,"allEvents":true,"allCommands":"","allFormats":true,"qos":"1","x":98,"y":399,"wires":[["bec8ac83.7e165","bca822b6.34fa2","db494fd0.00bc6","ede8cfd7.7bc3e","b2cb2027.16fe6","8e2abb3.c6a9248","357c0265.24ed3e","b876667d.b66348","1681775c.622579"]]},{"id":"ede8cfd7.7bc3e","type":"debug","z":"1912136b.e6644d","name":"","active":true,"console":"false","complete":"true","x":995,"y":400,"wires":[]},{"id":"bec8ac83.7e165","type":"function","z":"1912136b.e6644d","name":"","func":"msg.payload=msg.payload.Zenith.lat;\nreturn msg;","outputs":1,"noerr":0,"x":416,"y":555,"wires":[["fcc21cb2.cb274"]]},{"id":"fcc21cb2.cb274","type":"ui_text","z":"1912136b.e6644d","tab":"ef845769.de5e98","name":"GPS Latitude","group":"Telemetry","order":"5","format":"{{msg.payload}}","x":588,"y":553,"wires":[]},{"id":"db494fd0.00bc6","type":"function","z":"1912136b.e6644d","name":"","func":"msg.payload=msg.payload.Zenith.heigth/100;\nreturn msg;","outputs":1,"noerr":0,"x":414,"y":673,"wires":[["fb3e6daf.38c31"]]},{"id":"fb3e6daf.38c31","type":"ui_text","z":"1912136b.e6644d","tab":"ef845769.de5e98","name":"GPS Altitude","group":"Telemetry","order":"7","format":"{{msg.payload}} m","x":615,"y":672,"wires":[]},{"id":"bca822b6.34fa2","type":"function","z":"1912136b.e6644d","name":"","func":"msg.payload=msg.payload.Zenith.lon;\nreturn msg;","outputs":1,"noerr":0,"x":415,"y":613,"wires":[["55d32fc1.de8a6"]]},{"id":"55d32fc1.de8a6","type":"ui_text","z":"1912136b.e6644d","tab":"ef845769.de5e98","name":"GPS Longitude","group":"Telemetry","order":"6","format":"{{msg.payload}}","x":599,"y":613,"wires":[]},{"id":"b2cb2027.16fe6","type":"function","z":"1912136b.e6644d","name":"","func":"msg.payload=msg.payload.Zenith.sats;\nreturn msg;","outputs":1,"noerr":0,"x":415,"y":723,"wires":[["c8f77540.8d0158"]]},{"id":"c8f77540.8d0158","type":"ui_text","z":"1912136b.e6644d","tab":"ef845769.de5e98","name":"GPS Satellites","group":"Telemetry","order":"8","format":"{{msg.payload}}","x":612,"y":723,"wires":[]},{"id":"8e2abb3.c6a9248","type":"function","z":"1912136b.e6644d","name":"","func":"msg.payload=msg.payload.Zenith.bat/1000;\nreturn msg;","outputs":1,"noerr":0,"x":414,"y":770,"wires":[["193a6275.6468ee"]]},{"id":"193a6275.6468ee","type":"ui_text","z":"1912136b.e6644d","tab":"ef845769.de5e98","name":"Battery","group":"Telemetry","order":"9","format":"{{msg.payload}} V","x":584,"y":770,"wires":[]},{"id":"357c0265.24ed3e","type":"function","z":"1912136b.e6644d","name":"","func":"msg.payload=\"Zenith 12\"\nreturn msg;","outputs":1,"noerr":0,"x":422,"y":418,"wires":[["2d03c047.a11cb"]]},{"id":"2d03c047.a11cb","type":"ui_text","z":"1912136b.e6644d","tab":"ef845769.de5e98","name":"VehicleID","group":"Telemetry","order":"1","format":"{{msg.payload}}","x":592,"y":418,"wires":[]},{"id":"b876667d.b66348","type":"function","z":"1912136b.e6644d","name":"","func":"if(msg.payload.Zenith.jobid == 0)\n{\n msg.payload= 122790;\n}\nelse\n{\nmsg.payload=msg.payload.Zenith.jobid;\n}\nreturn msg;","outputs":1,"noerr":0,"x":421,"y":461,"wires":[["7d1c45f2.c75e5c"]]},{"id":"7d1c45f2.c75e5c","type":"ui_text","z":"1912136b.e6644d","tab":"ef845769.de5e98","name":"JobID","group":"Telemetry","order":"2","format":"{{msg.payload}}","x":581,"y":461,"wires":[]},{"id":"1681775c.622579","type":"function","z":"1912136b.e6644d","name":"","func":"msg.payload=\"Mast Inspection\";\nreturn msg;","outputs":1,"noerr":0,"x":417,"y":507,"wires":[["2e965aeb.2eebe6"]]},{"id":"2e965aeb.2eebe6","type":"ui_text","z":"1912136b.e6644d","tab":"ef845769.de5e98","name":"JobDesc","group":"Telemetry","order":"3","format":"{{msg.payload}}","x":587,"y":507,"wires":[]},{"id":"ef845769.de5e98","type":"ui_tab","z":"","name":"Home","icon":"dashboard","order":"1"}] 

Join The Discussion