Lab 1: Afero Onboarding

This lab walks you through:

  • Setting up an account on the Afero Cloud.
  • Connecting a Modulo-2 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 any Afero development board, with the Wi-Fi setup included only if your board’s radio supports Wi-Fi.


There are no prerequisites for this lab.


Before beginning the lab, you will need:

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


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.


  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-2 from its packaging. Using a standard Micro-USB cable, connect the dev board 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. On the screen that appears, tap Connect New Device at the bottom of the screen: 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-2.

    If you’re not prompted to add a device after creating an account, but are brought to the application’s main menu, tap theicon at the top-left of the screen to open the app Settings screen, then tap Add Device in 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 Add Device screen. Type the hexadecimal code printed under the QR code (don’t type the dashes!), then tap Add.

  6. On the next screen, give your development board a friendly name so you can identify it if you have multiple devices.Give Device a Friendly Name
  7. You will be prompted to allow Location and Notification permissions on your smartphone. Please allow these permissions so the app can provide all its features:Allow Location and Notifications
  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. Once your device connects, tap Continue and you will return to application’s main screen: Device Added

    Note that the Modulo-2 dev board icon is an orange color, indicating the device is online and connected to the Afero Cloud. (The icon will be grey if the device is not connected.)

  10. Tap the Modulo-2 dev board icon to bring up the device screen so you can interact with the board.

    Notice the “groups ribbon” running horizontally at the top of the screen; swipe left/right to reveal the groups you created, as well as to access the Settings and Automation screens. Below the groups ribbon, the selected group’s controls are displayed.

    Device Menu
  11. Select the LED group from the groups ribbon, then tap On and Off and observe that the dev board LED turns on and off. Also note that the device icon will change color when the LED is on. This happens because the LED on/off control has been defined as the device’s “primary operation”, which we’ll talk about more in the Using the Afero Profile Editor lab.

    Select the Button group from the groups ribbon, then press the button on the dev board. Notice how the mobile app UI updates the status of the button as you press it.

  12. Tap Settings, located in the groups ribbon. 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 and later want 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-2 development board does not have a GPS or any way to determine its own location. 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 Automation, also located in the groups ribbon. Using the Automation screens you can create simple automation tasks for your dev board, 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 smartphone is communicating directly with the Modulo-2, but this is not the case!

The command to turn on the LED travels from the smartphone to the Afero Cloud (via Wi-Fi or LTE on the smartphone), 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 smartphone 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 smartphone 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.)