当前位置:网站首页>Arduino's super power-saving sleep mode has worked with one 18650 battery for 17 years
Arduino's super power-saving sleep mode has worked with one 18650 battery for 17 years
2022-07-24 07:37:00 【lihaMIMI】
Arduino The peripheral component modules of are very rich , I want to make a temperature alarm , But I found that battery power can't last for a few days , So I tossed for a period of time , Finally, the standby time is extended until I retire ^-^, Now let's share the process .
First of all, we need to know the calculation formula of battery powered standby time . Usually the battery will be marked with a capacity of MAH (mAH).7 The capacity of No. 1 battery is 1.5V700mAH about . and 18650 The battery can easily do 3.7V3500mAH. If we choose 1 section 18650 3500mAH Battery for Arduino Work , How long can I stand by ? hypothesis Arduino The average working current of is 30mA, that 3500/30=117 Hours =4.88 God , Obviously, it is far from our goal 17 The annual difference is too far . So if we want to achieve 17 The goal of annual standby , Then the current should be controlled at 3500/17 year /365 God /24 Hours =0.0235mA=23.5uA( To simplify the calculation , This paper does not consider battery self discharge 、 Voltage changes and temperature effects ).
Okay , Had a target , Just try to control the standby current at 23.5uA Well !
1. The preferred 8Mhz Dominant Arduino The board , Because the vast majority of SCM programs are for 8M The main frequency is more than enough to run , but 8M Power consumption compared to 16M But it can be greatly reduced , You can personally test the power consumption under different working frequencies with frequency division code .
2. The preferred 2.7V~5.5V Power Supply Board . because 18650 The battery voltage range is 2.7~4.2V, three links 7 Battery number is 3V~4.8V, To use up the battery , The single chip microcomputer must be able to work at the lowest 2.7V Stable operation under the voltage of .
3. Simplify peripheral circuits , Mainly USB turn TTL circuit ,5V turn 3.3VLDEO Circuits, etc .
Combine the three points above , Recommended direct use CC Nano Pro Development board , A treasure is on sale . This board has TYPE-C Interface pro Mini 8MHz 328P Chip development board , More importantly, it specially designed a peripheral circuit disconnection solder joint , After uploading the program, disconnect the solder joint LDO and USB circuit . Pictured

4. The rest is code optimization , Go straight to the code , The idea is to let Arduino Boot into the SLEEP_MODE_PWR_DOWN Sleep mode , At this time, the measured current smoothly decreased to 23uA. Of course, nothing can be done , Open the watchdog interrupt , Wake up every second , Execute watchdog count . Wake up and enter loop loop , Then judge how many seconds have passed in the cycle , Perform the required functions as required .
#include <avr/sleep.h>
#include <avr/power.h>
#include <avr/wdt.h>
#define LED_PIN (13)
void OFFACDDC() {// close ACD and ADC
ACSR |=_BV(ACD);
ADCSRA=0;
}
void ONACDDC() {// Turn on ACD and ADC
ACSR &= ~_BV(ACIE);
ACSR &= ~_BV(ACD);
ADCSRA |= _BV(ADEN);
ADCSRA |= _BV(ADIF);
}
volatile int f_wdt = 1; // The watchdog counts
ISR(WDT_vect) { // The watchdog wakes up the execution function
f_wdt++;
}
void enterSleep(void) { // put to sleep
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
sleep_enable();
sleep_mode();
sleep_disable();
power_all_enable();
}
void setup() {
pinMode(LED_PIN , OUTPUT);
digitalWrite(LED_PIN , LOW);
OFFACDDC();
/*** Set up a watchdog ***/
MCUSR &= ~(1 << WDRF); /* Clear the reset flag . */
WDTCSR |= (1 << WDCE) | (1 << WDE);
//* Set the new watchdog timeout
WDTCSR = 1<<WDP1 | 1<<WDP2;// Every time 1 Second watchdog timeout 1 Time , You can also execute a post wake-up function ISR
WDTCSR |= _BV(WDIE); /* Set to timed interrupt instead of reset */
}
void loop() {
if (f_wdt >= 5) { // After waking up, it will run loop Of , At this time, check whether the wakeup reaches 5 Time , It's just 5 The second , A flash
ONACDDC();// Turn on ADC, So analog input IO Eloquence can be restored
digitalWrite(LED_PIN, HIGH);
delay(20);
digitalWrite(LED_PIN, LOW);
f_wdt = 0;
OFFACDDC();
}
enterSleep();// Keep sleeping
}5. Practical application , For some simple low-power sensors, such as LM35, You can use numbers directly IO Mouth to mouth VCC Pin , In this way, you can wake up and use IO Mouth control LM35 Power supply , After work, the power supply was disconnected before hibernation . If it is WIFI Modules and other power consuming , A small power solid-state relay can be connected externally , Such as 211EH, It can also realize the requirement of power supply only after wakeup . In addition, the power consumption is reduced , In fact, you can add another 5V Small solar panels ( String several diodes , Ensure that the current does not flow back and does not exceed the maximum charging voltage of the battery under the strongest light ), With rechargeable battery , Achieve unlimited endurance .
PS:3 section 7 No. 2 battery is connected in series , stay 24uA It can work under current 700/0.024/24/365= 3.3 year .
边栏推荐
- 全国职业院校技能大赛网络安全B模块 Windows操作系统渗透测试
- Sword finger offer special assault edition day 8
- 25.消息订阅与发布——PubSub-js
- Win10 sound icon has no sound
- Sense dimension design responsive layout
- Appium use
- XSS漏洞学习
- 无法自动装配,未找到“RedisTemplate类型的Bean
- Injectfix principle learning (to realize the heat of repair addition)
- JS_ Realize the separation of multiple lines of text into an array according to the newline
猜你喜欢
![[leetcode] 11. Container with the most water - go language solution](/img/42/3a1839dd768a5f02dc2acb5bd66438.png)
[leetcode] 11. Container with the most water - go language solution

Advanced part of C language IV. detailed explanation of user-defined types

AMD64 (x86_64) architecture ABI document: upper

C language advanced part VII. Program compilation and preprocessing

Laplace distribution

PHP link log scheme

XSS vulnerability learning
![[cloud native] MySQL index analysis and query optimization](/img/ca/79783721637641cb8225bc26a8c4a9.png)
[cloud native] MySQL index analysis and query optimization

Using depth and normal textures in unity

Simple installation of sqli Labs
随机推荐
Jackson parsing JSON detailed tutorial
FPGA realizes reading and writing of axi4 bus
C language to achieve mine sweeping game
Notes on the basics of using parameters in libsvm (1)
项目中数据库插入大批量数据遇到的问题
[hiflow] Tencent cloud hiflow scene connector realizes intelligent campus information management
Advanced part of Nacos
Network security B module windows operating system penetration test of national vocational college skills competition
Using bidirectional linked list to realize stack (c)
The goal you specified requires a project to execute but there is no POM in this directory
Oauth2==SSO三种协议。Oauth2四种模式
A great hymn
Source code analysis of Nacos configuration center
[sklearn] RF cross validation out of bag data parameter learning curve grid search
Advanced part 5 of C language. Dynamic memory management
PHP link log scheme
Sword finger offer special assault edition day 8
25.消息订阅与发布——PubSub-js
Feature Selective Anchor-Free Module for Single-Shot Object Detection
numpy.cumsum