AE-CLOUD1 Feb Meetup Tutorial Part 3

# Copy and paste this script into the “script” text area:

import Store

import datetime
import json

def get_current_iso_time():
   dtnow =
   dtutcnow = datetime.datetime.utcnow()
   delta = dtnow - dtutcnow
   hh,mm = divmod((delta.days * 24*60*60 + delta.seconds + 30) // 60, 60)
   return "%s%+03d:%02d" % (dtnow.isoformat(), hh, mm)

histogram = IONode.get_input('in1')['event_data']['value']

max = 0
count = 0
total_energy = 0

for bin in histogram:
   if bin > max:
       max = bin
   total_energy = total_energy + bin
   average = total_energy/count

ratio = total_energy/max

voice_detected = 0
if max > 200 and ratio < 120:
   voice_detected = 1

if voice_detected:
   IONode.set_output("out1", {"last_voice_detected": get_current_iso_time()})

Click ‘Save and Activate.’

You’ve just created a workflow that will output an event with the tag “last_voice_detected” with the value of the time-stamp whenever your board detects a voice.

Note: It will take 15 minutes to populate the ‘last_voice_detected’ processed tag; the time interval is set in your ‘Update Sample Period and Thresholds’ workflow. If you want to reduce the sampling rate, view appendix section. Note that lowering sampling period increase the usage of free credits. Alternatively, you can skip the following step and come back to after the specified time period.

To test this workflow, navigate back to the Dashboard. The first widget should be the Last Value Table. Click on the “Tag Config” settings gear icon. Locate “processed:last_voice_detected” and click on the checkbox next to it. Save. If you cannot find the tag, you may need to refresh the page.

A new row should have been added to your Last Value Table widget with the time-stamp of the last time voice was detected.

Trigger this workflow by speaking to the board. The mic on the board may not be as sensitive so you may need to hold it up to speak into it.

After a moment, the “processed:last_voice_detected” value should have been updated with a new time-stamp.

Remember to click on the ‘Save’ icon to keep this new addition to your Dashboard.


The first step to set up your daily report is to add your email to the workflow. To do this on Renesas IoT Sandbox, click on ‘Workflow Studio’ on the sidebar. Next, click on the ‘Daily Report’ workflow:

Inside of the workflow:

Double-click on ‘Base Python’ box to edit this workflow’s code. After the import lines, you should see a line:

“recipients = ‘’”

Replace with your email. Click ‘Save and Activate.’

Now that you’ve got your email in the workflow, you can trigger the workflow to get a report. By default, the workflow is triggered daily at midnight (PT). If you wish to change this time, double-click the box labeled ‘Daily’ and change the settings there. For the tutorial, we will trigger this workflow now by sending the event {“sample_report”: 0} through the Dashboard.

Back on the Dashboard, scroll down until you see the User Input widget like below. Your board’s username should already be selected.

To trigger the Daily Report Workflow, click the ‘Send Event’ button that is under ‘Send Sample Report’.

After a few seconds, you should have received a Daily Report in your email with statistics of the past 24 hours. This report shows Temperature, Pressure, Humidity, Noise, and Vibration levels in Bar Charts. The sensor values are averaged and bucketed per hour.  There are also two pie charts that show the vibration status and board online status percentage. Lastly, there is a Geo map that provides your location based off of your IP address. Here is a sample report:

Note: Your graphs may look more blank if your board hasn’t been connected for the full past 24 hours.


Congratulations! You’ve successfully connected your AE-CLOUD1 board and sent data to the Renesas IoT Sandbox. You are now familiar with AE-CLOUD1 Fast Prototyping Kit, Renesas IoT Sandbox platform, and just tapped into the possibility of exciting new projects.  To add over-the-air (OTA) firmware update capability, continue on to the AE-CLOUD1 OTA Tutorial.