Using the Mobile App with the S5D9 Board

Originally posted on the Learn IoT Community site, Dec 2017, by community member Dan Kane


In this tutorial, we’ll walk through the steps required to use the mobile app with the S5D9 IoT Fast Protoyping Kit. To do this, we’ll manually provision the S5D9 board and then set up the mobile app to control both the blink and toggle functions in the intelligent diagnostics application. We will also review the project structure and clearly lay out all of the different credentials involved in using the S5D9 board with the Renesas/Medium One cloud.



There is a complex hierarchy of credentials involved with a Renesas/Medium One cloud project. It is important to understand all of the credentials in order to use the mobile app. Here is a summary:

Account username and password
This is the top level and all projects reside within the account.

Project Name/Project ID
You create the Project Name when you set up the project. The Project ID is auto generated and is exclusively associated with the Project Name you create. The Project ID is never used, however, you’ll need the Project Name to make sure the dashboard is operating with the correct project. You’ll also need it to set up a mobile app profile.

Project MQTT ID
This is auto generated and is exclusively associated with the project name you create. It is included in the activation email you receive after creating a project.

Registration User
This is also automatically created when you create a project. You can add additional registration users later, but there is no need to do so for this tutorial. The registration user handles auto-provisioning for the S5D9 board.

Registration MQTT ID
Auto generated for each Registration User. This is also part of the auto provisioning system, and it is included in the activation email.

Registration Password
This is the final Registration User credential, and it is necessary for auto provisioning. It is included in the activation email you receive.

API User Login ID
This is the base level user. Multiple users can exist in the same project. This user is created automatically for the S5D9 board during the auto-provisioning process. We will create a second user called ‘Mobile’ to use in this tutorial. If you change the password for the user created during auto-provisioning, the system will detect the change and automatically create a new password. That is why we need to create a new user to reliably work with the mobile app. The S5D9 can only communicate with one user at a time.

Separate MQTT ID for each API user. Created automatically when you create a new API user.

API User Password
Set by you when you create a new API user. This password is automatically generated for users created by the auto provisioning system.

The API key is another credential that allows communication between the board and the project in the cloud. Multiple users can share the same API key, which is what we do in this tutorial. It is also possible to have multiple API keys within a project. The API key is included in the activation email.

Here are several subsets of these credentials that you will need while completing this tutorial:

  1. Activation Email
  1. API Key
  2. Project MQTT ID
  3. Registration User MQTT ID
  4. Registration Password
  1. m1config.txt file contents (same as activation email contents)
  1. API Key
  2. Project MQTT ID
  3. Registration User MQTT ID
  4. Registration Password
  1. m1user.txt file contents (to be discussed below – this is for manual provisioning of the board)
  1. API User MQTT ID
  2. API User Password
  1. Mobile Profile Credentials (necessary to point the mobile app to the correct cloud project/board)
  1. Project Name
  2. API Key
  3. API User Login ID
  4. API User Password

Here is a summary of where to find all of these credentials from within the Renesas IoT Sandbox.

Project Name/ID:

Project MQTT ID:

Registration User:

To the right of api_reg above, click on ‘Actions’ and then select ‘Edit’ to see the Registration MQTT ID and Registration Password. Note that in order to see the Registration Password, you have to change it.

API Key:



API User Credentials (click on edit to change the password. Note that in order to view it, you have to change it):



Step 1: Complete the Diagnostics Intelligence Tutorial

After completing the tutorial, make sure that your board is connected and that everything works as expected from the dashboard.

Step 2: Create a New API User

Click on ‘Add New User’ and name the user ‘Mobile’. Make note of the password you set. You will need it later, but there is no way to view it again without changing it.





Step 3: Upload m1user.txt to S5D9 Board

We’ll now create a file called m1user.txt which will override the auto-provisioning function on the S5D9 board. With only the m1config.txt file as in the diagnostics intelligence tutorial, the board registers with the automatically generated API user. The problem that creates is that we need the password in order to use the mobile app, but there is no way to get the password without changing it. If we change the password, the auto provisioning system detects the changed password and then resets it. I discovered this while creating the Mobile DC Motor Control project.

I could use the mobile app for a period of time, but the system would eventually reset the password, and then I’d have to change the password again. Note that the auto-provisioned API User Password is NOT one of the credentials included in the activation email. There is no way to obtain it without changing it.

By creating a new API User that we control, we eliminate the problem.

Using a text editor, create a text file called m1user.txt. The contents of the file are:

API User Password

Once you create the new user in Step 2, you’ll have the password (since you recorded it) and you can find the MQTT ID as shown below:



Disconnect the Ethernet cable from your S5D9 board and then safely disconnect the board from your computer. Reconnect the board USB cable with no Ethernet and drag the m1user.txt file into the same directory that contains m1config.txt. Both files should be present, and the final directory should look something like this:

Note that no changes to m1config.txt are necessary. Those credentials have to do with the registration user and not the API Basic User which we just added.

Remove the S5D9 board and wait several seconds. Re connect the Ethernet cable and then plug the board USB connector back in. Verify that only the green LED is lit indicating that the board successfully registered with our new Mobile user.

Step 4: Test the Mobile User from the Dashboard

On the dashboard, scroll down to the user input widget. There will now be 2 users to choose from. There could be more if you had added other users previously. The long string of characters is the user which was generated during the auto-provisioning process. You’ll also see the user ‘Mobile’ which we just created. First send 5 blinks using the auto-provisioned user and verify that it no longer works. Next, switch to ‘Mobile’ and verify that ‘blink’ and ‘toggle’ work as expected.



Step 5: Create a New Profile In the Mobile App

Recall that in order to create a mobile profile, you’ll need your project name, the API key, the API User ID, and the API User Password. The Project Name is whatever you named the project while going through the ‘Diagnostics Intelligence’ tutorial. In my case it is ‘S5D9 LoginTest’. The API Key is the same one you used for that tutorial. I like to email it to myself and then use copy/paste since it is virtually impossible to type it on a phone without making a mistake. The API User ID is ‘Mobile’ and the API User Password is the password you recorded when you created the Mobile user.

When you open the mobile app, you should see a list of previously created profiles. Click on the “+” to create a new profile.



The blank ‘New Profile’ screen looks like this. It is very important to click on the drop down menu and change it from ‘Sandbox’ to ‘Renesas.’



After completing the form with the necessary credentials, click ‘SAVE.’ Note that ‘Profile Name’ must be the Project Name.



You may need to restart the app, but make sure you get to the profile selection screen and select the new profile we just created.



Once you select the new profile, you should see the following screen. If the “+” sign is red, there is a problem with the profile credentials.



Now click on “+” and add a slider widget.



To configure the widget in Android, swipe it left. Apple may be slightly different, but it can be done. Once you swipe left, you’ll see the following screen. The crossed arrow icon allows you to configure the stream, and the tag icon allows you to configure the tag. For this first widget, we’ll set the stream to ‘raw’ and the tag to ‘blink’ since we want to control the number of red LED blinks using the widget.



First, set the stream to, ‘raw’ and save.



Next, set the tag to ‘blink’ and save.



Now, use the slider to transmit a blink 5 request to the board and verify that the LED indeed blinks 5 times.

Finally, repeat the above steps to add a second slider widget. Configure it to the ‘raw’ stream and ‘toggle’ tag. Verify that transmitting any number greater than zero turns the yellow LED on, and transmitting zero turns it off.

Congratulations! You can now use the mobile app with the S5D9 IoT Fast Prototyping Kit. Remember that the mobile app consumes a large number of credits if you use it to display information. It is best used as we have done here to transmit requests to the cloud. If you need information periodically fed to a mobile device, that is best handled by transmitting a request for information and then having a push notification sent from the cloud to your mobile device.

Next Steps:

To follow up this tutorial, I’ll summarize how to send push notifications to your mobile device.