AE-CLOUD1 Feb Meetup Tutorial Appendix

APPENDIX A:

Changing the Sample Period and Thresholds

Navigate to the ‘Update Sample Period and Thresholds’ Workflow in the Workflow Studio.

Double-click on the ‘Base Python’ box to view the workflow’s code. Follow the directions in the workflow comments to change either the sample period or threshold.

SAMPLE PERIOD

This is the time before a ‘summary event’ is sent from the board to the cloud. This ‘summary event’  includes the average values across all sensors on the board and will be sent as long as the board is connected. If you change the sample period, you must also change these in the ‘Check if Board is Online’ workflow to ensure that the board online time and vibration on time are accurate:

  • Double-click the ‘Custom’ trigger green box and change the minute interval to the new sample period.
  • Double click the ‘Base Python’ box and look for ‘minutes=15’ in the code. Change this value to mimic the new sample period.

THRESHOLDS

This is the threshold a certain sensor much reach before a ‘threshold event’ is sent.

You must reset the board for any of these changes to take effect.

APPENDIX B:

Changing LED Settings

Navigate to the ‘LED Toggle and Blink’ Workflow

Double-click on the ‘Base Python’ box to view the workflow’s code. In this workflow, an event is sent to the board in the format of ‘L2:’ for toggle or ‘B4:’ for blink. The ‘2’ and ‘4’ specify which LED to toggle/blink. Change this number to

the following values to change the LEDs controlled:

These numbers correspond to the following lights:

  • Green: 1
  • Yellow: 2
  • Green + Yellow: 3
  • Red: 4
  • Green + Red: 5
  • Yellow + Red: 6
  • Green + Yellow + Red: 7

Once changed, you will need to ‘Save and Activate’ and your changes should take place immediately.

APPENDIX C:

Auto-Enrollment

This kit introduces an auto-enrollment process that connects your board with Renesas IoT Sandbox and automatically creates an API user specifically for your board. The username is generated by the unique ID on the board’s chip. The auto-enrollment process takes place in Step 3 of this tutorial when you put the ‘m1config.txt’ file with your credentials onto the board through USB. The new credentials are stored in the data flash. If erased, auto-provisioning it will reset the password.

What if I lost my welcome email with the ‘m1config.txt’?

You will need to re-create it by creating a new .txt file and pasting the following onto each line. The m1config.txt file is in the format:

  1. On the first line, the API Key
  2. On the second line, the MQTT Project ID
    • The MQTT Project ID can be found by clicking on Setup -> MQTT.
  3. On the third line, the MQTT Registration User ID
  4. On the last line, the Registration User Password
    • The Registration User Password was auto-generated so if you lose the email, you will need to reset that user’s password by going to Setup -> Manage Administrators and clicking ‘Edit’ under the ‘Actions’ column.

What if I accidentally delete my user?

If you accidentally delete your user, you can recreate it by auto-enrolling the user again. It will re-create the user automatically although you will lose all the previous data generated.

What if I accidentally delete the registration user?

If you accidentally delete the registered user, you will need to re-create it again if you want to add a new board to your project. To do this, go to Setup -> Manage Administrators. Here, you can click ‘Add New User’ and specify the registration user’s username and password. Only the MQTT ID and password from this user are needed. Repeat step 3 with these new credentials to auto-enroll a new board.

How do I manually provision my board instead of auto-enrolment?

To manually provision your board, complete Step 3 in addition to these next steps. When connecting the board to your Windows computer, it should show up as a USB. Click on the USB folder and create a new .txt file called ‘m1user.txt’. Open this text file. This text file will have a total of two lines:

Line 1 will be the User MQTT ID

Line 2 will be the User Password

See below on how to get these two values.

Sign onto Renesas IoT Sandbox and click on Setup > Manage Users. Click on ‘Add new user’ and type in a username and password then click ‘Save’. The password that you specified to create this user will be Line 2 of ‘m1user.txt’.

Back on the Manage Users page, a new row should’ve shown up. Copy the text highlighted where the red box is. This is the User MQTT ID. This will be on Line 2 of ‘m1user.txt’.

Save the file and wait 2 seconds. Unplug the board and plug it back in. It should now connect. Be sure to select this user’s username in the widgets for the Dashboard.

APPENDIX D:

GPIO

Interrupt driven GPIO input will be transmitted to the cloud to enable external peripherals such as buttons to be easily connected to the board GPIO output: The cloud can control a GPIO pin. On both grove connectors, pin 1 is an interrupt-input, and pin 2 is a controllable output.

#G = GPIO
#G<port>:<pin>:<level>
# for example:
MQTT.publish_event_to_client(‘s5d9’, ‘G4:11:1;G1:1:1’) # sets pin 4_11 high and pin 1_01 high
MQTT.publish_event_to_client(‘s5d9’, ‘G4:11:0;G1:1:0’) # sets pin 4_11 low and pin 1_01 low