Lab 1: Afero Onboarding

This lab walks you through:

  • Setting up an account on the Afero Cloud
  • Connecting a Modulo development board to your account
  • Putting the board through its paces

This lab takes about 30 minutes to complete. Note that the lab illustrates onboarding for a Modulo-2, but the general flow is the same for onboarding a Modulo-1, minus the Wi-Fi setup.

Prerequisites

There are no prerequisites for this lab.

Tools/Materials

Before beginning the lab, you will need:

  • iOS or Android mobile phone, running:
    • Android KitKat 4.4 (API Level 19), or
    • iOS release 9.3
  • Afero Modulo development board
  • Micro-USB cable to power the Modulo
  • USB power source (free USB port on a computer, AC wall adapter, or portable charger)

Setup

Download the Afero mobile app for your smartphone. The links below should take you to the appropriate download page for your device, or you can search your app store for “Afero”:

Users in China should be able to access the app through Google Play because it is a free app. Afero does not distribute the app in any other way because the app stores provide a way to update the app when required.


Steps

  1. Launch the Afero mobile app on your smartphone. To create an account on the Afero Cloud, tap Create Account at the bottom of the screen. Create Account
  2. On the screen that opens, type your name and email address, type a password for your account, then tap Create Account. You will be asked to accept the Terms of Service before continuing.
  3. Remove your Modulo development board from its packaging. Using a standard Micro-USB cable, connect the Modulo to any available USB port to supply power to the board.
  4. In the mobile app, you will be prompted to add a device to your account. Tap Found it? Tap to scan. If you are prompted to allow the app access to the Camera, please allow access: Camera Access and Add Device
  5. Use the Camera view in the app to scan the QR code sticker on the back of the Modulo board.

    If you’re not prompted to add a device after creating an account, but are brought to the application’s main menu, tap the AF button in the center of the screen, then tap Add Device at the top of the menu.

    If you are unable to scan the QR code with your phone’s camera, tap Manually Add Device at the bottom of the screen. Type the hexadecimal code printed under the QR code (don’t type the dashes!), then tap Add.


  6. You will be prompted to allow Location and Notification permissions on your mobile device. Please allow these permissions so the app can provide all its features: Add Location and Notifications
  7. On the next screen, give your Modulo board a friendly name so you can identify it if you have multiple devices.
  8. The Afero mobile app will instruct the Modulo-2 board to scan for available Wi-Fi networks. You will be prompted to select a Wi-Fi network, then type a password to connect to it. Once the mobile app has connected to a network, the Modulo-2 board will attempt to connect directly to the Afero Cloud to ensure it can communicate over the Wi-Fi network. Scanning for Wi-Fi Networks

    If any part of this process fails, you will be given the chance to rescan and reconnect to the Wi-Fi network. If no Wi-Fi network is available, you can click Cancel and then the board will connect only over Bluetooth low energy. In BLE mode, the board will require an Afero compatible hub device or an active Afero mobile app to connect to the Afero Cloud, so make sure the mobile app is running (and that your device isn’t asleep) when interacting with the Modulo-2.


  9. Tap Next and you will return to application’s main screen: Device Added Note that the Modulo icon is a contrasting color, indicating the device is online and connected to the Afero Cloud.
  10. Tap the Modulo icon to bring up the device screen so you can interact with the Modulo. Device Menu
  11. On the LED menu, tap On and Off and observe that the LED turns on and off. Select the Button menu item, and then press the button on the Modulo development board. Note the mobile app UI will update the status of the button as you press it. Also note that the device icon will change color when the LED is on. This is the device’s “primary operation”, which we’ll talk about more in the Using the Afero Profile Editor lab. Device Menu
  12. Tap the Settings menu. On this screen you can:
    • Assign or change the friendly name of the device.
    • Change the Wi-Fi network the device connects to.
    • Edit the device’s location.

    You can also tap Remove Device to disassociate the device from your account. If you do remove the device, to use the device again, you will need to repeat the steps above to add the device back to your account. Device Settings

    The Modulo development board does not have a GPS or any way to determine its location on its own. The location set here is completely controllable by you, and can be used to identify similar devices that may be geographically separated. The location will not change if the device is physically relocated unless you change this location later in the device’s Settings.


  13. Tap the Automation menu. Using the Automation screens you can create simple automation tasks for your Modulo, allowing you to run device tasks without having the mobile app running.

Behind the Scenes

The time between turning on the LED via the mobile app and the device’s response seems fast enough to think that the mobile device is communicating directly with the Modulo board, but this is not the case!

The command to turn on the LED travels from the mobile device to the Afero Cloud (via Wi-Fi or LTE on the mobile device), and then the Afero Cloud sends the command back to the Modulo-2 over its Wi-Fi connection, or for Modulo-1, through the mobile app over Bluetooth.

For the Modulo-2, as long as the board is connected to the network, these interactions will work no matter how far away the devices are.

Extra Credit, for Modulo-2 Boards

If you have time after completing the basics of this lab, here are some ways you can explore additional features of the Modulo-2 and the Afero Cloud:

  1. Turn off Wi-Fi on your mobile device so that it and the Modulo-2 are connected to separate networks (Modulo-2 on Wi-Fi, mobile on LTE). Verify that the device interactions work regardless.
  2. Leave your Modulo-2 and take your mobile device to a different location. Have someone near the Modulo-2 press the button and watch while the mobile app updates the button state even though it’s physically located elsewhere.
  3. Tap the Automation menu and experiment with simple automation steps. Try things like:
    • Have your device turn its LED on at a specific time and notify you that it’s done so. (Hint: You will have to exit the mobile app to receive notifications.)
    • Add a trigger automation to turn the LED on when the button is toggled, and another trigger automation to turn the LED off when the button is toggled off.
    • If you have more than one Modulo-2 board handy, add them to the same account and create a trigger automation so the button on one Modulo-2 will toggle the LED on another. (Hint: You’ll need two automation events, button on = LED on, and button off = LED off.)