Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

CYW20706 – BLE Low Power Beacon

lock attach
Attachments are accessible only for community members.

CYW20706 – BLE Low Power Beacon

SrikanthN_96
Employee
Employee
25 sign-ins 5 questions asked 10 sign-ins

BLE Beacon: Battery monitoring, low power operation and power save functionalities

Requirements:                                                 

Tool: WICED Studio 5.1 or above, Central device (Eg: CySmart Mobile Application), Serial Terminal (Example: TeraTerm, CoolTerm), Voltage Source, Digital Multimeter

Programming Language: C

Associated Parts: CYW20706

Related Hardware: CYW920706WCDEVAL

What CYW20706 – BLE Low Power Beacon is about?

 

This project demonstrates the use of the battery monitoring, BLE low power mode and power save feature that is available in CYW20706. The project instantiates a BLE beacon that periodically transmits advertisement packets with the current battery level in the advertisement data. The beacon initially starts high duty non-connectable advertisement and periodically checks the battery level. If the battery level falls below the set shutdown voltage threshold, it switches to low duty non-connectable advertisement. After the low duty advertisement times out, the device enter power save mode. In the power save mode, the chip consumes extremely low power, which can be used to extend the life of the beacon till the battery is replaced. An external interrupt or an internal timer can be used to exit the power save mode.

 

Battery Monitor

 

The Battery Monitor driver is used to monitor the battery voltage and decides when to suspend or shutdown the system based upon the threshold values defined by the user. This ensures that the system is able to cleanly shut down and notify the application and/or host before there is not enough power necessary for proper system functionality.

The Battery Monitor can be configured by including wiced_hal_batmon.h header file. wiced_hal_batmon_config() configures the internal ADC to monitor the voltage from one of the specified ADC inputs. In this project, an external voltage source is connected to P37 which emulates the battery input to the system. The batmon driver automatically calculates the battery level of the system depending on the full voltage and empty voltage specified by the user. It is to be noted that the Battery Monitor relies on polling to check on the status of the battery. The poll timer can be configured to control the rate of polling the ADC.

 

BLE Low Power Mode

 

In order to make use of the low power modes available in the CYW20706, you will have to include the wiced_power_save.h header file. A single function call to the wiced_sleep_config() function will enable low power operation of CYW20706. It configures the device to sleep in between advertisement intervals, thereby reducing the average current consumption.

 

Power Save Mode

 

The power save mode is the most efficient power mode available. The device can be pushed to this mode asynchronously from the application. In this project, the system is pushed into power save mode once the voltage falls below the shutdown voltage and the low duty advertisement times out. The system can be configured to wake up by a timeout or by a manual interrupt. In interrupt mode, a GPIO needs to be configured to act as an interrupt. In timeout mode, an internal low power oscillator is configured to wake up the system after a specific time period. Since the low power oscillator is active in the timeout mode, the timeout mode consumes slightly higher power than interrupt mode. It is to be noted that the application will be restarted on exiting out of the power save mode.

How to proceed BLE Low Power Beacon Project?

 

Below is the flowchart of the project,

       pastedImage_3.png

To demonstrate the project, work through the following steps:

  1. Before programming the board, make sure the SW5 DIP switches are in the following configuration:
    1. Switch 1: OFF
    2. Switch 2: ON
    3. Switch 3: ON
    4. Switch 4: OFF
    5. Switch 5: OFF
    6. Switch 6: OFF

This is done so that LEDs D9 and D10 can be turned off to measure the power consumption of the chip.

  1. Connect the external voltage source to P37 (J22 – 5) and set the voltage source to the configured full voltage. (3.3V)
  2. Program the board and open the COM port of PUART. You should now see the debug prints.
  3. Batmon will be polled periodically and high duty ADV will be started. You can now see the ADV packets in a central device. The advertisement data will contain the battery level under Manufacturer Specific section.
  4. Change the voltage on the voltage source and observe the updated value in the advertisement packet.
  5. Reduce the voltage of the source below the shutdown voltage (1.7V) and the system will now start low duty ADV. Once low duty ADV times out, the system goes into power save.
  6. Wake up the system either by interrupt or the device will wake up when the low power oscillator times out. In order to enable/disable the timeout mode, uncomment/comment out the macro TIMEOUT_MODE in the low_power_beacon.h file.

BLE Low Power Beacon Project Configuration

 

The various parameters configured in the project are as follows:

  • Fast ADV interval and timeout: 100ms and 0(infinite)
  • Slow ADV interval and timeout: 1280ms and 10 seconds
  • Tx power: -12 dBm
  • LPO timer period (wakeup from power save mode): 10 seconds

How to measure the current?

 

In order to measure the current during various modes, you will need a digital multimeter.

  • The total current can be measured by connecting an ammeter at jumper J17.
  • The core current can be measured at jumper J9.
  • The IO domain current can be measured at jumper J3.
  • The 2.5V LDO regulator current can be measured at jumper J10.

Table 1: Average currents measured in different low power modes.

 

Active Mode (Wiced sleep is disabled)

Wiced Sleep with High Duty ADV

Wiced Sleep with Low Duty ADV

Power Save mode with LPO

Power Save mode without LPO (only LHL)

WICED Power Mode

Active

PDS

PDS

Timed Wake

HID-off

Average Current (sum of current at   J3+J9+J10)

6.98mA

1.6mA

0.5mA

5.2uA

1.2uA

Average Current measured at J17 7.2mA 1.75mA 0.6mA 5.2uA 1.2uA

 

Note: The current measured at jumper J17 includes current consumed by CYW2070x, Serial Flash, on-board LEDs and few other external peripherals. The sum of currents measured at J3, J9, J10 indicates the current consumed only by CYW2070x chip.

With a current probe, you can observe the current profile as well. The current peaks during transmission of the ADV packet can be observed.

  
pastedImage_14.png

pastedImage_15.png pastedImage_16.png

The above figure is a graphical representation of the advertisement current profile when the CYW20706 is configured for low power. The device enters low power mode in between advertisement intervals where it consumes a few uA of current. It wakes up a few milliseconds before the advertisement interval, in the above figure this number is around 3.4ms. The device then transmits the ADV_IND packet into the air. Once it has sent the advertisement packets on all the 3 channels (unless configured otherwise), it will perform the required post-advertisement processing, in this case it is about 6ms and after this activity device goes back to low power mode.

Expected Results

 

Once you have followed the steps mentioned above, you should be able to see the advertisement packets in CySmart or any BLE scanner. You can observe the dynamically changing ADV packet to note the battery level as show in the figure below,

pastedImage_35.png

Related Documents

 

Table1 lists all relevant application notes, code examples, knowledge base articles, device datasheets, and Component / user module datasheets.

Table 1: Related Documents

Document

Title

Comment

002-18191

AN218191  - WICED™ Quick Start Guide for BT CYW20706

The  Quick Start Guide can be accessed from Project Explorer -> 20706-A2_Bluetooth -> Doc

002-16535

AN216535 - CYW92070xV3_EVAL Evaluation Board Hardware User Manual

The Hardware User Manual can be accessed from Project Explorer -> 20706-A2_Bluetooth -> Doc

             

 

Active Mode (Wiced sleep is disabled)

Wiced Sleep with High Duty ADV

Wiced Sleep with Low Duty ADV

Power Save mode with LPO

Power Save mode without LPO (only LHL)

WICED Power Mode

Active

PDS

PDS

Timed Wake

HID-off

Average Current (sum of current at   J3+J9+J10)

6.98mA

1.6mA

0.5mA

5.2uA

1.2uA

Average Current measured at J17

7.2mA

1.75mA

0.6mA

5.2uA

1.2uA

Attachments
3078 Views
Comments
XuejiaoZ_46
Employee
Employee
5 sign-ins First comment on KBA First reply posted

Hi

I have two questions about the current profile:

pastedImage_0.png

1.There is a current peak when it starts advertising. How can I avoid this peak?

2.What is the sencond pulse in the above figure? It doesn't look like an advertisement event.

Jessica

Anonymous
Not applicable

1) Because the radio gets turned on during advertisement, you will see a peak. It is not possible to avoid it unless you choose to disable advertisement.

2) The second pulse corresponds to the ADC sampling, it has nothing to do with advertisement.

Anonymous
Not applicable

yssusirk

Has anyone had success in using HOST_WAKE to wake up a host?  I would like to wake up a host based on a Bluetooth event.

I have tried going into low power mode, but doesn't seem to work.

Thanks,

John

Anonymous
Not applicable

In am embedded application such as the one above, the HOST_WAKE has to be toggled by the application. The firmware won't toggle the line automatically.

Anonymous
Not applicable

Can you give me a simple code example of how to toggle that?

I have tried using functions in the wiced_hal_gpio.h, but it doesn't seem to work. 

wiced_hal_gpio_configure_pin (GPIO_01, GPIO_OUTPUT_ENABLE, GPIO_PIN_OUTPUT_LOW);

wiced_hal_gpio_set_pin_output(GPIO_01, GPIO_PIN_OUTPUT_HIGH);

My GPIO_00 works as an input, but for some reason GPIO_01 doesn't react to these functions.

Thanks.