Skip to Content
Technical Articles
Author's profile photo Patrick Colucci

The Easiest Way to Stream your iPhone’s Sensor Data to SAP Cloud Platform [Retired]

/wp-content/uploads/2016/03/banner_927175.png

 

UPDATE (October 2019): SensorPhone is no longer supported and has been removed from the App Store due to recent changes in the IoT Services. Thanks for your support!

UPDATE (Feb. 27, 2017): SensorPhone has been upgraded and has a new icon to show for it! First, SensorPhone has been upgraded to support all iPhone screen sizes. Yes – that means your shiny iPhone 7 Plus! Second, the IoT Services form screen has been improved. We’ve leveraged design aesthetics from the SAP Belize theme and native iOS controls. It’s now a lot easier to use and setup your iOS device to communicate with SAP Cloud Platform. Lastly, we’ve got rid of a few bugs that interfered with the microphone.

As you may already know, SAP Cloud Platform (SCP) allows anyone to go from sensor to visualization with the Internet of Things (IoT) service. SAP Cloud Platform’s IoT service provides the ability to quickly develop, deploy, and manage real-time IoT and machine-to-machine (M2M) and remote data sync applications. The possibilities are nearly endless; you can setup and manage connected remote devices, get real-time predictive analysis to improve intelligence and decision-making at the edge of the network, and optimize business processes at the core of your business.

That sounds great on paper, but how can we see the power and agility of SAP Cloud Platform without the need to build and setup extensive demos for the Internet of Things? Not everyone has access to the hardware needed to build out the desired IoT demo we all dream about (and see at SAP’s trade shows). However most of us have a smartphone. In fact, you may be reading this on that very smartphone. Our smartphones are packed with almost a dozen different sensors which we can leverage to see the power and agility of SAP Cloud Platform.

There’s a very good chance that your smartphone is an iOS device like an iPhone. With this in mind, I developed an iOS application that taps into your iOS device’s sensors (like the gyroscope, accelerometer, barometer, GPS, and audio), and neatly packages it into JSON format, then seamlessly feeds it to the IoT Service within SAP Cloud Platform. The app is called SensorPhone. I will show you how you can use your iPhone and the SensorPhone app with your own SAP Cloud Platform account.

I’ve made this extremely simple for anyone to setup and use. This blog post is broken down into three main steps. Step 1: Internet of Things Service Setup, Step 2: Adding your iOS Device in the Internet of Things Cockpit, and finally Step 3: Setup the SensorPhone app to send data to SAP Cloud Platform. Enjoy!

Before we get started, here is what you need:

  • The iOS SensorPhone client was updated to version 1.3.2 or higher in order to support an improved data model. if you setup your IoT Services within HANA Cloud Platform before April 10, 2016, then please see Step 2.1 to create a new Message Type. If you do not create a new Message Type, you will be unable to continue using SensorPhone (v1.3.2).
  • iPhone with the SensorPhone app (Requires iOS 7.0 or later, iPhone 5 and newer models. However, SensorPhone is compatible with iPad and iPod touch, 3.5″ screen+)
  • SAP Cloud Platform account (If you don’t have one, you can sign up for a trial account for free here)

 

Step 1: Internet of Things Service Setup

This is a very quick and simple walkthrough to setup your Internet of Things Service within your SAP Cloud Platform account, if you haven’t already done so. If you have, you may skip to Step 2: Adding your iOS Device in the Internet of Things Cockpit.

The IoT services in SCP is comprised of two main areas:

  1. Remote Device Management Service (RDMS) – this is used to onboard new devices, like our iPhone.
  2. Message Management Service (MMS) – this is used to manage messages between device, cloud platform and business applications. This is also where we will see the sensor data stored in SAP Cloud Platform.

 

Enabling the IoT Service for your SAP Cloud Platform Account

This will give you access to the Internet of Things Cockpit which leads you to the Remote Device Management Service.

First go to your SAP Cloud Platform Account and select Services from the side menu.

Note: Make sure you are at the account level at the top. Then on you may see the Services in the left menu.

 

Screen Shot 2016-03-28 at 8.24.13 AM.png

Scroll down until you see, Internet of Things Services and then click “Enable”.

Screen Shot 2016-03-28 at 8.24.27 AM.png

You now have enabled the IoT Services for your SCP account. The “IoT-User” role has now been assigned to you. Next we will install the Message Management Service (MMS).

 

Deploying the Message Management Service (MMS)
 

As mentioned above, this is used to manage messages between your iPhone, the platform, and business applications. This is also where we will see the sensor data stored in SAP Cloud Platform.

From your SAP Cloud Platform Cockpit, lets go back to the Internet of Things Service. We will enter the IoT Service Cockpit by clicking “Go to Service“.

Screen Shot 2016-03-28 at 8.24.27 AM.png

You will now see “Deploy Message Management Service” on the bottom left tile. Click on that.

Screen Shot 2016-03-28 at 8.25.42 AM.png 

Enter your account ID, username, and password.

Note: Your account ID is likely your (i/d/p) number or email address with the word “trial” on the end. Your User Name is likely to be your (i/d/p) number or email address itself.

Screen Shot 2016-03-28 at 8.54.36 AM.png 

We now have deployed the IoT Services application and the Message Management Service (MMS). Lastly, we need to add the IoT-MMS-User Role to our UserID.

 

Adding the IoT-MMS-User Role to your User ID

From the SAP Cloud Platform Cockpit, select Java Applications and click on iotmms. This will take us to the Java Application Overview screen.

 

Screen Shot 2016-03-28 at 8.26.13 AM.png

 

On the left hand side, select Security > Roles.

We now see the predefined IoT-MMs-User Role at the top.

 

Screen Shot 2016-03-28 at 8.26.29 AM.png
 

Verify that the IoT-MMS-Role is selected. Then below, click on “Assign

 

Add in your User ID and select “Assign“.

Note: Your User ID is not your account name. The user ID doesn’t not include the word “trial” on the end.

Screen Shot 2016-03-28 at 8.26.49 AM.png

Now we have added the Internet of Things Service, installed the MMS, and assigned our user to the IoT-MMS-User Role. Next we will add our iOS Device!

 

Step 2: Adding your iOS Device in the Internet of Things Cockpit

From your SAP Cloud Platform Cockpit, lets go back to the Internet of Things Service. We will enter the IoT Service Cockpit by clicking “Go to Service“. We are launching the Internet of Things Cockpit, within SAP Cloud Platform. The Internet of Things Services cockpit is the main interface for users to interact with the Remote Device Management Service (RDMS). It can be used to register new Devices (like our iOS device), to define the schema of messages (Device Types and Message Types) they can send and/or receive, as well as to establish the necessary trust relationship needed by devices to interact with Message Management Service (MMS).

As mentioned above, in order for our iOS device to successfully communicate with SAP Cloud Platform, there are a few prerequisites. The internet of Things Service requires a specific syntax used to register new devices in the device registry. We will need to create 3 entities:

  1. Device Type: A device type specifies a group of devices that share the same specification. In the IoT services, this specification is interpreted as the capability of sending, receiving and processing certain types of messages from our iOS Device.
  2. Message Type: A message type defines the type of data contained in a message that is sent or received by a device. Message types are specified for device types. For example, we will need to create a Message Type with the following attributes: sensor, value, and timestamp.
  3. Device: A device is a physical object that can be registered with IoT services. After successful registration it is able to send or receive messages. This is of course our iOS device itself.

So lets begin!

From your SAP Cloud Platform Cockpit, lets go back to the Internet of Things Service. We will enter the IoT Service Cockpit by clicking “Go to Service“. 

Screen Shot 2016-03-28 at 9.30.31 AM.png

2.1: Creating our Message Type

We will create a Message Type for the iOS device. Click on the “Message Types” tile. 
Screen Shot 2016-03-28 at 9.30.31 AM.png 

Click on the plus ( ➕ ) button at the bottom. Name the new Message Type (iOS Message Type) for the new device.

Screen Shot 2016-04-05 at 12.29.18 PM.png

For the Fields, click the plus (+) button to add more messages types (to have 12 in total) and data types.

timestamp: date
device: string
gyroscopex: string
gyroscopey: string
gyroscopez: string
accelerometerx: string
accelerometery: string
accelerometerz: string
altitude: string
longitude: string
latitude: string
audio: string

Then press “Create” (bottom right corner).

Screen Shot 2016-04-05 at 12.32.40 PM.png

Please note your Message Type ID. I recommend you copy/paste somewhere for easy access later on when we need it.

Screen Shot 2016-04-05 at 12.33.17 PM.png 

2.2: Creating our Device Type

Click on the “Device Types” tile. Then click on the Plus ( ➕ ) symbol at the bottom to add a new device type.

Screen Shot 2016-03-28 at 9.31.20 AM.png

Name your device type (iOS Device), assign it (by clicking Add Message Type) with the Message Type we just created, and chose From Device for the direction. press “Create”.

Screen Shot 2016-03-28 at 9.31.29 AM.png

 

2.3: Creating our Device

Press the back arrow (top left) to return to the IoT Sevices Cockpit. Then press the “Devices” tiles.

Screen Shot 2016-03-28 at 9.30.31 AM.png

Once again, press the plus button on the bottom to create a new device. Give it a name (iOS Device), select the Device Type we created earlier (iOS Device Type) and the press “Create” (bottom right).
Screen Shot 2016-03-28 at 9.33.57 AM.png

Important: After you create the device, a pop up will appear with a token value. Copy/Paste this as well because we need this to input into our SensorPhone app. If you lose it, click into the Authentication tab and you may generate a new token. 

Screen Shot 2016-03-28 at 9.34.03 AM.png

Also, please note your Device ID after you click “Close”. You will see the “ID” listed under your “Device Type” on your “Device Page”.I recommend you copy/paste somewhere for easy access later on when we need it. This will be needed to build your URL endpoint in the next step.

 

Screen Shot 2016-03-29 at 10.31.48 AM.png 

We now have everything setup to use our SensorPhone app with SAP Cloud Platform!

 

Step 3: Setup your SensorPhone app to send sensor data to SAP Cloud Platform

Now that all of the heaving lifting is out of the way, lets have fun with the SensorPhone app. SensorPhone is an iOS client that allows you to visualize your iPhone’s sensor data in real-time. SensorPhone allows you to stream this sensor data to the Internet of Things service within SAP Cloud Platform (via HTTP POST). If you haven’t already, download the app here from the App Store.

Once you download and open SensorPhone, it is extremely important that you Allow all the permissions (as shown below). This is vital to access and send the sensor data.

/wp-content/uploads/2016/03/permissions_916772.png

/wp-content/uploads/2016/03/sidebyside_927207.png

SensorPhone app is comprised of two different screens. The first screen is on the “Live” tab. The Live tab visualizes your iOS’ sensor data in real-time. It displays the movements of the accelerometer and the gyroscope. It displays your GPS coordinate, and your magnetic heading along with your altitude. SensorPhone also displays your audio levels around your iOS device, as fed from the primary microphone.

 

The second screen is the “IoT Service” tab. This tab is the most important because it allows you to enter your SAP Cloud Platform/IoT Service credentials into the provided form to seamlessly stream your sensor data in real-time. The form is comprised of URL, mode, messageType, and messages. You will also notice header values with two fields: Content-Type and Authorization. This is needed to send data to the IoT service from an external source like our iOS device, outside of the authorized network. I’ve also added a drop down menu that allows you to constantly send your updated sensor data in intervals of Just Once, Every 2 Seconds, Every 5 Seconds, and/or Every 10 Seconds. Let’s dig deeper into the form below.

 

What to enter in the “IoT Service” Form

 

/wp-content/uploads/2016/03/form_about_1_916806.png

/wp-content/uploads/2016/03/form_about_2_927205.png

/wp-content/uploads/2016/03/form_about_3_916808.png

Your form’s inputs should look something similar to mine below. At the moment you have to enter this manually so I suggest you put your information into an email and send it to your iOS device. This will allow you to easily copy/paste the information to the appropriate fields.

 

URL: https://iotmmsi840337trial.hanatrial.ondemand.com/com.sap.iotservices.mms/v1/api/http/data/74b90c1d-3492-499c-9757-505ce4756bff

mode: sync

messageType: 4c0781b3ff1e7506f77b

messages: *automatically generated*

Header

Content-Type: application/JSON;charset=utf-8

Authorization: Bearer *insert authorization token here*

 

Note: It is extremely important to add the word “Bearer” and a space before your device’s authorization token.

 

Watch the data stream!

 

After you have successfully setup your SensorPhone app, tap POST and you will see a response from HANA that looks something like this:

 

/wp-content/uploads/2016/03/phone_form_response_927206.png

 

If you’d like to see the raw data in a table, you can easily do so from the IoT Service Cockpit. From your SAP Cloud Platform Cockpit, lets go back to Services, and select the Internet of Things Service. We will enter the IoT Service Cockpit by clicking “Go to Service“. You will now see the IoT Services Cockpit.

 

Screen Shot 2016-03-28 at 9.30.31 AM.png

 

Select the “Select and view messages, or perform other actions” tile (in the bottom right-hand side).

 

Screen Shot 2016-03-28 at 11.32.18 AM.png

 

Select the “Display Stored Messages” tile (in the top left-hand corner).

 

Screen Shot 2016-04-11 at 8.11.58 AM.png

 

Locate the newly created table by looking for your Message Type (Example: The table would look something like T_IOT_4C0781B3FF1E7506F77B. The long part after the second underscore would be your message type). Then select your table and you will see the messages being sent! Refresh the page to see the new data being fed in.

 

Screen Shot 2016-04-11 at 8.14.11 AM.png


Final Thoughts

 

Now you’re able to see the power and agility of the Internet of Things services within SAP Cloud Platform. But most importantly, you’re able to leverage this generic demo to build your own personalized demonstration around a particular use case. Your iOS device can a send large amount of data in real-time to your SCP account, the possibilities are endless.

I have a few more updates on the way for SensorPhone that will make the setup easier and the sensors configurable. Take a look at Visualizing iPhone Sensor Data with SAPUI5 by my colleague in Toronto, Anthony McLeod, that illustrates how to consume this sensor data using SAP Cloud Platform and SAPUI5. Stay tuned and thank you for playing with SensorPhone!

Follow me on Twitter and LinkedIn!

 

Patrick Colucci

Technology Solution Consultant

SAP Canada

Assigned Tags

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

      Hi Patrick, amazing post.

      I´ve follow the steps and works perfectly.

      Thank you.

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      I'm happy to hear that, Pablo! Thanks for giving it a try. Stay tuned for further updates to this demo!

      Best,

      Pat

      Author's profile photo Former Member
      Former Member

      Great blog Pat! Thanks for sharing! #PresalesCAN

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Thanks, Henry!

      Author's profile photo Murali Shanmugham
      Murali Shanmugham

      Good one 🙂

      Author's profile photo Diane Pickett
      Diane Pickett

      Rock star!

      I'm going to make you the 'headliner' for the next HCP workshop 🙂

      Author's profile photo Lalit Sharma
      Lalit Sharma

      This is really a great app which can be used by anyone for doing IoT demo using iPhone as a sensor device.

      @Patrick, is it possible to create an IoT dashboard as well so that even the sales team will be able to use, once it is being configured for them with the help of presales team.

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Thank you, Lalit! It is 100% possible to create an IoT dashboard for this demo. The IoT services come with built-in oData access. I'm working on a dashboard for the follow-up blog as we speak!

      Best,

      Pat

      Author's profile photo Former Member
      Former Member

      In the near future real world things like cars and trucks, homes, machines and ... Internet of Things and its services are becoming part of our everyday life, ways

      Author's profile photo Former Member
      Former Member

      Thanks. Great start!

      Question: is it just me, or are the configuration data not persisted, meaning I have to enter them each time I start the app?

      Looking forward to the enhancements for the app and the dashboards.

      Thanks again.

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Thanks, Jeroen. You are correct. That is something that will be added in an upcoming update!

      Best,

      Pat

      Author's profile photo Former Member
      Former Member

      Patrick -

      Just Awesome and thank you for detailing the steps to execution.  This is a MUSt READ for everyone.

      Well Done!

      Amy

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Thank you so much, Amy!

      Author's profile photo Tom Krusinski
      Tom Krusinski

      Fathers with teenage drivers can rest a little easier 🙂

      Many potential applications, great job!

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Haha. Thank you, Tom!

      Author's profile photo Mohamed Judi
      Mohamed Judi

      Patrick, this is one of the best, most practical, and relevant thing to everyone that I've read about IoT so far. Awesome job!

      This will be an accelerator in my personal learning journey as well, thank you!!!

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Thank you, Mohammed! I'm happy to hear that you found this useful!

      Author's profile photo John Astill
      John Astill

      Congrats Pat on the app and great blog.

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Thanks, John! Great to hear from you.

      Author's profile photo Tamas Szirtes
      Tamas Szirtes

      This is great stuff! Do you have any plans for Android?

      Regards,

      Tamas

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Thanks, Tamas. My plan was to release an iOS version first, and if there was enough buzz around an Android version then I get that version out as well. 🙂

      Author's profile photo Tamas Szirtes
      Tamas Szirtes

      buzz, buzz, buzz, etc

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      I'll try to build something out... 😉

      Author's profile photo Danny Lacerte
      Danny Lacerte

      Buzz buzz buzz here too!

      Author's profile photo Thiru Siva
      Thiru Siva

      More Buzz from me too...

      Author's profile photo Roman Broich
      Roman Broich

      Hallo Patrick,

      many thanks for this excellent blog post!

      It works like a charm, but now I am struggling to find the corresponding tables "IOT" in my HCP trail-instance. Once found, I'll try to combine the data with some HANA Geospatial or Series-Data features.

      Best,

      Roman

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Hi Roman,

      I'm happy to hear the app is working well for you.

      In regards to the tables, at which step above does your screen differ? I'd love to see how you combine the data with HANA features.

      Best,

      Pat

      Author's profile photo Former Member
      Former Member

      Works perfectly!

      Now I look forward to the visualisation app 🙂

      Great work - thank you.

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Thanks, Sunil!

      Author's profile photo Masahiro Furusawa
      Masahiro Furusawa

      Thanks Patrick!

      This is an amazing experience for me. I am looking forward to your next blog to share your idea how to consume the sensor data.

      BR, Masahiro

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Thanks, Masahiro!

      Author's profile photo Former Member
      Former Member

      Thanks Partrick! This is good.

      Are there any more updates being done for the Sensor App ? What are the other kind of information that can be retrieved ?

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Thanks, Uma. I'm looking to update the same this week or next to bring some minor tweaks to the UI, data model, and sensor calibration.

      Author's profile photo Former Member
      Former Member

      Hi Pat , Is there anything specific to the version of phone. I don't see the Post button once the application has been installed iniPhone4s ?

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Hi Uma, SensorPhone currently only supports screens larger than 4". There will be an update to support the iPhone 4/4S.

      Best,

      Pat

      Author's profile photo Former Member
      Former Member

      Hi,

      Thanks for the wonderful blog which can showcase HCP Capabilities for the IOT platform by SAP.

      I would like to know how to troubleshoot this scenario.though I am able to post the messages from the device but its seems some authorization issue..but how do I find the error details about this message. Also is there any configuration to be enabled to see the messages received as I am currently seeing only T_IOT_MONITOR Table under Application Data from the Display stored messages option and no other details.

      Thanks in advance

      Rajesh

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      HI Rajesh, I'd be happy to help you troubleshoot. Can you explain in further detail what happens when you tap "POST". What is the response you receive from the server on your iOS device? Is it similar to my screenshot above?

      If you don't see the newly created table, odds are the data is not successfully being sent.

      Best,

      Pat

      Author's profile photo Former Member
      Former Member

      Hi Pat,

      Thanks for the response.

      I have received the response message as shown in your screenshot for few messages..

      After that I have received an email that there have been five failed attempts to log onto your account, you can only log on using your SAP SSO certificate.

      As mentioned earlier I can see lot of error messages under the table T_IOT_MONITOR under Application data and not able to get into those error messages also.

      Let me know if you need any more details here.

      Thanks & Regards

      Rajesh

      Author's profile photo Former Member
      Former Member

      Hi,


      Is there any way to save the credential in app itself.? Because while closing or disconnecting the SensorPhone app whatever credential are entered get removed from the app and we have to reenter the same.

      URL:https://iotmmsi311390trial.hanatrial.ondemand.com/com.sap.iotservices.mms/v1/api/http/data/1a54c88d-33b5-48e9-bb0e-e14a65425ddc

      mode: sync

      messageType: 79c123e3c678ce8cde85

      messages: *automatically generated*


      Header

      Content-Type: application/JSON;charset=utf-8

      Authorization: Bearer *insert authorization token here*


      Regards,

      Shivanand

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Hi Shivanand,

      Not at the moment, but there will be in a future update.

      Best,

      Pat

      Author's profile photo Pfau Patrick
      Pfau Patrick

      Hi Patrick,

      great work, thanks for that!

      One question / suggestion: Is it or will it be possible to send the sensor data in background? It would be great if one could just start the app, lock the phone or use other apps and data gets written constantly (e.g. every 10 secs) to HCP.

      Thanks,

      Patrick

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Thanks, Patrick! I'm glad you enjoyed it. I'm looking into feeding the data in the background as we speak. Thank you for the suggestion. A few updates are coming out soon for SensorPhone so I recommend you check back late next week to see what's new!

      Best,

      Pat

      Author's profile photo Pfau Patrick
      Pfau Patrick

      Thanks, that sounds great!

      I have one more for some future update: it would also be nice, to be able to use the push service to directly send data to a target device (or respectively use method http to store the data on HCP for a specific device). For http for me it only seems that the messages-part of your app needs to be able to add sender and method-property.

      All the best, Patrick

      Author's profile photo jose erickson
      jose erickson

      Wow, this is great.

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Thanks, Jose!

      Author's profile photo Frank Geisler
      Frank Geisler

      Fantastic Patrick!

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Thanks, Frank!

      Author's profile photo Former Member
      Former Member

      Hi Patrick,

      I dutifully followed your script.  However, when I press the post button, it throws an error.

      msg = "The message does not conform to the given message type";

      Author's profile photo Peter Engel
      Peter Engel

      Hi Mark,

      I had the same problem. In the script is a little typo:

      timestamp: date
      senor: string

      value: string


      It must be sensor not senor. I assume if you correct your message type it will work.


      Br,

      Peter

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Ah yes! Correct! I have corrected that typo. My apologies, please create a new Message Type with the following:

      • timestamp: date
      • sensor: string
      • value: string

      Let me know if that fixes things for you.

      Best,

      Pat

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Hi Mark,

      My apologies for the typo in the script. Please refer to my comment to Peter above.

      Best,

      Pat

      Author's profile photo Former Member
      Former Member

      Thanks Patrick & Peter.

      Made the correction, and it works slick.

      Thanks for the speedy replies!!

      Author's profile photo Andreas Rudolph
      Andreas Rudolph

      I had it as well. Basically the iphone variables must match to the ones you define in HCP. In this app here you see a little window "message". And it seems to be that the variable names displayed there must match to the dataset you define in HCP.

      Reasoning: The app does not create a structure in HCP, but uses http to send data to an existing structure.

      Author's profile photo Michal Gruszecki
      Michal Gruszecki

      great blog post! very clear and helpful! i can't wait for other updates, this is really a great use case for getting geo data.

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Thanks, Michal! I'm happy to see you found it useful.

      Author's profile photo D. Floor
      D. Floor

      Patrick,

      Thanks for this great demo !

      But I have a question. On my phone I don't have the part where I can setup the frequency. The post-button is missing too.

      I use a 4S (yes they do still exist 😛 ) with IOS 9.3.2 (beta).

      Any idea ?

      With kind regards,

      Dirk.

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Thank you, D.

      I will look into your iPhone 4S issue. Thanks for your patience.

      Author's profile photo Peter Engel
      Peter Engel

      Hi Patrick,

      after the update of the app I adjust the message type with the new fields and I receive the message on my iPhone that data was streamed.

      But I get no new table on the HCP to view the data, any hint?

      Br,

      Peter

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      HI Peter, can you confirm that after you created your new Message Type and installed the latest version of SensoPhone from the App Store, you pasted the new Message Type ID into the required field in the app?

      Author's profile photo Peter Engel
      Peter Engel

      yes, I can confirm all steps.

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Hmmm. That's strange. May I suggest that you run through the steps to setup your Device Type, Message Type, and Device from scratch. It's hard to troubleshoot via text. It's not ideal but it is a solution that I'm sure will get things going again.

      Best,

      Pat

      Author's profile photo Manikandan TR
      Manikandan TR

      Its really strange !!!

      Even me too face the same issue and tried creating new Device Type, Message Type and Device from scratch and still the issue persists.

      Don't know what the work around is

      Regards,

      Mani

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Hi Manikandan,

      May I suggest to delete any old Devices, Device Types, and Message Type from the previous SensorPhone version that you create in your IoT Services. Then proceed to create new ones. I believe this is a minor confusion in the transmission of the data.

      Best,

      Pat

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Hi Manikandan,

      A fix (v.1.3.2) is now available for download on Apple's App Store. Please download to squash the bugs and to continue using SensorPhone with your IoT Services in HCP!

      Direct link to the App Store: SensorPhone on the App Store

      Best,

      Pat

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Hi Peter,

      A fix (v.1.3.2) is now available for download on Apple's App Store. Please download to squash the bugs and to continue using SensorPhone with your IoT Services in HCP!

      Direct link to the App Store: SensorPhone on the App Store

      Best,

      Pat

      Author's profile photo Former Member
      Former Member

      Hi Patrick,

      Using Postman I was able to insert an entry on a device. It should be something related with your app.

      Nice work 🙂

      Author's profile photo Former Member
      Former Member

      Same issue here. Followed all the steps without a problem, app reports "1 message received" every 2 seconds as configured, but there are only 2 tables in Message Management Service Cockpit, T_IOT_CONFIG and T_IOT_MONITOR_LOG  (no errors visible in the latter).

      Author's profile photo Former Member
      Former Member

      Hi Patrick,


      Great demo.  Do you suggest any similar Android App?


      Regards/Ram

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Thanks, Ram! I'm looking into bringing out an Android soon. Stay tuned for any changes.

      Author's profile photo Former Member
      Former Member

      This is great! I am really amazed to see how cloud with IoT is disrupting IT.

      Keeping an eye on this blog to see updates on Android app as well.

      Cheers,

      Megha

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Thanks, Megha!

      Author's profile photo flavio ciotola
      flavio ciotola

      Outstanding blog!

      Thank you Patrick for sharing. I'm going to give it a try. 🙂

      Flavio

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Thanks, Flavio!

      Author's profile photo Dietmar Steinbichler
      Dietmar Steinbichler

      Hi Patrick,

      first let me join the chorus of praisers 😀 This is really an awesome app!!!

      I am having a similar issue as Peter. No data is coming from the phone to the HCP when using the new setup. I tested it in the HCP workbench with the json data from the app and there it works.

      Is there probably any way to retrieve the message reply the comes back from HCP?

      Cheers,

      Dietmar

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Hi Dietmar,

      A fix (v.1.3.2) is now available for download on Apple's App Store. Please download to squash the bugs and to continue using SensorPhone with your IoT Services in HCP!

      Direct link to the App Store: SensorPhone on the App Store

      Best,

      Pat

      Author's profile photo Former Member
      Former Member

      Hi Patrick,

      cool, it is now available in the AppStore (not only SAP-internal).

      I'd love to get a version where it is NOT a must to allow access to location and microphone. Of course these sensors will then not provide valid data. It would be wonderful to be able to define a location manually (not the real one).

      Just to ensure somehow more data privacy.

      I assume we wil need this to be able to use it in workshops.

      Thanks a lot, best regards

      Claudia

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Thanks, Claudia! Great suggestion, I'll look into that!

      Author's profile photo Andreas Nickel
      Andreas Nickel

      Hi Patrick,

      nice tutorial. It got it all configured without issues, however, I am having the same problem as Rajesh a while back - while I am receiving the similar response on my iPhone, I don't get any values into HCP. I copied/pasted my URLs, IDs, etc. twice, regenerated an oAuth token, but no luck. I noticed the order of data fields to be different in the message body in the app when compared to the message type in HCP. Does this matter? Also noticed [] brackets instead of {} brackets at the outermost level in the app - is this correct? Where can I see debugging info?

      Thanks, Andreas

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Hi Andreas,

      The order of the data shouldn't matter. May I suggest to delete any old Devices, Device Types, and Message Type from the previous SensorPhone version that you create in your IoT Services. I believe this is a minor confusion in the transmission of the data.

      Best,

      Pat

      Author's profile photo Andreas Nickel
      Andreas Nickel

      I just did everything today - download the app to implement this on HCP - within the last 1 h... What's there to delete?

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Do you receive the response "...1 message(s) received from device..."? If not, what do you receive? If so, can you confirm that you are unable to see a newly created table, as shown in the Watch the data stream section.

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Hi Andreas,

      A fix (v.1.3.2) is now available for download on Apple's App Store. Please download to squash the bugs and to continue using SensorPhone with your IoT Services in HCP!

      Direct link to the App Store: SensorPhone on the App Store

      Best,

      Pat

      Author's profile photo Andreas Nickel
      Andreas Nickel

      Great - thanks. Will try it right away 🙂

      Author's profile photo Danny De Roovere
      Danny De Roovere

      Outstanding blog! thank you Patrick.

      There seems to be an issue with the latest version of the app. Regardless of what you enter in the IoT Service screen, the application allways posts to https://iotmmsi840337trial.hanatrial.ondemand.com/com.sap. ...

      it seems like the host code is hard coded in the mobile app????

      I tried to post to my own trial account but the messages never arrive. When I then switched to a private network on my iPhone I received an error code 1004 (could not connect to server) and found out that the app is trying to post to the aforementioned Host..

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      You are right, Danny. This has been fixed and is now pending approval by Apple for release on the App Store.

      Best,

      Pat

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Hi Danny,

      A fix (v.1.3.2) is now available for download on Apple's App Store. Please download to squash the bugs and to continue using SensorPhone with your IoT Services in HCP!

      Direct link to the App Store: SensorPhone on the App Store

      Best,

      Pat

      Author's profile photo Lalit Sharma
      Lalit Sharma

      Patrick, even I was also getting the same issue after upgrade.

      Awaiting the new version.

      Regards,

      Lalit

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Hi Lalit,

      A fix (v.1.3.2) is now available for download on Apple's App Store. Please download to squash the bugs and to continue using SensorPhone with your IoT Services in HCP!

      Direct link to the App Store: SensorPhone on the App Store

      Best,

      Pat

      Author's profile photo James Rickard
      James Rickard

      Great the latest iOS app now works, is their any way of retaining the setup data in the app?

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Yup! I'm working on it, James! 😉

      Best,

      Pat

      Author's profile photo James Rickard
      James Rickard

      Thanks ... this is a really great use of the SCN and demoing HCP

      It would also be interesting to see the full structure of the message being sent to HCP as well as the body.

      James

      Author's profile photo Andreas Nickel
      Andreas Nickel

      I second that. I am one of the lucky guys with iot equioment lying around. Sensors, connected to microcontrollers, connected to GMS phone module able to talk to cloud databases...

      Author's profile photo Andreas Nickel
      Andreas Nickel

      If I am not mistaken, then there's also another app out there, called "RESTer", which allows you to post to HCP. There you can persist different scenarios. It can't read the smart phone sensors, but for experimenting it might also be a good candidate.

      Author's profile photo Dietmar Steinbichler
      Dietmar Steinbichler

      It works now for me as well. Thanks for the superfast fix!!!

      I found some little issue though 😳 I am not able to change the device name in the JSON permanently. After each send it goes back to iOS device.

      Would be great if you could include that in one of the next updates.

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Great news! I'll take a look at that for you.

      Best,

      Pat

      Author's profile photo Former Member
      Former Member

      Hi, Just small concern about this app, if we talk about user perspective in general what is the best case and usage of iPhoneSensor app.? Just take an example, if I am an user and I have installed this app  and configured successfully then how can utilize this app more and more.? Needing some best cases to explain the term of this application .? Regards, Shivanand

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      I believe this blog post attempts to answer the question (that I suppose) you're asking. Your question is a little confusing for me. If you have the opportunity, please read through the post. Use cases with the application expand outside of the application itself. The application acts as a utility that allows anyone to quickly create accurate IoT data, while experiencing the power and agility of HCP. What you're able to do with the data after what i've outlined here is what is most important. This is a tool that allows anyone with an interest in IoT to leverage. It's a first step in experiencing IoT and HCP.

      Best,

      Pat

      Author's profile photo Danny De Roovere
      Danny De Roovere

      Patrick,

      I downloaded the latest version of the app, entered all parameters, tapped on the Post button ... but I don't get a reply from HCP.

      Subsequently I don't see any data in the tables.

      I'm convinced all parameters are entered correctly, and I even compared the Fields in HCP with the fields in the iOS app message.

      Everything seems to be correct.

      What can be wrong?

      Author's profile photo Danny De Roovere
      Danny De Roovere

      Looking at the http traces on HCP, I found out that I received error code 401 🙁

      After a restart of the iotmms java application, I now get a http status 200 back 🙂

      Still I don't seen entries in the tables.

      I even replaced the url (api by internal). Still this isn't working 🙁

      Author's profile photo Danny De Roovere
      Danny De Roovere

      I now redeployed the MMS service and can see entries in the MONITOR_LOG.

      Unfortunately I cannot retrieve the messages I'm posting

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Hi Danny, I'm sorry to hear you're having issues with SensorPhone. Can you please verify that you've correctly setup your Message Type (for SensorPhone 1.3.2) with the required fields and can you also let me know your MMS version?

      Best,

      Pat

      Author's profile photo Manikandan TR
      Manikandan TR

      Patrick,

      Yes Me too facing similar issue as Danny,

      Regards,

      Mani

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Hi Manikandan,

      I'm sorry to hear you're having the same issue as Danny with SensorPhone. Can you also please verify that you've correctly setup your Message Type (for SensorPhone 1.3.2) with the required fields and can you also let me know your MMS version?

      Best,

      Pat

      Author's profile photo Hiroaki Adachi
      Hiroaki Adachi

      This is really great and fun blog !! I must try it.

      I'm looking forward to next blog that consume and view data using UI5. Also I want to send data more short period like 0.1 sec.

      Thank you !!

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Thanks, Hiroaki!

      Author's profile photo Lalit Sharma
      Lalit Sharma

      It works now! Thanks for the update Patrick.

      Author's profile photo Daniel Weis
      Daniel Weis

      Hi Patrick,

      thank you for this nice blog!

      I followed your introduction but got a problem by transferring the sensor data. It looks like the iPhone is transferring data but it doesn`t appear at the stored messages.

      Thanks for your advice!

      Best regards

      Daniel

      Author's profile photo Daniel Weis
      Daniel Weis

      Hello,

      fixed the problem, the fields in the message type have been only in wrong order....

      But got two more questions:

      1. Where are the data stored because our own HANA is not connected?

      and

      2. Is there a possibility to load the data in our own HANA/BW?

      Thank you!

      Regards

      Daniel

      Author's profile photo Former Member
      Former Member

      Great blog. It´s working fine.

      Author's profile photo Rodrigo Silveira
      Rodrigo Silveira

      Hi Patrick,

      Nice post !!! 🙂

      I have tried reproduced these steps, but I can´t see my messages:

      https://iotmmss000************trial.hanatrial.ondemand.com/com.sap.iotservices.mms/

      Access to the requested resource is forbidden (HTTP 403).

      Do you have any idea about this issue?

      Regards,

      Rodrigo S.

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Hi Rodrigo,

      Your user needs a "IoT-MMS-User" role, please follow the documentation SAP HANA Cloud Platform Internet of Things (IoT) Services

      Make sure to have a new session in a browser after assignment.

      Best,

      Pat

      Author's profile photo T. van Rooijen
      T. van Rooijen

      On iPad2 I do not have the post button to start sending data. Does it really have to be an iPhone? Or is something else wrong.

      I am also missing the sending interval input box

      Thanks

      Tom

      Author's profile photo Witalij Rudnicki
      Witalij Rudnicki

      I used it when traveling from Wrocław to Berlin and then back: From Wroclaw to Berlin and back with SensorPhone and SAP HCP IoT

      Btw, the precision of iPhone's GPS was so good, it is ... scary 🙂 You do not think about that when using the phone to navigate, but then seeing how precisely your location is known to the phone and how easy it is to share this information... makes you thinking.

      Author's profile photo Twan van den Broek
      Twan van den Broek

      Hi Patrick

      Thanks for making IoT even a more low barrier entry!!

      Had some issues with the timestamp format, at least that's what the SensorPhone told me. Turned out that I was using an outdated MMS (Message Management Service) within HCP. Deployed the new version and everything works like a charm.

      Again thanks!

      Twan

      Author's profile photo Ulf Kottig
      Ulf Kottig

      Hi,

      great stuff and easy to handle, thanks!

      Any Suggestion for a tutorial how to visualize the data now into nice graphs? I guess there is a Service on HCP already for that?

      regards

      ulf

      Author's profile photo Former Member
      Former Member

      Hi!

      Great post. Works perfectly. May it be possible to share the source code of your iPhone app, especially the part, where the JSON message is constructed and then sent to the HCP?

      Thanks!

      Volker

      Author's profile photo Harsh Vardhan Satsangi
      Harsh Vardhan Satsangi

      Get the error "the message does not conform to the message type".

      I double checked all my settings and also the message type. It is exactly how it was described.

      Did anyone else face this issue? How to see the logs to see why this error happens?

      Author's profile photo Patrick Colucci
      Patrick Colucci
      Blog Post Author

      Hi Harsh, The audio sensor is very sensitive and is a common source of this problem. Please be sure you do not have any headphones plugged into your iOS device, you're not on a phone call, and allow up to 10 seconds for the SensorPhone app to retrieve the audio sensor data before your tap "POST". I hope this helps.

      Best,

      Pat