NanoBeacon™ BLE Scanner Tutorial (Part 3)

Let’s recap what we covered in the previous articles within this series:

  • Requirements, installation, and setup steps for using the mobile app

  • Overview of the different sections within the app

  • Running a few test case scenarios with different advertising data types

  • A detailed look at device filters

  • Differences between the iOS and Android versions of the app

In this particular tutorial, we will focus on one of the most unique features of our app: App Notifications (even in the background) for detecting Triggered Advertising Sets.

So, how do these work? what exactly do we mean by “Triggered”? What are the limitations of app notifications in both versions of the app (Android and iOS)?

Triggered Advertising Sets

Triggered advertising sets allow the user to configure the device to send advertising packets only when certain conditions occur.

This can be very useful in use cases where advertising packets are only needed when one or more conditions are met, for example, the battery level going below 10% or the temperate going over 40 degrees Celsius. In this case, sending advertising data all the time regardless of these conditions (which is what is referred to as “Continuous Advertising Mode” in the NanoBeacon™ Config Tool) would unnecessarily increase battery consumption, so it makes sense to only send them out based on certain conditions.

Here’s a look at the various options available for this mode within the NanoBeacon™ Config Tool:

  1. Triggered advertising event count: this defines the number of advertising events transmitted if a triggered condition is met.

  2. Trigger event will reset triggered advertising event count: enabling this will reset the advertising event count set above in #1, meaning that if any of the trigger conditions are met, it will keep resetting the count and continue sending the advertising packets. Once none of the trigger conditions are met, the advertising event count will start decrementing. For example, suppose this option was enabled, and the trigger condition was a high threshold for internal temperature ≥ 25 deg C, and the temperature surpassed this threshold. In that case, it will continue sending advertising events until the temperature is below the threshold, and then it will only send the number of advertising events set in option #1.

  3. Single trigger, Recurring trigger, Advertise indefinitely after 1st trigger:

    1. Single Trigger: choosing this type will set the behavior to only send the advertising events upon any of the trigger conditions being met just once. If the trigger conditions are met later (during the same power cycle), no advertising events will be transmitted.

    2. Recurring Trigger: choosing this type will send out advertising events every time a trigger condition is met.

    3. Advertise indefinitely after 1st trigger: as the name suggests, choosing this type will send out advertising events indefinitely after any of the trigger conditions are met.

  4. Sensor trigger source: this defines one or more sources for trigger conditions, which are set in the “Global Trigger Settings” section within the NanoBeacon™ Config Tool. Examples of trigger sources include VCC, Internal Temperature, ADC channels, 1-wire sensor readings, and I2C slave readings.

  5. GPIO trigger source: this defines one or more sources for trigger conditions based on GPIO status. The GPIOs available are: GPIO2, GPIO3, MGPIO4, MGPIO5, MGPIO6, and MGPIO7.

Keep in mind that the triggered event will occur if any of the defined conditions are met.

Triggered Advertising Sets on the Mobile App

Now that we better understand how triggered advertisements work and the different options available, we can now test them out to see what they look like and how they behave on both the Android and iOS versions of the mobile app.

Referring back to the previous article, where we covered the differences between the iOS and Android versions of the app, the following is a significant difference related to notifications:

  • Android supports background notifications for all types of Triggered advertisements.

  • iOS only supports background notifications for Triggered iBeacon advertisements.

Due to this, we’ll use iBeacon as the primary test case in this tutorial.

Test Case: Single Advertising Set: Triggered iBeacon

For this test case, we’ll go ahead and define one advertising set as iBeacon and configure it in Triggered mode.

We’ll also define the following configuration parameters, all in the NanoBeacon™ Config Tool:

  • Advertising Interval = 100 ms (to make it easier to discover the advertising sets, in practice, you may want to increase the interval to reduce power consumption).

  • Global Triggers: set the source for Trigger #2 to be Internal Temperature and set the High Threshold to some temperature value that’s greater than the current environment you’re in to be able to manually invoke the trigger condition. I’ve set the value to 3000 (which translates to 30 deg C). Note that the value you enter here will be multiplied by the “On-Chip Measurement Unit” defined in the “On-Chip Measurement Units” section accessible from the main screen of the Config Tool.

  • Set the Advertising Data Format to iBeacon and set the UUID, Major, Minor, and Tx Power values as you’d like.

  • Set the Advertising Mode to Triggered Advertising and enable “High Trigger 2” in the Sensor Trigger Source section.

Once that’s all set, make sure your IN100 development board and programmer board are attached and connected to the computer running the NanoBeacon™ Config Tool.

Now you can Probe the device, select it, and then Run in RAM to run your configuration on the IN100 tag.

Here are some screenshots showing the settings described above:

Now we’re ready to import this configuration into the mobile app. I’ll be using the iOS version for this test.

Using the QR Code display functionality in the Config Tool and the QR Code import functionality in the mobile app, import the configuration:

Now, navigate to the Scanner view within the mobile app and select “Only show project configuration matches” in the filter options. Give that the temperature is below the high threshold condition you set (30 degrees C in my case), you should not see any devices in the list:

As a simple way to enable the trigger condition, you can place your finger (or momentarily point a heat gun) on the IN100 chipset on the development board

If you wait long enough for the temperature to hit the high threshold, the Scanner view in the mobile app should now show the iBeacon advertising set, along with a notification at the top of the screen:

Even if you have the app running in the background and the phone locked, you should see the notifications come through for each Triggered advertising set being discovered:

That’s all you need to do to get notifications for Triggered advertising sets from the mobile app!

Keep in mind that iBeacon is the only Advertising Data Format type that can trigger notifications on iOS devices. On Android, that limitation is not present.

Conclusion & Summary

In this tutorial, we covered how to discover Triggered Advertising Sets and showed how app notifications work in the mobile app.

In the next tutorial, we will go over another unique feature of our mobile app: Logs.

With logs, you’ll be able to view the history of discovered advertising sets and the advertising data contained in them as well as the ability to export those logs outside of the app to your computer or any other device for later analysis!

Previous
Previous

NanoBeacon™ BLE Scanner Tutorial (Part 4)

Next
Next

NanoBeacon™ BLE Scanner Tutorial (Part 2)