Refrigerator Vibration Project with S3A7 IoT Fast Prototyping Kit

s3a7

#1

For this project, I will be using the Renesas S3A7 IoT Fast Prototyping Kit to perform vibration analysis on my family refrigerator.

I will use the Smart Machine with Vibration Sensor demo provided by Renesas as a starting point for this demo. My hope is that I will be able to determine through vibration, how often the refrigerator compressor cycles, how often the freezer and refrigerator doors are opened and how much ice is made and consumed. I expect each of these events to produce a different vibration signature which I will be able to detect and analyze with the S3A7 and the IoT Sandbox.

I will document all of the steps necessary to get the S3A7 kit up and running on the IoT Sandbox. By the end, we will have a functioning vibration sensor we can monitor in realtime from our own IoT Sandbox dashboard.

Lets Begin!

What you’ll need

For this project you’ll need a Renesas S3A7 IoT Fast Prototyping Kit as well as access to the internet. You’ll also need a local WiFi network for connecting the S3A7 board to the clould after it’s configured.

Below is a snapshot of the S3A7 board, PMOD vibration sensor, a 6” PMOD pigtail and Renesas USB power supply. I originally thought I’d need the pigtail to properly place the sensor but after trying it, I decided to stick with the sensor plugging directly into the S3A7 board as shown in photos throughout this tutorial. Note the position of the jumper in the second photo. This is the proper position for this demo.

The PMOD vibration sensor seemed to fit at a little bit of an angle to the S3A7 board. The angle causes the sensor to lift off of the surface slightly.

I’m guessing each board will be a little different so this may not be an issue for all. I felt like it might not make good contact with the refrigerator as-is so I needed to find a way to get the sensor down in solid contact with the refrigerator.

A simple solution was to shim up the far side of the S3A7 board to allow for the vibration sensor to make full contact with the refrigerator. The shim I used was a spare pencil eraser.

It’s a little bit hard to see in the photos but the sensor is now as flat as possible. The header pins poke through to the far side and prevent a completely flush fit but it has proven to work well as-is so far.

Recommended Reading

The links below provide very helpful information for getting started with the S3A7 board on the Renesas IoT Sandbox site. I strongly encourage you to read through all getting started guides before continuing. In fact, much of the content that follows was generated by simply following the instructions contained in these documents.

Renesas IoT Sandbox Getting Started Guide
http://renesas-docs.mediumone.com/
Renesas Smart Machine Monitoring Kit QuickStart Guide
http://renesas-blog.mediumone.com/smart-machine-with-iot-vibration-monitoring-kit-quick-start-guide/
How to flash the S3A7 Board
http://renesas-blog.mediumone.com/how-to-flash-the-s3a7-board/
Smart Machine with Vibration Image
https://github.com/Medium-One/vibration-monitor-s3a7/releases/download/1/s3a7-smart-machine.srec

Setup Free Account on IoT Sandbox Site

Navigate your browser to this link (https://app-renesas-na-sandbox.mediumone.com/login) and choose the “sign up for a free instant account” button.

Enter your information.

Note: use something benign for the project name. Its not important but as of this writing, it is not possible to delete projects. You will have an opportunity to create more meaningful names for specific projects later.

Select “Create Account” button.

We now need to activate the board on the IoT Sandbox site. Navigate your browser to this link (https://mediumone.com/partner/activaterna.php?partner=renesas&boardtype=s3a7&kit=vibration).

Enter the required information to activate your S3A7 board on the IoT Sandbox site (Note: This is where you should enter a meaningful name for your project). Doing so will automate creation of your first project using the smart machine vibration template. As a result, you will receive an email containing important key codes you will need to enter into your hardware to connect to the site and your project.

You will receive an email from “Renesas IoT Sandbox Team” with the subject as shown below.

A sample of the email content is shown below.

There are four key codes that are required to be entered into the hardware so that your data can be routed to your project on the IoT Sandbox site. Pay extremely close attention to these codes when entering them into the hardware. The codes are case sensitive and are also sensitive to any leading or training spaces (there should be none). I suggest using copy and paste to move the codes into the hardware as ANY small error will prevent the device from connecting.

Re-flashing the S3A7 board with the Smart Machine image

The standard S3A7 board comes with the Smart Chef image pre-installed. For this demo, we need to re-flash the board with the Smart Machine image. To do this we will use the supplied Segger Jlink JTAG programmer and the provided Renesas Smart Machine image file. If you don’t already have it installed, you will need to install the “Jlink Software and Documentation Pack” from the following link (https://www.segger.com/downloads/jlink).

Once the software is installed and the programmer is connected to the computer, you should see automatic driver installation as shown.

To start the programming process, navigate to “Start – Programs – SEGGER – J-Link Vxxx” and choose the J-Flash Lite application.

See the “How to Flash the S3A7 Board” link in the recommended reading section for more detailed instructions on how to install the J-Link software.

When the program starts, you will see a small window for inputting target device, interface type and speed.

Click the button in the Device window to bring up a second dialog for selecting target device type.

For this demo we need to select the “R7FS3A7” Cortex-M4 device.

Select OK to continue.

After selecting the device type, choose “JTAG” on the interface pull down menu and set speed to “6000”.

After pressing the OK button to continue, the window changes as shown and several new options appear: Data File, Erase Chip and Program Device buttons.

If you have not already, download the Smart Machine image from the following link (https://github.com/Medium-One/vibration-monitor-s3a7/releases/download/1/s3a7-smart-machine.srec). Click the button in the Data File window and navigate to your downloads folder. Select the “s3a7-smart-machine.srec” file.

When your hardware is connected as shown below, press the program device button on the J-Flash Lite software.

A window will popup providing progress information during the flashing process. Once the process is complete this window should disappear and there will be a message in the J-Flash Log window which reads “Programming done”. Now disconnect the programmer and reboot the S3A7 board. If your board fails programming, look at the log for clues as to why. Possible causes are wrong device type, wrong programming interface type or speed, S3A7 board is not powered on or drivers did not successfully load for the programmer.

S3A7 Board Setup

On rebooting the board, the initial display will appear as shown above. There may be slight variations depending on the version of the image used. At this point, do not let the device fully boot. Click the button to enter board setup. Nothing bad will happen if the board boots, it just won’t do anything and you’ll have to reboot it again anyway.

On entering board setup, you will notice an SSID and wireless Key displayed at the top of the screen and an IP address at the bottom.

The board is acting like a wireless access point now. You need to go to your computer’s wireless connection menu and select the new wireless access point named “iot-wifi-jvOU_U” (your board’s SSID may vary). Enter the wireless key provided and your computer should connect to the board’s wifi network.

Once your computer is connected to the board’s WiFi access point, navigate your browser to the provided IP address (192.168.3.1). The board serves the page shown below.

This is where we will enter the credentials sent to us in the email from Renesas IoT Sandbox Team. This is a critical step and care must be used to ensure the correct key is entered on each line.

The suggested method is as follows:
1)Open the email before switching to the board’s SSID
2)Switch to the boards SSID
3)Open webpage at 192.168.3.1
4)Cut and paste each line from the email into the appropriate line on the webpage using caution to avoid leading and trailing spaces.

Finally, enter your local WiFi network SSID and WiFi password in the spaces provided.

Press “Connect” button to save changes.

Reboot the board for the changes to take effect.

On booting the same initial screen appears.This time, wait 10 seconds to allow the device to fully boot into Smart Machine mode. The display should appear as shown after boot-up is complete.

Immediately following the initial boot screen, you will notice the device displaying a series of messages. If everything goes normally, the device will progress from Connecting to SSID,

to Resolving IP address,

to Connecting to MQTT,

and finally Connected.

“Connected” indicates the device is connected to the IoT Sandbox and is logging data. If the device hangs at Connecting to SSID, check your local WiFi credentials. If the device hangs at Connecting to MQTT, you need to check the IoT Sandbox credentials you entered from the email. I initially used my iphone to load the keys and had issues with leading and trailing spaces. The safest way to enter the codes is on a PC as described earlier in this post.

Refrigerator Installation

Now its time to install the board on the refrigerator. I have limited options due to the tight fit of the refrigerator in the cabinet opening so I’ll be installing the sensor on the top of the fridge.

This location allows for an out of the way installation where I can still provide power to the unit yet the unit will be out of the way of daily life. You can see from the picture below that the vibration sensor is making good contact with the top of the fridge.

Reviewing Data on the IoT Sandbox Site

With the board powered up and displaying “Connected”, its time to go back to the IoT Sandbox site and inspect the incoming data. Log into the IoT Sandbox site (https://app-renesas-na-sandbox.mediumone.com/login) and verify that “MyRefrigeratorVibrationDemo” ( substitute your project name here ) is active.

You will notice the project initializes to the “Dashboard” view and there are two “widgets” active by default (based on the template we used to activate the board). They are Line Chart and Real Time Events Log. You should see a few lines on the line chart and the Real Time Event Log should update every minute or so as new data is received.

The two default widgets are great but there is another widget that can help us quickly parse large sets of vibration data. Scroll to the bottom of the Dashboard page and find the Add Widget pallet

Choose to add the “Single User Cross Filter Chart”. This widget will allow us to simultaneously filter data based on time of day, date, and data values.

Under the Cross Filter Chart widget, select date range as “Today” using the pull down on the top right hand side.

Next, move your cursor to the middle graph called “date range”. Notice your cursor change to a crosshair. Now click and drag your cursor to highlight a “window” around the desired date range to inspect data.

Notice above I have highlighted the far right cluster of data. After doing so, the data now shows up in the lower window vs time.

Next, move up to the time of day window and drag and highlight a range of times to filter over.

Notice above I have highlighted the time period from 12 midnight to 7am. Notice the data being displayed has automatically changed to reflect the new filtering. From this data I can infer that the refrigerator compressor was cycling on and off many times causing a low level vibration ( this is a relatively new fridge ) and the two larger events, approximately 3 hrs apart, were times when the ice-maker dumped ice into its reservoir.

I suspect my analysis of the data is correct but wouldn’t it be nice if I didn’t have to actually manually count the compressor cycles or ice dumps or times the door was opened or closed? This is where the workflow studio comes in handy.

Click “Workflow Studio” on the left hand navigation menu to enter the workflow studio.

This is the area where you can create scripts to handle incoming data and display or act on it accordingly. As an example select the “Data Processing (Update status ON-OFF)” workflow.

Three colored blocks are visible. Green is the input data, blue is the python processing block and orange is the output block. In this case, processed:xyz_diff is an input to Base Python which has one input and one output. The Base Python output runs to Processed Stream – Single.

Double clicking on the blue Base Python block opens it up for inspection.

With the Base Python block open we can see that it contains a python script. This script is used to determine the status of the equipment being measured. Is it ON or OFF? This output is then further used by other workflows to process additional data.

Please see the Getting Started Guide at (http://renesas-docs.mediumone.com/) for more information on workflows and how you can build custom workflows to suit your particular project needs.

Summary:

In this post, we created an account on the IoT Sandbox, activated and configured our S3A7 board to work with a new IoT Sandbox project and finally performed basic vibration analysis on our refrigerator using the IoT Sandbox workflow studio.

I’m planning a follow-on tutorial to create custom workflows to analyze my refrigerator vibration data to determine how often the door is opened, how often the compressor cycles each day and how much ice my family is consuming. It probably won’t change our habits but it should be a fun way to demo what is possible with workflows on the IoT Sandbox.

I hope you found this post useful. I had fun putting it together and learning about the IoT Sandbox and the S3A7 board. This is my first post so helpful hints and advice are appreciated. Also, please advise if you find any typos or incorrect links etc.

Finally, special thanks to Joyce Li for her excellent tutorials on the S3A7 board, without which, my post wouldn’t have been possible.

Good Luck and Have Fun!


Learn IoT MeetUp - Apr 19 in San Jose
Problems Configuring S3A7 API Keys From iPhone
SK-S3A7 Tutorials