S3A7 with BTLE Demo – Quick Start Guide

This tutorial will show you how to get started with connecting two S3A7 boards using BTLE PMODs to Renesas IoT Sandbox.   One S3A7 board will operate in Master mode with a BTLE radio and wifi connectivity to the cloud.  The second board will operate in Slave mode with a BTLE radio and the AMS sensor.  Note this Demo is not intended for production use.

What you need to get started:

  1. 2x S3A7 Fast Prototyping Lit
  2. WiFi Internet access
  3. 2x Renesas RL78MOD modules – Programmed with Bluetooth® Low Energy Protocol Stack BLE Virtual UART Application
  4. BLTE Demo image with S3A7 (updated 9-30-16) 

Recommended Reading:

Step 1: Program The Kit

Before you begin, flash both S3A7 kit with the BLTE Demo image with S3A7 image using this guide: How to flash the S3A7 board

Step 2: Activate Kit in the Renesas IoT Sandbox

Click here to activate the kit and complete the registration process to create a Renesas IoT Sandbox account preloaded with the demo workflows.  Note: It’s important to use the activation link provided since it creates Renesas IoT Sandbox workflows required for this kit.

Configure the Master board

With one of the S3A7 boards, connect the BTLE PMOD to port J6 as shown.

img_2899-copy

 

Configure the Slave board

With the other S3A7 board, connect the BTLE PMOD to port J6 and the AMS sensor to the J18 grove connector.

img_2898-copy

Step 3: Connect the S3A7 kit to the Cloud

Provision the Master

Provision the Board for BTLE and WiFi to Renesas IoT Sandbox API:

  • Power up the board and touch the screen within 10 seconds to boot it up in provisioning mode. The board will become a WiFi Access Point.

img_2856

  • When you see the following screen, connect to the board from a computer via the WiFi network printed at the top of the screen.  

img_2854

  • Once connected, open the provisioning page served by the board by going to  http://192.168.3.1 on your browser.
  • On the provisioning page, select master mode and enter your WiFi information and Renesas IoT Sandbox API credentials emailed to you when you activated the kit.   Note, you’ll need to specify your own 12 character encryption key to pair the BTLE modules.  This encryption key will go in the ‘BTLE slave ID’ field. It is an arbitrary 12-character hexadecimal key, we use this 1a2b3c4d5e6f for this demo.  Make sure this key is identical for both boards.

pasted-image-at-2016_09_30-05_16-pm

  • When you submit the form, you will see the error screen below. This is expected since the board is no longer in provisioning mode

smartchef_page_isnt_working

The screen on the board should look like this:

img_2860

Turn off the board.

Provision the Slave

Provision the other BTLE to the Slave board:

  • Power up the board and touch the screen within 10 seconds to boot it up in provisioning mode. The board will become a WiFi Access Point.

img_2856

  • When you see the following screen, connect to the board from a computer via the WiFi network printed at the top of the screen.  

img_2854

  • Once connected, open the provisioning page served by the board by going to  http://192.168.3.1 on your browser.
  • On the provisioning page, specify slave mode.  Specify the encryption key from the prior step. In this example, we use 1a2b3c4d5e6f to match the previous step.  Make sure this encryption key is identical for both boards.  Specify the sample period in seconds.  We use 5 seconds.

pasted-image-at-2016_09_30-05_17-pm

  • When you submit the form, you will see the error screen below. This is expected since the board is no longer in provisioning mode

smartchef_page_isnt_working

The screen on the board should look like this:

img_2860

Turn off the board

Step 4: Power up

At the same time, Power restart both the Master board and the Slave board by re-connecting the USB cable.  It’s important to restart at the same time because the BTLE pairs during a small initial time window.

Do not touch the screen or you will reenter provisioning mode and have to enter your information again. After 10 seconds, if the Wifi information entered was successful, you will see “Connecting to SSID,” then “Connecting to MQTT,” and then “Connected” status. If it doesn’t get past the connecting to SSID screen or connecting to MQTT screen, the credentials entered were incorrect.

On the slave board, you should see the following printed on the display.  Note the light sensor value from the AMS printed on the display.  The first value is the sample count, the second value is the sensor reading. This may take a few seconds.

Look at the master board and you should see the sensor readings printed on that board as well.  This signifies the BTLE connection is working.

img_2900 img_2901

 

Note, if you do not see these messages, go back to Step 3 to make sure the provisioning is completed properly.

Congrats, you’ve established communication between the two boards via BTLE !

Step 5: Visualize Data On Dashboard

Login to Renesas IoT Sandbox with your web credentials.  Select Dashboard from the left navigation panel.   On the default view, specified in the upper right corner, you will see the Dashboard with a Real Time Events Log Widget.  

Repeat the power up sequence from Step 4.

When the board is connected to Wifi, you should see messages appear in the Real Time Event Log after a few seconds.  If you do not see data, then go back to Step 3 to ensure that you have entered the correct API and MQTT credentials.  Note the data streaming in JSON format.

screen-shot-2016-09-30-at-1-26-40-pm

Next, let’s add a Gauge widget by clicking on the Gauge icon at the bottom of the dashboard.

screen-shot-2016-09-30-at-1-26-49-pm

Configure the Gauge widget: select user “device”, then click on the Gear icon.

screen-shot-2016-09-30-at-1-26-55-pm

Select “raw:light-sensor” and Save.

screen-shot-2016-09-30-at-1-27-06-pm

You will notice a Gauge appear with the light sensor readings.  Please the sensor in a bright location to see a high value.

screen-shot-2016-09-30-at-1-28-02-pm

Cover the sensor with your hands and see the readings drop.  This may take a few seconds.

screen-shot-2016-09-30-at-1-28-27-pm

Step 6: What’s Next

Congrats! The rest is up to your imagination.  Refer to the documentation to learn more about the dashboard, widgets and workflows!