Skill Level: Any Skill Level

For anyone with a basic knowledge how to install an Android application from Google Play

This recipe describes how to use an Android smartphone as an IoT gateway to the IBM Watson. Use different Sensors (integrated, wired, wireless), Virtual sensors (algorithms), Triggers, Actions or your own extensions.


  • IBM bluemix account
  • Android device with the latest¬†IoTool¬†application



  1. About IoTool

    IoTool, a multi-awards winning smartphone gateway and API allows IoT researching and fast prototyping with minimal costs in domains: IoT, eHealth, sport&wellnessI4.0, HomeAutomation, Industry 4.0 and Logistics.

    Currently IoTool supports more than 100 different sensors with more than 258 sensor readings (like, Arduino, Bosch XDK, Internal Smartphone, TI SensorTag and similar), 50 actuators (like Arduino, Lifx and similar) and different types of triggers connected to ordinary smartphone through a very flexible extensions system. Any new sensor, action, actuator, algorithm, trigger or cloud sync uses its own extension (similar like printer drivers). External developers can develop their own extension (usually extension can be made in hours) and their own UI for any type of IoT solutions.

    IoTool works on Android devices (phone, tablet, Android TV, Raspberry PI with Android OS installed). IoTool on smartphone can process (collect, encrypt, store, show values and diagrams, sync to Cloud) up to 24.000 records per second, for example 12 lead ECG with 2000Hz from each lead.

    IoTool modules:

    dashboard_nav_dark Dashboard



    sensors_nav_dark Sensors and virtual_sensors_nav_dark Virtual sensors (algorithms)



    messages_nav_dark Messages



    triggers_nav_dark Triggers, actions_nav_dark Actions and recipes_nav_dark Recipes

    Download Download



    cloud_nav_dark Cloud


  2. IoTool installation

    • Register and Login to IoTool.io
    • Select extensions needed for a project


    • Download IoTool.apk (link is on iotool.io main page)
    • Select and download sensor extensions (iotool.io / EXTENSIONS / SENSORS) to your smartphone. If you wish to use only internal Android sensors, use “Android sensors – Service: Device internal”.


  3. IoTool setup and test

    • Read the User manual (iotool.io / SUPPORT / USER MANUALS / IoTool User manual) and setup sensors and IoTool dashboard to get wished Sensor readings.
    • NOTE: all selected Sensor readings from IoTool dashboard will be sent to IBM Watson.
    • After dashboard START is pressed, you should get all selected Sensor readings to the IoTool dashboard in real-time.


  4. Setting up your Bluemix IoT service

    • Login into your Bluemix account.
    • In the top menu select¬†catalog.
    • Find service named ‚ÄúInternet of Things Platform‚ÄĚ and click on it.
    • Name your service, click¬†create¬†service and follow this recipe to register your device in IBM Watson IoT Platform.




    • Note down the connection parameters.

    Example: my connection parameters

    • Hostname:¬†ssl://jlhg2r.messaging.internetofthings.ibmcloud.com

    // do not forget prefix ssl!

    • Username:¬†use-token-auth
    • Password: *************
    • Client identification:¬†d:jlhg2r:Android:frogec
    • Topic:¬†iot-2/evt/accel/fmt/json
    • Port: 8883





  5. IoTool IBM Watson IoT Cloud extension download and synchronization settings

    Iotool Synchonization settings

    In the later steps we will modify IoTool settings to match with IBM connection parameters for your device. You can find settings if you open navigation drawer in your IoTool app -> Settings -> Synchronization-> IBM Watson IoT Settings. Note that in Synchronization settings both Use synchronization and Send data must be checked and IBM Watson Iot service selected.

    Connection parameters

    The following information is required when connecting your device:

    • URL: ssl://org_id.messaging.internetofthings.ibmcloud.com
      Where org_id is the ID of your Watson IoT Platform organization (same as in step 4).
    • Port:8883
    • Device identifier: d:org_id:device_type:device_id
      This combination of parameters uniquely identifies your device.
    • Username: use-token-auth
      This value indicates that you are using token authorization.
    • Password: Authentication token
      This value is the unique token that you defined or that was assigned to your device when you registered it.
    • Event topic format: iot-2/evt/event_id/fmt/format_string
      Where the event_id specifies the event name that is shown in Watson IoT Platform, andformat_string is the format of the event, such as JSON.
    • Message format: JSON
      Watson IoT Platform supports several formats, such as JSON and text.

    You can read more about connecting devices here.

    Path to settings






  6. Start and test dashboard and communication

    START a dashboard. To make sure that service is running, check your notification bar


    and IoTool monitor


    Collected Sensors readings should be synced to IBM Watson.

32 comments on"Use IoTool and a smartphone as an IoT gateway to IBM Watson IoT"

  1. HafizhIzzaturrahim November 09, 2016

    IoTool IBM Watson IoT Cloud extension not available in my country ( Indonesia). please fix it.. thanks

  2. JureLampeSenLab November 09, 2016

    Thank you. It should work now. If not, please try with a direct link: https://play.google.com/apps/testing/io.senlab.iotool.extension.ibmwatsoncloud

    In case of any problems, please do not hesitate to contact me directly: support@iotool.io


  3. subhankar_ibm November 20, 2016

    I am setting up the iotool to connect to BlueMix IoT.
    No data is received and the dashboard also shows no graph. I am trying to fetch the accel data.

    • subhankar_ibm November 20, 2016

      Also when I see the io tool monitor it says “No more data found”

    • subhankar_ibm November 20, 2016

      Mobile : Lenovo Vibe X3 running Android Marshmallow

    • subhankar_ibm November 20, 2016

      Got it to work somewhat after restarting my phone but the sync rate has issues. I have tried setting it at 1s and 5s but the received data there is a huge delay:

      Event Format Time Received
      accel json 21-Nov-2016 2:47:18 am
      accel json 21-Nov-2016 2:49:04 am

      • Hello, we tried to reproduce this problem. The only thing we can think of is the connection issue on your side. Everything seems to work on our side. We’ve got different intervals but the difference is only 1 or 2 seconds max. There is a possibility you left the phone in sleep mode which can also prevent sending data, but it’s highly unlikely. It would be also helpful if you could provide the screenshot of the Sync settings and IBM Watson settings, to see if we can reproduce it with same settings.

  4. Excellent recipe. Thanks very much Jure!

    • You are very welcome. Please note: you can send any sensor signal – IoTool installed on a modern smartphone can collect, encrypt, store, replicate (send to cloud) .. a lot of data. However if you send all that data to IBM Watson using MQTT you need to calculate and optimize the cost of it and pack more sensor readings into one MQTT message. But that is a part of (maybe) future recipe.

  5. 0VMJ_Ratul_Das January 13, 2017

    Hi Jure,
    Whenever the datat tries to upload to the IBM Watson IoT Platform I see the following error :
    Connection to the server failed
    dmjd40.messaging.internetofthings.ibmcloud.com, user=use-token-auth,server answer=failed

  6. Hello Ratul
    We’ve just tried all procedure again with a current IoTool version and personal account and it works for us.
    This error simply tells that it could not sent data because it failed the authentication. This error appears every time there is a connection problem or when values in the settings are incorrect. It would be very helpful, if you could send us these parameters to see if the problem is there.

  7. same issue here, I have the following settings:
    hostname : u243oh.messaging.internetofthings.ibmcloud.com
    port : 1883
    username : use-token-auth
    password : token entered during creation of device in watson
    client identification : d:u243oh:iotool-devicetype:iotool-jackmob
    topic : iot-2/evt/accel/fmt/json

  8. Does it work with an iotool free account? Or is personal the minimum needed

    • Hi Gembanl

      I have looked at you credentials you have sent me and there are some things that we need to fix.

      First of you need to add the prefix “ssl://” to you hostname so that it looks like this:

      Second, you need to change the port number to 8883 (because the connection with prefix “ssl://” is encrypted).

      As for your question, you do not need IoTool account to send data to IBM cloud, you only need IBM Watson account.

  9. Hi !
    If I want visualize the data on bluemix/watson IBM, it’s possible ? I tried on https://quickstart.internetofthings.ibmcloud.com/#/ with my device ID but it does not work. Is there any solution ?
    Thank you very much !

  10. Hi I have done all the steps still it says connection to the server failed. I am also confused about the Event_id

  11. And I have another question. How can I connect directly to the quickstart.internetofthings.ibmcloud.com

  12. tazwar2700 March 01, 2017

    In my connection log I see this message: Invalid userID (a-9iw4sr-mxzrbndrt6) for device auth: ClientID=’d:9iw4sr:magurtazwar:magurbhai’, ClientIP=

    • Jure Lampe March 03, 2017

      Hello. It seems that you may have set username to a-9iw4sr-mxzrbndrt6. That is a wrong value. Set it to “use-token-auth” (without the ” symbol).

  13. zishan6505 March 06, 2017

    How can I connect directly to the quickstart.internetofthings.ibmcloud.com. I want to use it as an input node in the node red platform.

  14. zishan6505 March 08, 2017

    Can I choose my Event_Id arbitrarily?

  15. Hello, I have a problem with server connection. I get the message: connection to server failed: ssl://penf51.messaging.internetofthings.ibmcloud.com, user=use-token-auth, server answer = failed

    my settings are:
    hostname= ssl://penf51.messaging.internetofthings.ibmcloud.com
    port = 8883
    username = use-token-auth
    password= disaster (thats what i used as token authorization)
    client identification= d:penf51:Android:Phone-1
    topic= iot-2/evt/accel/fmt/json

    Any help would be great. Thank you.

    • Hi there. With settings like these and correctly entered IDs everything should generally be functioning.
      I presume that you have set up your device type template as “Android” in Watson IoT, and named the device itself “Phone-1”? The client identification string should look like d:::
      Can you please provide the connections logs from Watson IoT? You shold be able to find them under Devices -> your device ID (in the table) -> Logs.

  16. I changed the client identification to d::: however the logs did not change.
    I changed the client identification back to d: and the logs did change shown below

    Invalid userID () for device auth: ClientID=’d:penf51:Android:Phone-1′, ClientIP=(removed)

    • Invalid userID () for device auth: ClientID=‚Äôd:penf51:Android:Phone-1‚Ä≤, ClientIP=(removed)
      This message is repeated multiple times with the timestamp

      • I’m sorry, it seems the system removed some things from the identification string I posted. It should look like d:ORG_ID:DEVICE_TYPE:DEVICE_ID
        Your ORG_ID would be penf51, DEVICE_TYPE and DEVICE ID should match what you see in your own version of the second picture in step 4.

        • I am using the matching device type and device id


          However, i still get an invalid userID() for device auth:
          Mesdgae in my logs

  17. Hello, when i create device in Iot platform as type=Gateway. Then not connected to IBM Iot . my settings are:
    hostname= ssl://t2oecx.messaging.internetofthings.ibmcloud.com
    port = 8883
    username = use-token-auth
    password= gateway11 (thats what i used as token authorization)
    client identification= d:t2oecx:gate:gate1
    topic= iot-2/evt/gate/fmt/json
    But as type=Device, it’s ok.

Join The Discussion