Sleep AT example ================================== This document briefly introduces and illustrates using AT commands to set sleep mode. .. contents:: :local: :depth: 1 Introduction ---- Currently, Combo-AT supports the following two power consumption modes: 1. Light sleep mode: currently only supports Bluetooth slave mode settings, you can choose to enter or not enter shallow sleep after power on, and keep Bluetooth broadcasting during sleep. 2. Deep sleep mode: There are two wake-up methods: scheduled wake-up and GPIO wake-up. After entering sleep, both Bluetooth and Wi-Fi stop working. Measurement methods ^^^^^^^^^^^^^^^^^^^^ In order to avoid some unnecessary interference during the power consumption test, it is recommended to test the single module. Set to light sleep mode in bluetooth connection state ----------------------------------------------------- #.Initialize the role as a Bluetooth slave. command: .. code-block:: none AT+BLEMODE=1 respond: .. code-block:: none OK #.Start broadcasting. (enabled by default) command: .. code-block:: none AT+BLEADVEN=1 respond: .. code-block:: none OK #.Update Bluetooth connection parameters. Set the Bluetooth connection interval to 10ms. command: .. code-block:: none AT+BLECONINTV=8,8,99,400 respond: .. code-block:: none OK #.Set sleep mode to light sleep mode. command: .. code-block:: none AT+SLEEP=0 respond: .. code-block:: none OK #.Waiting for connection. If the connection is established successfully, AT will prompt: .. code-block:: none +EVENT:BLE_CONNECTED //Bluetooth connection is successful OK Set to deep sleep mode ----------------------- #. Set the sleep mode to deep sleep mode, GPIO wakes up. command: .. code-block:: none AT+SLEEP=2,2,7,0 OK respond: .. code-block:: none OK explanation: - The Ai-WB2 series only supports IO7 pin wake-up, that is, it wakes up automatically when the serial port receives data #. Set the sleep mode to deep sleep mode, and wake up at a fixed time of 5 seconds. command: .. code-block:: none AT+SLEEP=2,0,5000 OK respond: .. code-block:: none OK