preface
In the past two days, I received a lot of questions from small partners about the power consumption of Lora sleep. It should be clear that the transmitting and receiving current of Lora is very large, so the battery of ordinary devices in the Internet of things can't carry it. How to realize low-power Lora in the Internet of things? Today, I'll share and discuss with you how to realize low-power consumption in the industry in this direction.
Today, we choose the module models of anxinco Ra-01 (Ra-02), Ra-01SC and Ra-06, which represent classic, new and AT control respectively. Let's start our test work.
Scheme induction
Regular reporting - this should be the simplest. Our node equipment reports messages at an agreed time. Except for short-term reporting, other times are in sleep, so the consumption of our average current will be much smaller, which is also a way with the lowest power consumption;
Sleep wake-up - this is a little more complicated. The principle of CAD preamble detection needs to be used. If the logical sequence is like this, our node device has been in the cycle process of sleep and timing up CAD. When our gateway or other transmitting device sends a preamble, it is detected by our node device, Then he will let our node enter the transceiver channel. When the transceiver is finished and returns to CAD and sleep state, the whole logic is a sleep wake-up process. Compared with the previous regular report, this sleep wake-up has more wake-up, so it has real-time performance.
The above are the most commonly used low-power solutions in the industry. These two solutions are enough for us to solve most application scenarios. At the same time, they have the characteristics of long-distance and strong penetration of lora.
Tool selection
As the saying goes, if you want to do a good job, you must first sharpen your tools. It will get twice the result with half the effort to have a good instrument at hand when doing the test. Today, the board we use to test the current power consumption is a small gecko. You can intuitively see the current waveform in the win environment. After the measurement of precision instruments, the data it tests is still very accurate.
-
Download the development environment link to Simplicity Studio. After installing the software, plug in the development board, and then import the relevant dependent environment according to the prompt to open Simplicity Studio
-
Studio, find the Energy Profiler in the upper right corner of the window
Sleep test
Low power consumption cooperates with sleep to perform periodic jump to reduce power consumption. When making low-power products, we must first test the sleep performance of the module. Through this method, we can evaluate the low-power performance of a hardware.
Now I will use some real data to show you how to enter sleep
Ra-01/Ra-02 sleep test (sx127x)
Ra-01 uses 127x series chips. We can see from the specification that the sleep current of the chip itself is below 1uA, and the current after we make the module is also below 3uA. Next, we will show you the whole operation and test process (the source code example is attached at the end)
This source code we use is the official driver library, which has sealed the sleep interface function. We just need to let it enter the sleep function after the initialization of the main function.
(1) Resource link
(2) Code and screenshot
int main(void) { bool isMaster = true; //One is set as the master and the other as the slave //bool isMaster = false; uint8_t i; delay_init(); //Delay function initialization NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); //NVIC (interrupt priority management) grouping configuration. Note: this grouping can only be used once in the whole program. Do not modify it after configuration, otherwise many problems will occur HALUart1Init(115200,uart1callBackTest); myPrintf(LEVEL_DEBUG,"init ok\r\n"); if(isMaster){ myPrintf(LEVEL_DEBUG,"this is master\r\n"); }else{ myPrintf(LEVEL_DEBUG,"this is slave\r\n"); } usmart_dev.init(SystemCoreClock/1000000); //Initialize USMART } // Radio initialization RadioEvents.TxDone = OnTxDone; RadioEvents.RxDone = OnRxDone; RadioEvents.TxTimeout = OnTxTimeout; RadioEvents.RxTimeout = OnRxTimeout; RadioEvents.RxError = OnRxError; Radio.Init( &RadioEvents ); while(1){ adio.Sleep( );,Force sleep state!!!!!!!!!!!!!!!!!!!!!!!!!!! Radio.SetChannel( RF_FREQUENCY ); #if defined( USE_MODEM_LORA ) Radio.SetTxConfig( MODEM_LORA, TX_OUTPUT_POWER, 0, LORA_BANDWIDTH, LORA_SPREADING_FACTOR, LORA_CODINGRATE, LORA_PREAMBLE_LENGTH, LORA_FIX_LENGTH_PAYLOAD_ON, true, 0, 0, LORA_IQ_INVERSION_ON, 3000 ); Radio.SetRxConfig( MODEM_LORA, LORA_BANDWIDTH, LORA_SPREADING_FACTOR, LORA_CODINGRATE, 0, LORA_PREAMBLE_LENGTH, LORA_SYMBOL_TIMEOUT, LORA_FIX_LENGTH_PAYLOAD_ON, 0, true, 0, 0, LORA_IQ_INVERSION_ON, true );
Ra-01SC sleep test (LLCC68)
Ra-01SC uses the same sx chip. This one uses the same driver as 1268. Similarly, we modified it with the official driver library and ran it on the board of STM32F103. The code and test results are as follows.
(1) Resource link
(2) Code and screenshot
void ExampleSX126xSendDemo(void){ uint32_t u32_count=0; printf("start %s() example\r\n",__func__); SX126xRadioEvents.TxDone = SX126xOnTxDone; SX126xRadioEvents.RxDone = SX126xOnRxDone; SX126xRadioEvents.TxTimeout = SX126xOnTxTimeout; SX126xRadioEvents.RxTimeout = SX126xOnRxTimeout; SX126xRadioEvents.RxError = SX126xOnRxError; Radio.Init( &SX126xRadioEvents ); Radio.Sleep(); while(1){}///Forced sleep Radio.SetChannel(LORA_FRE); Radio.SetTxConfig( MODEM_LORA, LORA_TX_OUTPUT_POWER, 0, LORA_BANDWIDTH, LORA_SPREADING_FACTOR, LORA_CODINGRATE, LORA_PREAMBLE_LENGTH, LORA_FIX_LENGTH_PAYLOAD_ON, true, 0, 0, LORA_IQ_INVERSION_ON, 3000 );//Parameters: lora mode, transmit power, set lora for fsk to 0, bandwidth, error correction coding rate, preamble length, fixed length packet (generally not fixed, so choose false), crc check, 0 means to turn off frequency hopping, the number of symbols between frequency hopping (the parameter of turning off frequency hopping is meaningless), which should indicate whether to turn over the interrupt level and timeout time Radio.SetRxConfig( MODEM_LORA, LORA_BANDWIDTH, LORA_SPREADING_FACTOR, LORA_CODINGRATE, 0, LORA_PREAMBLE_LENGTH, LORA_SX126X_SYMBOL_TIMEOUT, LORA_FIX_LENGTH_PAYLOAD_ON, 0, true, 0, 0, LORA_IQ_INVERSION_ON, false );
Ra-06 sleep test (sx127x)
Ra-06 is a finished module containing MCU. The driver is encapsulated inside, so our test is to use the AT instruction of the program to enter the corresponding low-power consumption. Because this module is equipped with a gateway program, it cannot actively enter the sleep shutdown. We need to let it enter the corresponding sleep through the serial port. Please see the following operation steps
(1) Automatic low power mode
The low power consumption here is the default initial state of the module. At this time, the current is 400-500uA, and the state is standby. After turning off the activity of the part, the measured current value is about 500uA.
(2) SLEEP mode
This mode is also very simple. First, we need to connect Ra-06 to the computer serial port, open a serial port number assistant, and send "AT+MODE=1" on the basis of power on by default, so that it can easily enter the sleep state
On the way above, we saw that the current and waveform decreased when I gave instructions, and measured that the sleep was about 1uA.
(3) Timed wake-up mode
Similarly, we need to connect Ra-06 to the computer serial port, open a serial port number assistant, and send "AT+MODE=5000" on the basis of power on by default, so that he can easily enter the sleep wake-up state. The value unit behind the command is ms, which is to return to the normal current after 5 seconds.
end
The various sleep and wake-up test data of anxinko Ra-01(Ra-02),Ra-01SC and Ra-06 are aimed at the STM32 development board environment, which can be used in major single chip microcomputer after a little transplantation. When doing application, we can use the above current shutdown scheme to cut into our own code logic, and we can make the controllable low-power equipment we want.
contact information
The above is the content shared in this issue. The purpose is to make everyone quickly adapt to the development of new products. We can provide the driver source code provided above for free
Official website: https://www.ai-thinker.com
Development data: https://docs.ai-thinker.com/
Official forum: http://bbs.ai-thinker.com
Business cooperation: sales@aithinker.com
technical support: support@aithinker.com
Company address: 410, building C, Huafeng innovation port, Gushu, Xixiang, Bao'an District, Shenzhen
Tel: 0755-15302646692