Skill Level: Intermediate


Architecture Setting up the DroneUnpack the AR Drone from the package.Place the drone on a flat surface and connect the battery. The AR Drone will run a self diagnostic. After a few seconds, propellers will flicker one by one. After this, if all the lights under the propellers are green, you are good to go. […]


  1. Architecture

  2. Setting up the Drone

    1. Unpack the AR Drone from the package.
    2. Place the drone on a flat surface and connect the battery.

    3. The AR Drone will run a self diagnostic. After a few seconds, propellers will flicker one by one. After this, if all the lights under the propellers are green, you are good to go.

    4. The drone will create a WiFi network whose name starts with ardrone2, followed by an ID.
    5. Now connect to this WiFi, from your WiFi enabled device(Laptop/Raspberry Pi)

    NOTE : Use another network interface to maintain connection to the internet. You can use a Ethernet cable or have another WiFi Interface. You will need internet to connect to IBM Bluemix

  3. Setting up Bluemix

    For this tutorial you will need to setup the Watson IoT Platform, Cloudant NoSQLDB & Node-RED services. Also, this tutorial tweets the picture captured from the Drone, so you will need to generate the keys from Twitter as well.

    Click on the Create Toolchain button provided below, to quickly deploy the Watson IoT Platform, Cloudant NoSQLDB and the Node-RED service as part of the Bluemix starter app. Post successful deployment, you can directly access the Node-RED application using the View App link.


    Note: If you are a User using the United Kingdom Region in your Bluemix environment, then please make use of the steps mentioned in the IoT Recipe Deploy Internet of Things Platform Starter service on Bluemix to deploy the setup. Alternatively, you can also try using the Deploy to Bluemix button, to deploy the setup under your United Kingdom Region, provided your Jazzhub account is validated. Users of US South Region can ignore this step.


    Watson IoT Platform

    Open the Bluemix Dashboard and click on the Application service that you have currently deployed (using the Create Toolchain button), if you have already moved away from it. You should see the Watson IoT Platform listed under the Binded Services. Click on the WIoTP service and choose the click on Launch button to launch the WIoTP Dashboard.

    For registering the drone in the Watson IoT Platform, follow this recipe which will help you to

    1. Create Watson IoT service
    2. Go to the Watson IoT Dashboard
    3. Create a Device Type – For this tutorial, you can name it “Drone
    4. Create a Device – For this tutorial, you can name it “Drone1“.

    Note down the device credentials that you get in the last screen of the device registration.

    After finishing How to Register Devices in IBM Watson IoT Platform recipe, next we will capture the Cloudant credentials.


    Similar to accessing the Watson IoT Platform dashboard, access the Cloudant NoSQLDB dashboard from the deployed Application. Note down the Cloudant credentials – Username and Password. You can get these values from the service entry under the Connections section of the application.


    You will need the following of properties for your application to use Twitter:

    1. Consumer Key
    2. Consumer Secret
    3. Access Token
    4. Access Token Secret


    Follow the steps below to create Twitter Keys

    1. Go to https://apps.twitter.com/
    2. Click on Create New App.
    3. Enter the Name, Description and Website. Callback URL is not needed.
    4. Click on Create your Twitter Application. Your Twitter applicaation will be created.
    5. Go to Keys and Access Tokens tab to get the Tokens
    6. Note down the Consumer Key and Secret.
    7. Next, we will create the Access Tokens, go to the Your Access Tokens section and click on Create my Access Token.
    8. Now note down the Access Token and Secret.


    Now we have setup the Bluemix services and Twitter, Next we will learn how to setup the code on the local machine.

  4. Setup the Drone Gateway

    In this step, we will set up the Gateway for connecting to the Drone. You can use your Laptop/Mac/Raspberry Pi.

    Note : You must install ffmpeg in the gateway machine. FFmpeg is needed for using the camera in Drone.


    1. Git clone the repository in your local gateway.
      $ git clone https://github.com/ibm-watson-iot/iot-drone.git
    2. Install the dependencies using npm. Run the following command
      $ cd iot-drone
      $ npm install
    3. Now all the dependencies are installed.
    4. Edit the configuration file config.json with the credentials you copied in the previous step.
    5. {
      "iotconfig": {
      "org": "xxxxx",
      "id": "drone1",
      "type": "drone",
      "auth-method": "token",
      "auth-token": "xxxxxxxxxxx"
      "twitConfig": {
      "consumer_key": "<GENERATE FROM APPS.TWITTER.COM>",
      "consumer_secret": "<GENERATE FROM APPS.TWITTER.COM>",
      "access_token_key": "<GENERATE FROM APPS.TWITTER.COM>",
      "access_token_secret": "<GENERATE FROM APPS.TWITTER.COM>"
      "cloudantConfig": {
      "user": "xxxxxxxxx-bluemix",
      "password": "xxxxxxxxxxxx",
      "dbName": "drone"
    6. Update the device your registered in Watson IoT in the iotconfig section. And update your twitter credentials in the twitConfig section. Also, update the cloudant credentials in the cloudantConfig.
    7. Run the program
       $ node drone-controller


    Now this program does the following

    1. Sends Drone statistics events to Watson IoT E.g : isFlying, battery
    2. Listens for commands from Watson IoT. It listens for Takeoff, land, tweet commands from the Watson IoT platform
    3. Sends images to Cloudant DB every 2 seconds.


    Now you have finished the setup in the Gateway. Next you will learn how to send commands from a Node-RED application to Take Off, Land and Tweet

  5. Node-RED application

    You will use the following Node-RED flow to control the drone. Open your Node-RED Dashboard. You can run Node-RED editor that you have deployed using the Create Toolchain option ( or have a local set up on one of your servers or laptop/desktop machines).

    Access the Node-RED editor directly by accessing the following URL

    1. Click on Menu -> Import -> Clipboard.


    2. Paste the following JSON.
      "id": "e33f33fe.dc5f4",
      "type": "inject",
      "z": "11031ce.f0cd9e3",
      "name": "Takeoff",
      "topic": "",
      "payload": "true",
      "payloadType": "bool",
      "repeat": "",
      "crontab": "",
      "once": false,
      "x": 259,
      "y": 164,
      "wires": [
      ["b0174eab.be8ec8"] ]}, {
      "id": "4a652348.45e7d4",
      "type": "inject",
      "z": "11031ce.f0cd9e3",
      "name": "Land",
      "topic": "",
      "payload": "true",
      "payloadType": "bool",
      "repeat": "",
      "crontab": "",
      "once": false,
      "x": 255,
      "y": 248,
      "wires": [
      ["881b0e2.53cfa7"] ]}, {
      "id": "6498eccb.f6e8f4",
      "type": "ibmiot out",
      "z": "11031ce.f0cd9e3",
      "authentication": "apiKey",
      "apiKey": "",
      "outputType": "cmd",
      "deviceId": "drone1",
      "deviceType": "drone",
      "eventCommandType": "default",
      "format": "json",
      "data": "{}",
      "qos": "",
      "name": "IBM IoT App Out",
      "service": "registered",
      "x": 729,
      "y": 250,
      "wires": []}, {
      "id": "b0174eab.be8ec8",
      "type": "function",
      "z": "11031ce.f0cd9e3",
      "name": "TakeOff",
      "func": "msg.eventOrCommandType = \"TakeOff\";\nreturn msg;",
      "outputs": 1,
      "noerr": 0,
      "x": 409,
      "y": 164.5,
      "wires": [
      ["6498eccb.f6e8f4"] ]}, {
      "id": "881b0e2.53cfa7",
      "type": "function",
      "z": "11031ce.f0cd9e3",
      "name": "Land",
      "func": "msg.eventOrCommandType = \"Land\";\nreturn msg;",
      "outputs": 1,
      "noerr": 0,
      "x": 402,
      "y": 247,
      "wires": [
      ["6498eccb.f6e8f4"] ]}, {
      "id": "f20dff4e.19e57",
      "type": "function",
      "z": "11031ce.f0cd9e3",
      "name": "Tweet",
      "func": "msg.eventOrCommandType = \"Tweet\";\nmsg.payload = \"This is from Node - RED \";\nreturn msg;",
      "outputs": 1,
      "noerr": 0,
      "x": 402,
      "y": 331,
      "wires": [
      ["6498eccb.f6e8f4"] ]}, {
      "id": "5c658845.3be46",
      "type": "inject",
      "z": "11031ce.f0cd9e3",
      "name": "Tweet",
      "topic": "",
      "payload": "true",
      "payloadType": "bool",
      "repeat": "",
      "crontab": "",
      "once": false,
      "x": 255,
      "y": 330,
      "wires": [
      ["f20dff4e.19e57"] ]}]
    3. Click OK.
    4. Your flow in Node-RED should look like below.
    5. Now we need to add the credentials of the Watson IoT. Double click on IBM IoT App Out.
    6. Now add your Watson IoT credentials in this node. Click on the pencil icon to add the credentials.
    7. You need you API-KEY and API-TOKEN of your IBM Watson IoT organization.
    8. Click Add.
    9. If You have changed the name of the device registered, now you can edit the Device Id and Device Type, else you do not have to edit any other property and Click OK.
    10. Click Deploy. (On the top right corner)
    11. Now the flow is active.


    You can now play with Drone with commands sent from this Node-RED.

  6. Conclusion

    In this tutorial you have learnt how to connect AR Parrot Drone with IBM Watson IoT. And also how to control it remotely with Node-RED.

7 Comments on "Control your Drone using IBM Watson IoT"

  1. villeingman October 05, 2016

    Thumbs up guys for taking this further on the next level 🙂

  2. I cannot import the Node-red JSON code. Anyone else having the same problem?

  3. AndyJackson January 17, 2017

    Are there any specific settings from the network perspective on a windows 7 machine that I should be aware of? I cannot get it work and believe it is related to the network or being connected to two netowrks… For reasons to long to type here. I have tried bridging the drone wifi and my wired Ethernet connection, but nothing seems to work.

    • Jeffrey Dare January 19, 2017

      Yes, you will need to use 2 different network interface to get this to work.. One for Drone and one for internet(from ethernet). And you need to assign the priority of the internet(ethernet) network interface higher than Drone network interface.

  4. pravallika_pothuru June 07, 2017


    I tried to connect for two networks ethernet and drone wifi. But drone wifi is showing limited when i am connecting to laptop.Please let me what should I have to do.

Join The Discussion