This tutorial will show you how to connect the Synergy DK-S7G2 kit to Renesas IoT Sandbox.
What you need to get started:
- Synergy DK-S7G2 kit
- Ethernet access with DHCP
- iOS or Android
- ConnectedWeatherPanel-DKS7.srec – Download (Last Updated September 26, 2016)
Step 1: Program the Connected Weather App
Program the Connected Weather App image to the DK-S7G2 board using the How to flash the DK-S7G2 board guide listed in the prerequisite.
Step 2: Activate Kit in Renesas IoT Sandbox
Click here to activate the kit and complete the registration process to create a Renesas IoT Sandbox account preloaded with the Connected Weather Workflows.
Once activation is completed, you will receive an email with your Renesas IoT Sandbox account credentials which you will need to provision the kit and access the cloud portal.
You will receive a second email with your Connected Weather project information including:
- API Key
- MQTT project, MQTT user id and password for the device
- API login and password for the mobile app
IMPORTANT: You will need this information below.
Step 3: Provision Kit with Credentials
Connect the ethernet cable to J4 and power up the board by inserting the 5v power cable into J1 (shown below).
Once the weather panel is displayed, the LAN IP address printed on the top right of the board will display.
Make sure your computer is connected to the same network as the board. From your computer’s browser, type in the IP address of the board. This will load the provision page.
On the provisioning page, enter the Renesas IoT Sandbox API credentials emailed to you when you activated the kit and click Connect. You will be redirected to an error page, this is expected.
Restart the board.
Step 4: Connected Weather
When the board is connected, you will see the location and weather forecast displayed on the screen. This is detected by the IP address of the board using the Renesas IoT Sandbox.
Step 5: Visualize Data On Dashboard
Log onto Renesas IoT Sandbox using the web credentials emailed to you. If you already have a Renesas IoT Sandbox you can use your existing account.
Once logged in, click on Dashboard on the left panel.
The gauge will show set temperature from the board.
The last value table will display weather and location information.
The User Input widget will set the desired temperature and has the effect of the board sending the data.
Map will show city level accuracy of the board location based on IP address.
The real-time chart will log data events as they are received from the board.
TIP: You can build your own dashboard by adding the widgets at the bottom of the screen. Remember to click “Save”.
Step 6: Connect to Mobile
We recommend reading the Mobile App Guide to get the basics. You can download the mobile apps at medium.one/mobile.
The App allows you to build custom dashboards. The UI may look different from iOS and Android but the concept is similar.
Add your API credentials from the welcome email you received so the Dashboard knows which account it is connected to. Select ‘Renesas’ to connect the app to the Renesas IoT Sandbox and click ‘Done’.
Add a Gauge.
On iOS, click on the Gauge icon to show the popup configurator. On Android, slide the widget to the left. Set Temperature: stream = “raw” and tag = “temperature” and click Done.
The Gauge will now show the temperature setting by the board.
TIP: Recommend reading the Mobile Getting Started Guide to learn how to use all the widgets.
Specify the same API credentials used for your device. This should be in the welcome email sent to you.
Step 7: Set Temperature
On the DK-S7G2 board, you can change the temperature by clicking the + – buttons. In doing so, you can view the changes in Renesas IoT Sandbox as well as the mobile app if it is connected.
To view the temperature changes on Renesas IoT Sandbox:
- Go onto the dashboard and scroll down to the ‘Real Time Gauge’ widget
- As you adjust the temperature on your DK-S7G2 board, you should see the temperature reflected on the ‘Real Time Gauge’ widget
To view the temperature changes on your mobile app:
- Make sure you’ve completed the necessary steps from Step 6 above
- In Step 6, you should’ve configured a Gauge widget to temperature
- As you adjust the temperature on your DK-S7G2board, you should see the temperature reflected on the Gauge widget in your mobile app
In addition to changing the temperature on your DK-S7G2 board, you can also view the temperature as you are changing it on the mobile app:
- Make sure you’ve completed the necessary steps from Step 6 above
- Click ‘Add New Widget’ and select the ‘Slider’ widget
- Click on the slider icon on the left to configure it. For stream, type in ‘raw’. For tag, type in ‘set_board_temperature’.
- Slide the controller to set a numerical value for the temperature
- Once you let go of the controller, an event should be sent and the board should now display the value you’ve selected
- The gauge on the mobile app should be updated as well
Step 8: Workflows Explained
The Connected Weather kit is provisioned with the real-time workflows that trigger on events from the board. To view the workflow, click on Workflow Studio. You will see two workflows.
Here’s a brief description on the functionality of each workflow.
Workflow: Get Weather and Location
This workflow will trigger when the DK-S7G2 board successfully authenticates and connects to the Renesas IoT Sandbox. The retrieves the IP address from the board and gets the location and weather information.
Workflow: Set Board Temperature
This workflow will trigger when the you send the tag raw.set_board_temperature. It will push to the DK-S7G2 board over MQTT and then the board will update its temperature value and echo back to raw.temperature.
Workflow: Send Push Notification
This workflow monitors the thermostat temperature set by the user on the touch screen. When the temperature is set to above 90 degrees, a push notification is send to the user’s mobile app.
Workflows are written in Python. To open a workflow, let’s double click on the Get Weather and Location workflow.
TIP: The green box labeled “raw:ip_address” is the event trigger.
TIP: The orange boxes are generated events from this workflow
Next, double click on the Python green box to view the workflow code.
Step 9: What’s Next
Congrats! You have just setup the Connected Weather Demo! Next, we recommend you try this tutorial: Create A Workflow To Send Email Triggered By The Mobile App
The rest is up to your imagination.
Here are some advanced tutorials in the Appendix.
A: Build and Compile Project
This section explains how to open the project, build and run the project in E2 studio. This tutorial assumes you have E2 Studio installed.
Download the Synergy Project from www.renesas.com/synergyapplicationprojects .
Open E2 Studio, then click File -> Import.
Select “Existing Projects into Workspace” in the Import dialog box, then Next.
Click “Browse” beside the “Select root directory” dropdown.
Browse and select the ConnectedWeatherPanel folder you downloaded from github.
Then click Finish on the Import dialog box to import the project.
Once import is complete, you’ll see the project in E2 Studio.
To build the project, right click on the project “ConnectedWeatherPanel” and select Build Project. This will start the build process and could take a few minutes.
To debug the project, make sure the USB cable is connected to your computer and the debug port of the board. Then click on on the tool bar to debug and run the project.