Skip to Content
Author's profile photo Michael Ameling

Try out SAP Cloud Platform IoT Service with iOS Devices and Sensor Tags

What do you need to send data with an iOS device to the IoT Services?

 

 

Optional:

 

 

How to Send Data with the IoT Sensor App by itelligence AG?

 

Create a device model via IoT Service Cockpit

  1. Open the IoT Service Cockpit.
  2. Choose the Message Types tile.
  3. Create a new Message Type by clicking ( + ).
  4. Enter a name, e.g. “iOS Data”.
  5. Change the Data Type for timestamp to long.
  6. Enter the following fields depending on the device you are targeting (all fields are optional):
    • iOS Device: timestamp (long) / accX (double) / accY (double) / accZ (double) / altitude (double) / locLat (double) / locLong (double) / pressure (double)
    • TI Sensor Tag: timestamp (long) / sensorGyroX (double) / sensorGyroY (double) / sensorGyroZ (double), sensorAccX (double) / sensorAccY (double) / sensorAccZ (double) / sensorBarometric (double)
    • ublox OLP: timestamp (long) / sensorTemp (double) / sensorGyroX (double) / sensorGyroY (double) / sensorGyroZ (double)Screen Shot 2016-08-07 at 12.47.30.png
  7. Copy the displayed Message Type ID to your Clipboard.
  8. Go back to the IoT Service Cockpit.
  9. Choose the Device Types tile.
  10. Create a new Device Type by clicking ( + ).
  11. Enter a name, e.g.: “iOSDevice”, “TI CC2650” or “OLP 425” (depending on your available hardware).
  12. Add the Message Type that was previously created (here: “iOS Data”).Screen Shot 2016-08-07 at 12.51.40.png
  13. Copy the displayed Device Type ID and Device Registration Token to your Clipboard.Screen Shot 2016-08-07 at 12.55.52.png

 

You can now start sending data with a client using the created Message Type and Device Type.

 

Download and configure IoT Sensor App

 

  1. Install on your mobile device: IoTSensor on the App Store (iOS only)
  2. Configure the app with by calling the following custom URL on your device:
    • iot-create://&/accountName&/[Account ID]&/name&/[Connection Name]&/dataCenter&/[Data Center]&/deviceName&/[Device Name]&/deviceTypeID&/[Device Type ID]&/deviceReg&/[Device Registration Token]&/messageTypeID&/[Message Type ID]
    • Parameters:
      • [Account ID] => your account ID, e.g., “p1234567trail” (remark: not your user name)
      • [Data Center] => your account data center, e.g., “hanatrial” / “hana” / “us1.hana” / “us2.hana” / “ap1.hana”
      • [Connection Name] => any name for a connection, e.g., “myConnection”
      • [Device Name] => any name for the device, e.g., “iPhone Michael” / “Sensor Tag 1”
      • [Device Type ID] => the Device Type ID you copied previously to your clipboard
      • [Device Registration Token] => the Device Registration Token you copied previously to your clipboard
      • [Message Type ID] => the Message Type ID you copied previously to your clipboard
    • Sample: iot-create://&/accountName&/p000000trial&/name&/myTrialConnection&/dataCenter&/hanatrial&/deviceName&/iPhoneMichael&/deviceTypeID&/f807b43597e44cf1fc4b&/deviceReg&/ce89c5cfe7fdb25b381eff51136b97&/messageTypeID&/9208dd4b8cc54bc1fb1b
  3. Once the custom URL is launched the app starts and account will be configured.
  4. Press on Registration.
    Screen Shot 2016-03-22 at 10.34.59.png
  5. The “Device” gets registered and is ready to send Data. Press OK.
    Screen Shot 2016-03-22 at 10.35.28.png
  6. The “Connection” is now coloured red.
    Screen Shot 2016-03-22 at 10.52.44.png

 

Select Device and Send Data

 

  1. Press on Sensor.
    Screen Shot 2016-03-22 at 10.52.44.png
  2. Select a device (vor BLE device connection press refresh).
    Screen Shot 2016-03-22 at 10.54.08.png
  3. The device is not connect. Go back by pressing Select Source.
  4. Press Back. (Sensor and Connection are coloured red.)
  5. Press Record Button.
    Screen Shot 2016-03-22 at 10.54.23.png
  6. Data is sent according to sending interval (values that are not defined in the message type are ignored.)
    IMG_6740.png

 

Where do I see my Incoming Data?

 

IoT Message Management Cockpit

 

You can see your incoming data immediately via the MMS Cockpit.

  1. Open the IoT Service Cockpit.
  2. Choose the Send and view messages, or perform other actions tile. (The MMS Cockpit opens.)
  3. Choose the Display stored messages tile. (All tables of incoming data are listed.)
  4. Select the table that is named after the Message Type ID that you created previously (“T_IOT_<MESSAGE TYPE ID>”).
    Screen Shot 2016-03-23 at 12.32.58.png
  5. Press refresh to update the table. The latest values are on top.
    Screen Shot 2016-03-23 at 12.32.01.png

 

OData Consumption

 

The Message Management Service exposes the tables via OData as well (Documentation: SAP HANA Cloud Platform Internet of Things (IoT) Services).

 

  1. Open any browser.
  2. Copy the targeted table name to your clipboard. (see previous step)
  3. Enter the URL as follows:
  4. Remove the parameter “?$format=json” in case you want to consume the OData API in application, e.g., HTML5 Applications.

 

You can now start to consume the data in other applications.

 

 

How to write your own iOS App?

 

 

Additional Material?

 

 

Questions and Feedback?

We highly appreciate your questions or feedback. Please add your comments below.

Assigned Tags

      50 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hi Michael,

      Thanks for this blog. This is nice way to simulate if you don't have hardware available with you.

      I tried this but i am stuck at the registration step. It says Registration failed. This is the URL i launched. I am using hanatrail account.

      >iot-create://&/accountName&/p1941830575&/name&/myConnection&/dataCenter&/hanatrial&/deviceName&/iPhoneMayank&/deviceTypeID&/95a52fac0054f9dfc8f7&/deviceReg&/ab93c551c623cc048fa9412a942c7a&/messageTypeID&/ae475c6ceda8a38d4dab

      Author's profile photo Michael Ameling
      Michael Ameling
      Blog Post Author

      Thanks for the feedback. The account ID you used is not correct. Please always look in the HCP Cockpit for the correct account ID. In your case it should be "p1941830575trial".

      Author's profile photo Former Member
      Former Member

      Thanks, Still same error after using the correct account ID. Maybe i am missing something else.

      Author's profile photo Michael Ameling
      Michael Ameling
      Blog Post Author

      I tried changing the account ID by adding "trial". It worked fine for me. You should see a registered device.

      Author's profile photo Former Member
      Former Member

      Hi Micheal,

      Apologies for getting back late. Yes I can see a registered device with your Name in IoT Cockpit under Devices. I tired again now,but still I get the same "Registration Failed". I even deleted the app and re configured.

      iot-create://&/accountName&/p1941830575trial&/name&/myConnection&/dataCenter&/hanatrial&/deviceName&/iPhoneMayank&/deviceTypeID&/95a52fac0054f9dfc8f7&/deviceReg&/ab93c551c623cc048fa9412a942c7a&/messageTypeID&/ae475c6ceda8a38d4dab

      Author's profile photo Michael Ameling
      Michael Ameling
      Blog Post Author

      Hi Mayank,

      I just tried with your configuration and it works great when you change the device name. The error I get with you configuration is that you already created a device with this name. Therefore, you should either change the name or delete the device via the IoT Cockpit in the device tile. Please make sure that you have the latest version of the IoT sensor app as well.

      Best regards,

      Michael

      Author's profile photo Former Member
      Former Member

      Yes that was the problem, I changed the name and it got registered.

      This work perfectly fine now. I can see the data pushed to HCP from iPhone.

      Thanks a lot,

      Mayank

      Author's profile photo Michael Ameling
      Michael Ameling
      Blog Post Author

      Just updated the article with information how to consume the data via the MMS Cockpit and OData.

      Author's profile photo Former Member
      Former Member

      Hello Michael Ameling

      I have created Device Type & Message Type as per above article, Installed app " IoTSensor" on iPad, There are two options on the app Sensor and Connection. By clicking on Connection, New Connection opened. I filled the details as details got from cockpit on creating Device Type & Message Type respectively,i don't know why i am getting " Registration Failed" error. Could you please help me out.

      Thanks in advance.

      Regards,

      Pavan 

      Author's profile photo Michael Ameling
      Michael Ameling
      Blog Post Author

      Hi Pavan,

      can you please try again. There was an issue that got fixed. In case it still does not work please drop me an e-mail.

      Best regards,

      Michael

      Author's profile photo Former Member
      Former Member

      Hello Michael,

      I tried as you told, bit it could not resolved problem. Still it showing "Registraion Failed " . Could you please help me out ?

      Regards,

      Pavan

      Author's profile photo Michael Ameling
      Michael Ameling
      Blog Post Author

      Hi Pavan,

      it seems that the Registration Token or the account is not setup properly. Can you please share a screenshot of your settings via mail (in order not to share any credentials via SCN).

      Thanks, Michael

      Author's profile photo Former Member
      Former Member

      Hello Michael,

      Is required to create the link as shown with this screenshot ?iot1.JPGRegards,

      Pavan

      Author's profile photo Michael Ameling
      Michael Ameling
      Blog Post Author

      Hi Pavan,

      yes, you need to create an according link with your account configuration. Please find the description how to configure your account in the article. The configuration is necessary in order to tell the app where to send what data.

      Best regards,

      Michael

      Author's profile photo Former Member
      Former Member

      Hello Micheal,

      I have created Message Type,Device Type.Below is the link , i entered in Safari tab.

      iot-create://&/accountName&/S0015414084&/name&/Connect&/dataCenter&/hana.us1&/deviceName&/P1Device&/deviceTypeID&/3511f69da8f73fa2e95b&/deviceReg&/e280629261bb27bca629453bb1c7ef4d&/messageTypeID&/5d35df15cab913bf4918

      Still i am facing  "Registration Failed". I don't know what i am missing ? Please help me out

      Regards,

      Pavan

      Author's profile photo Former Member
      Former Member

      Hello ,

      could you help me out , Still i am facing Registration Failed error on SensorTag app after entering above URL in Safari browser .

      Author's profile photo Anton Levin
      Anton Levin

      Answered in this thread Re: Registration Failed on IoT Sensor

      Author's profile photo Matthias Steiner
      Matthias Steiner

      Thanks Michael for this great and straight-forward example! I recently went through this again as I was collecting resources for a Hackathon and noticed that on my device (TI SimpleLink SensorTag CC2650) I had to prefix the properties/fields of the MessageType with 'sensor' (e.g. sensorTemp) in order for it to work properly:

      Just FYI for those that may also run into issues with 0.0 values ...

      Author's profile photo Michael Ameling
      Michael Ameling
      Blog Post Author

      Thanks for the hint. I just updated the names for the fields.

      Author's profile photo David Lincourt
      David Lincourt

      Thanks for this great example. It was part of the inspiration for a simple app that displays the Heat Stress Index. I blogged about it here: It's hot out here!

      Author's profile photo Michael Ameling
      Michael Ameling
      Blog Post Author

      Just updated the field names for the message type of the SensorTag and iOS device. Please check your device model that the new names match.

      Author's profile photo Murali Shanmugham
      Murali Shanmugham

      Hi Michael,

      Thanks for the updating the Sensor tag properties. I also used the properties sensorTemp, sensorOptical and sensorHumidity.

      Author's profile photo Emmanuel Da Costa
      Emmanuel Da Costa

      Hello

      I am trying the tutorial and I am facing two problems :

      -> in the message type configuration screen, I do not have the 3 fields but only 1

      Message type.PNG

      -> In the Display stored Data, I have only 3 tables

      data store.PNG

      I have the DB created and running. I am using the hana trial

      iotmms.PNG

      Any clues

      Regards

      Emmanuel

      Author's profile photo Anton Levin
      Anton Levin

      1. first screen. press on "Add Field" to add more fields to the message type

      2. a table is created once data is arrived from sensor/device/sample client

      Author's profile photo Emmanuel Da Costa
      Emmanuel Da Costa

      Hello

      I found my mistake.

      In the tutorial, the first step is the creation of the device type. But the first step must be the creation of the message type.

      As the device type assignment has been removed from the message type creation, it is not possible to assign a device type to the message type.

      When creating the device type, it is possible to assign the message type if it has been created first.

      It is explained in the iot stater kit.

      Please could you modify the tutorial ?

      Now everything goes well.

      best regards

      Emmanuel

      Author's profile photo Michael Ameling
      Michael Ameling
      Blog Post Author

      I just updated the blog to the new procedure since the IoT Cockpit has change and the API V2 has been introduced.

      Author's profile photo Emmanuel Da Costa
      Emmanuel Da Costa

      Thank you.

      Regards

      Emmanuel

      Author's profile photo Former Member
      Former Member

      Hello,

      I have created new MessageType for CC2650.

      & followed procedure as above. Getting below error(screenshot)

      Sensoreeror_cc2650.jpg

      I am not getting data in MMS Cockpit.Could you please help this out?

      Author's profile photo Anton Levin
      Anton Levin

      Message Type filed names you used during message type creation should match to the names you send in payload. I see you have SensorGyroy and SensorGyroz (1st screenshot) but sensorGyroY and sensorGyroZ (2nd screenshot). Case matters.

      Author's profile photo Former Member
      Former Member

      Hello Anton,

      I have changed accordingly,but still facing same error.

      Changed Message ID,Device Type ID,Device registration Token in standard IoT url.

      Registration was successful.

      Regards,

      Pavan

      Author's profile photo Anton Levin
      Anton Levin

      It will help if you provide a full screenshot (do you have only 5 fields?) and also an updated screenshot from itelligence app to compare.

      Author's profile photo Former Member
      Former Member

      Hello Anton,

      These are screenshots of Message Type,Device Type & Devices respectively.

      Regards,

      Pavan

      Author's profile photo Anton Levin
      Anton Levin

      And the itelligence app screenshot?

      Author's profile photo Former Member
      Former Member

      /wp-content/uploads/2016/08/1_sensor_1010207.jpg

      /wp-content/uploads/2016/08/3_senosor_1010209.jpg/wp-content/uploads/2016/08/2_sensor_1010208.jpg

      Regards,

      Pavan

      Author's profile photo Anton Levin
      Anton Levin

      I do not have a sensortag with me but I do not remember it sends "timestamp". This field should be removed from your message type, I guess.

      Author's profile photo Murali Shanmugham
      Murali Shanmugham

      Hi Anton, My sensortag message has got timestamp(date) and it worked for me yesterday. Looks like the problem is elsewhere.

      Pavan, can you please raise a discussion in the forum and point to this article. Thanks.

      Author's profile photo Former Member
      Former Member

      Hello ,

      Please check , i have posted Receiving Failed error from getting CC2650 sensor data?

      Regards,

      Pavan

      Author's profile photo Sasi Reddy
      Sasi Reddy

      Works great, thanks for the blog.

      Author's profile photo Simen Huuse
      Simen Huuse

      Hi Michael. Great blog post. Fields "Message Type Name" and "Message Type Direction" are left blank when creating a connection with the above procedure. Is that intentional?

      Br, Simon

      Author's profile photo Volker Kolberg
      Volker Kolberg

      Hi Michael!
      Great post. But it would b e very helpful, if at least all sensor data the App can read from the CC2650 SmartTag would also be handed over to HCP. I am talking about at least:
      sensorHumidity
      sensorObjectTemp
      sensorOptical
      sensorTemp
      But according to the specification there are even more sensors. Thus enabling ALL sensors in the app as optional fields would be great:

      pressure R hPa float Pressure sensor air pressure
      pressure_t R C float Pressure sensor temperature
      humidity R %RH float Humidity sensor relative humidity
      humidity_t R C float Humidity sensor temperature
      objtemp R C float IR temp sensor object temperature
      accelX R g float Accelerometer X-axis motion
      accelY R g float Accelerometer Y-axis motion
      accelZ R g float Accelerometer Z-axis motion
      gyroX R deg/sec float Gyroscope X-axis rotation
      gyroY R deg/sec float Gyroscope Y-axis rotation
      gyroZ R deg/sec float Gyroscope Z-axis rotation
      magX R uT float Magnetometer X-axis magnetic field
      magY R uT float Magnetometer Y-axis magnetic field
      magZ R uT float Magnetometer Z-axis magnetic field
      light R Lux float Light sensor illuminance
      battery R mV float Battery voltage level
      key1 R state int Push button 1 key value
      key2 R state int Push button 1 key value
      reed R state int Magnet reed relay state value
      buzzer RW state int Buzzer on/off
      LED1 RW state int LED1 state on/off
      LED2 RW state int Buzzer on/off
      Radio R string string Radio interface(BLE/Wifi)
      Author's profile photo Volker Kolberg
      Volker Kolberg

       

      Any chances to enhance the app?

      Author's profile photo Sri Jayant Singh
      Sri Jayant Singh

      Hi Michael,

      Thanks for the post, it is amazingly descriptive,

      Just that i need some help configuring my TI sensor app on android phone, for my sensor to communicate with HCP IOT service, well is configuration, same as the IOS, as explained in the post ?

      I have tried using the same syntax to create a thing and, use it in the custom cloud option on the Android app by TI, it wont throw me any error, but i don't even get any data on my HANA database.

          

       

      Regards,

      Srijayant

      Author's profile photo Anton Levin
      Anton Levin

      Hello Srijayant,

      this blog explains how to use TI SensorTag in a combination with IoTSensor app by itelligence AG (iOS app) to send data to the SAP Cloud Platform Internet of Thing. The native Simplelink SensorTag Android app you try to use does not support SAP Cloud Platform connectivity and also the mentioned above "quick link" syntax.

      Regards, Anton

      Author's profile photo Flávio Eduardo Molina Santos
      Flávio Eduardo Molina Santos

      Hi Michael,

      Thanks for this blog, I really was finding some think like this.

      I have see other tutorial where IOT services are created directly on HANA  DP (By Eclipse).

      Im really wold like understand the options to do this. Can you please put some lights on this and clarify  the differences btw the method presented here an this other? In additional what is the recommended approach.

       

      For reference IOT integration using HANA DB:

      Author's profile photo Christian Abilio Geronasso
      Christian Abilio Geronasso

      I am trying to use iot started kitto display data... but in STEP 8 from https://www.sap.com/developer/tutorials/iot-part13-hcp-services-viewdataui5.html

      my devices are not listed, thoughts?

       

      tks!

      Author's profile photo Anton Levin
      Anton Levin

      Dear Christian,

      please familiarize yourself with the Community Rules of Engagements [1] and especially with:

      #9 do not cross post – you asked the same question here and in [2] thread
      #13 do not hijack – this blog describes completely different scenario to what you try to ask

      Regards,
      Anton (Moderator)

      [1] https://www.sap.com/community/about/rules-of-engagement.html 
      [2] https://answers.sap.com/questions/298564/its-possible-to-use-sensortag-2650-iot-services-of.html?childToView=301112#comment-301112 

      Author's profile photo Christian Abilio Geronasso
      Christian Abilio Geronasso

      Tks and sorry!

      Author's profile photo Teemu Jokinen
      Teemu Jokinen

      Fantastic example and good guidelines. It was easy to implement and it works perfectly, thanks!

      Author's profile photo Christopher Geladaris
      Christopher Geladaris

      Hi,

      Any plan to update your app so it can use the new CF IOT environment?

      regards

      Author's profile photo Sandeep Roy
      Sandeep Roy

      I am also looking to connect the app data in Cloud Foundy environment using IoT service Cockpit.