APPLICATION NOTE AND9310/D Duty Cycle and Power Optimization Revison 2 2 Table of Contents 1. Duty Cycle .................................................................................................................................... 3 1.1. General............................................................................................................................................... 3 1.2. Hardware description ...................................................................................................................... 3 1.3. Software description ........................................................................................................................ 4 Dynamic RSSI threshold level calculation .................................................................................... 5 1.4. Duty cycle with AX5051 ................................................................................................................... 6 Scenario with 100kbit/s .................................................................................................................... 7 Other scenarios ................................................................................................................................. 8 2. Conclusion .................................................................................................................................... 9 3. Appendix .................................................................................................................................... 10 3.1. References ....................................................................................................................................... 10 AX5051 downloads ......................................................................................................................... 10 www.onsemi.com AND9310/D Duty Cycle 1. Duty Cycle 1.1. General Consider a battery powered device (target), which should receive data from a second device (initiator) from time to time. To reduce power consumption, the target switches its receiver on for only a short while, checking if there is any RF activity, and returns to sleep if there is no data to receive. target initiator Figure 1 definition of initiator and target Current consumption The ratio of the time ton during which the target is powered on, to the time toff during which the target is powered off is called duty cycle. If for example the target is powered off for 1 second, powered on for 1 millisecond, powered off for 1 second and so on, its duty cycle is 1:1000. ton toff device is on device is in SLEEP mode Figure 2 time illustration of duty cycle 1.2. Hardware description The hardware used in this document consists of an AX5051 evaluation board that is plugged into a suitable controller board, containing a PIC16F886 microcontroller from Microchip. The microcontroller is required to configure and control the AX5051 transmitter. www.onsemi.com AND9310/D 3 4 Duty Cycle AXSEM AX5051 Microchip 16F886 Figure 3 hardware used for duty cycle measurements The PIC16F886 has a feature called ‘Ultra low power wake up’ (ULPWU). With this feature, an external capacitor is charged when the system is running, and discharged when the system is in sleep mode. When the condensator voltage reaches a defined level, the processor is woken up by an interrupt. This feature is very suitable for duty cycle applications. 1.3. Software description The software demonstrates how duty cycle can be implemented in software. The software can be compiled for the transmitter or for the receiver. When defining CONST_TX, the source code will be compiled for the transmitter, if CONST_RX is defined, the source code will be compiled for the receiver. Make sure, only CONST_TX or CONST_RX is defined at one time. The transmitter sends a 1.2s long preamble every time a button is pressed. After the data is transmitted, it enters sleep mode and consumes only 650 nA. The receiver is in sleep mode too, but it wakes up every second. First the crystal oscillator needs to be switched on. This can take 1.7ms. After the crystal oscillator is running, the receiver is switched on and the program checks if the RSSI is above the defined threshold. If this is the case, 5 bytes of data are received, to check if there is a valid preamble present. If the transmitter is sending data at that time, the receiver will be switched on, until the data is received. This will take max. 1.2 seconds. After this the receiver is switched off, and the controller enters sleep mode again. See Figure 4 for an illustration of the flow during the wake up phase. RSSI above threshold? wake up yes valid preamble? yes no receive data no sleep power down 145 us 500us @ 100kbit/s Figure 4 max 1.2s flow during duty cycle wake up www.onsemi.com AND9310/D Duty Cycle The software was compiled and tested with sdcc. To compile the code, please install the gputils (http://gputils.sourceforge.net), and modify the makefile according to your system settings. For downloading and debugging, the MPLAB IDE from Microchip was used together with the MPLAB ICD2 programmer/debugger. Important Make sure, that when porting the software to another platform, calling delay(x) will keep the processor busy for x ms. The delay must be exact, otherwise some parts of the program may not work correct (e.g. starting the crystal oscillator). As mentioned above, CONST_RX and CONST_TX must be defined before compiling the code. The PIC16F886 has a hardware stack, so the number of function calls is limited to only a few levels. Because of this fact, the whole state machine is implemented in the main loop. Avoid calling functions within other functions whenever possible! Dynamic RSSI threshold level calculation There are several problems with a fixed RSSI threshold level. If it is set too high, valid data arriving with low levels will not wake up the target, even if it could have received the data correctly. Loss of sensitivity is the result. The other problem arises, when the RSSI level is set too low. In this case, the RSSI check will always be positive, thus the target will stay in RX mode longer than required. Higher current consumption is the result. There is a trade-off between sensitivity and current consumption that must be considered by the developer. There is no RSSI threshold suitable for every situation. Consider a situation, where the target is placed in a very noisy environment. This will require a higher RSSI threshold than if the target is placed in an environment where the background noise is low. For targets, that change the location regularly (car key for instance) it is required, that the RSSI threshold is adapted dynamically. This can be done by averaging a certain number of RSSI values that where calculated in previous wake up phases. www.onsemi.com AND9310/D 5 6 Duty Cycle 1.4. Duty cycle with AX5051 All results in this document are obtained by using the AX5051 as an RF receiver, which is being switched on every second. At first the RSSI is checked against a predefined threshold to determine if there is any RF activity present. If not, the AX5051 is switched off immediately by the microcontroller. Otherwise 5 bytes have to be received to determine if a valid preamble is present. To wake up the receiver, the transmitting unit needs to transmit a preamble which is longer than the time toff. There are three stages used: Sleep, crystal startup and receive: Sleep Microcontroller and receiver are switched off for nearly one second. To wake up the microcontroller from sleep, a low power oscillator is required. The power consumption of the microcontroller in sleep mode was measured to be 0.65uA. The current consumption of the AX5051 in power down mode was measured to be 0.73uA. Crystal startup When the AX5051 comes out of power down mode, it takes some time until the crystal oscillator settles on its nominal frequency of 16MHz. The time until the crystal is fully settled, was measured to be 1.7ms. The current drawn by the controller was measured while it was running at full speed (8MHz). Receive After the crystal has settled, the receiver is switched on. At first the RSSI is calculated to see if it is above the defined threshold. If not, sleep mode is entered immediately. Otherwise 5 bytes are received, to check if a valid preamble is present. All diagrams in this document assume that no valid preamble is present (which is the normal case). To provide a general impression, the currents drawn by the AX5051 and the microcontroller where measured separately. Note that the microcontroller’s current consumption is device specific and must be evaluated individually. www.onsemi.com AND9310/D Duty Cycle Scenario with 100kbit/s 145 us 100 kbit/s with RSSI below threshold 750 uA 22.2 mA average current consumption PIC16F886: 2.03 uA AX5051: 5.14 uA total: 7.17 uA 1.7 ms 998.2 ms 0.65 uA 750 uA 0.65 uA 702 uA 0.73 uA Sleep 0.73 uA Crystal startup Figure 5 Receive Current consumption with 100kbit/s, RSSI below threshold 500 us 100 kbit/s with RSSI above threshold 750 uA 22.2 mA average current consumption PIC16F886: 2.3 uA AX5051: 13.02 uA total: 15.32 uA 1.7 ms 997.8 ms 0.65 uA 750 uA 0.65 uA 702 uA 0.73 uA 0.73 uA Sleep Crystal startup Figure 6 Receive Current consumption with 100kbit/s, RSSI above threshold www.onsemi.com AND9310/D 7 8 Duty Cycle Other scenarios Table 1 compares the current consumption for different bitrates. Note that the current consumption for every bitrate choose is equal, if the RSSI is below the threshold. This is due to the fact that calculating the RSSI is independent of the bitrate. bitrate [kbit/s] AX5051 current [uA] PIC16F886 current [uA] total current [uA] RSSI low RSSI high RSSI low RSSI high RSSI low RSSI high 1.2 (FSK) 5.14 744.12 2.03 26.98 7.17 771.09 4.8(FSK) 5.14 189.14 2.03 8.24 7.17 197.38 9.6(FSK) 5.14 96.64 2.03 5.12 7.17 101.76 38.4(FSK) 5.14 27.27 2.03 2.78 7.17 30.05 100(FSK) 5.14 13.02 2.03 2.3 7.17 15.32 250(FSK) 5.14 7.69 2.03 2.12 7.17 9.81 400 (ASK) 5.14 6.36 2.03 2.07 7.17 8.43 600 (ASK) 5.14 5.62 2.03 2.05 7.17 7.67 Table 1 Average current consumption for different bitrates www.onsemi.com AND9310/D Conclusion 2. Conclusion The current used during receive mode is the main factor impacting the average current consumption (this is especially true for low bitrates). It is therefore very important to keep the time when the receiver is switched on, as short as possible. Even if the AX5051 does not have built in WOR (Wake On Radio) capabilities, the overall current consumption (including the microprocessors current) is low compared to competitors. This is achieved by using the great flexibility provided by the AX5051 that makes it possible to reduce the time, the receiver is switched on, to a minimum. With the flexibility of the AX5051, one is free to optimize for own requirements, and is not bound to a specific packet format. 145 us 100 kbit/s with RSSI below threshold 750 uA 22.2 mA 3.219 uAs 1.7 ms 998.2 ms 0.65 uA 750 uA 0.65 uA 702 uA 0.73 uA 0.73 uA 0.7287 uAs Sleep Figure 7 Crystal startup 1.193 uAs Receive Distribution of current consumption during one cycle www.onsemi.com AND9310/D 9 10 Appendix 3. Appendix 3.1. References AX5051 downloads Download AX5051 datasheet and programming manual from http://www.onsemi.com Download duty_cycle source code from http://www.onsemi.com AX5051 HARDWARE Find local distributors for AX5051 transceiver at http://www.onsemi.com Order development kit AX5051-DVK at http://www.onsemi.com PIC16F886 MICROCONTROLLER Datasheet for the microcontroller used http://ww1.microchip.com/downloads/en/DeviceDoc/41291E.pdf www.onsemi.com AND9310/D