S3A7 with Smart Machine and IoT Vibration Monitoring Kit – Quick Start Guide

This tutorial will show you how to get started with the Smart Machine with Vibration Monitoring Kit, which includes the Renesas S3A7, Renesas IoT Sandbox services, and IoT workflows. The purpose of this kit is to monitor the ON/OFF cycles of any machine it is attached to, such as a computer or a fan. An ON/OFF cycle occurs when a machine switches state from on to off, or vice versa.  The board checks for these cycles based on the vibration level of the machine. When the vibration level falls within a certain range, we assume the device is on. If it is outside of this range, we assume it is off. If it goes above the level, we assume the vibration is caused by an impact.

What you need to get started:

  1. S3A7 Kit
  2. WiFi Internet access
  3. Smart Machine with Vibration Image (updated 9-30-16)

Recommended Reading:

 

Step 1: Program The Kit

Before you begin, flash your S3A7 kit with the Smart Machine with Vibration Image 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.

Connect the kit with the Bosch accelerometer as shown, to port J5. Make sure that Jumper 1 is connected to J1 on the bosch accelerometer.  Connect the USB to any power supply.

img_2851

Step 3: Connect the S3A7 kit to the Cloud

Provision the Board for WiFi and 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, enter your WiFi information and Renesas IoT Sandbox API credentials emailed to you when you activated the kit.

pasted-image-at-2016_09_30-08_31-am

  • 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

Restart the board by removing and re-connecting the USB cable. 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.

img_2861 img_2862

Step 4: 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 multiple widgets.  

The second widget is the Real Time Event Log.  This widget will flash messages received from the board.  You can use this as an indicator that the board is successfully connected to the Renesas IoT Sandbox.

Restart the board once again.

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.

fireshot-capture-39-m1-i-dashboard-https___renesas-na-sandbox-mediumone-com__dashboard

screen-shot-2016-09-30-at-10-24-49-am

 

The Real Time Gauge widget will show board connection events and accelerometer data periodically.  

The Line Chart and Table will display changes in acceleration. Refresh this page after the board is connected for some time to see data appear.  Explanation of the data types are explained below. 

Refer to the documentation to learn more about the dashboard and widgets.

Step 5: Configure Workflows

Let the board acquire data for several minutes, depending on the frequency of the ON/OFF cycles to monitor. After a few cycles have occurred, you can specify the upper and lower bounds of the ON state in the workflows to properly analyze the cycles (the vibration level highly depends on the placement of the board and the source of vibrations, so this needs to be adjusted carefully once the board has recorded enough data points).

To make the adjustment, first, click on “Workflows” in the sidebar. Your screen should look similar to this:

smartmachine-workflows

 

Click on the “Data Processing (Update status ON-OFF)” Workflow. The workflow should look like this:

smartmachine_sampleproc

 

Double click on the blue ‘Base Python’ module and look for ‘upper_bound’ and ‘lower_bound’ of the ON state in the script. You may change these values to fit the vibration monitoring of your smart machine.

i.e.

# Upper and Lower threshold for the ON state.

# Below lower bound is considered OFF

lower_bound = 1.3

upper_bound = 2.9

smartmachine_basepython

You can determine these values by viewing the line chart on your Dashboard, and seeing where the value falls when your smart machine is off and where it rises when it is on. Click “Save and Activate.”

Step 6: Daily Reports

You will receive a report daily at midnight with the daily statistics of your vibration monitoring.  These statistics include Current Status, Last Day Activity, Last 7 Days Activity, Lifetime Estimate, and Location.

You can change the email notification setting by sending an event containing the key report_settings.daily_subscribe: set to true or false

To do that, you can use command line such as curl.  Refer to our Getting Started Guide on how to send json events to Medium One.  Here’s the json config you would send to turn on email settings for your project SampleName and your email sample_email:
{“report_settings”: {“email_address”:”sample_email”, “daily_subscribe”: true, “project_name”: “SampleName”}}

 

Step 7: What’s Next

Congrats! You have just created a Smart Machine IoT Vibration Monitoring prototype! The rest is up to your imagination.

 

Appendix

A: Explanation of Data Tags

The following tag are created in this kit.  Please refer to docs.mediumone.com on the meaning of data streams and tags.

Stream Tag Description
raw x_avg, y_avg, z_avg average vibration level per axis
raw x_min, y_min, z_min min vibration level per axis
raw x_max, y_max, z_max max vibration level per axis
raw x_zero_cross, y_zero_cross, z_zero_cross number of times the vibration crossed zero axis
raw sample_cnt number of vibration sample count on device
processed cycle When machine goes from OFF->ON->OFF
processed anomalies increments by when when a vibration level goes above 20% threshold.  Resets daily.
processed average_cycle_length average duration of each cycle per day
processed average_on_time average time (on_time) for each cycle
processed average_on_value average value of xyz_diff over the course of one cycle
processed cycle_above_daily_average_length when cycle length is above daily average by 20%
processed cycle_count current number of cycle for today
processed daily_cycle_count final number of cycles in a day
processed daily_anomalies final number of anomalies in a day
processed cycle_length length of the cycle
processed daily_off_time total time off in day
processed duty_cycle percentage of on_time vs total cycle time
processed status change in status (can be ON, OFF, ON Anomaly, OFF Anomaly)
processed x_diff – movement x axis range: x_max – x_min
processed y_diff – movement y axis range: y_max – y_min
processed z_diff – movement z axis range: z_max – z_min
processed xyz _diff movement all 3 axis added together:x_diff +y_diff +z_diff