当前位置:网站首页>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 .
边栏推荐
- MySQL queries all parents of the current node
- Jackson 解析 JSON 详细教程
- fopen、fwrite、fseek、ftell、fread使用demo
- 【sklearn】PCA
- Introduction to C language III Array 4. Operators
- Introduction to C language II. Functions
- Fopen, fwrite, fseek, fTell, FREAD use demo
- Influxdb未授权访问&CouchDB权限绕过
- Advanced part of Nacos
- CSDN, it's time to say goodbye!
猜你喜欢
![[sequential logic circuit] - register](/img/a5/c92e0404c6a970a62595bc7a3b68cd.gif)
[sequential logic circuit] - register

Jackson parsing JSON detailed tutorial

Bookkeeping app: xiaoha bookkeeping 2 - production of registration page

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

Introduction to C language I. branch and loop statements

Reptile learning - Overview

Feature Selective Anchor-Free Module for Single-Shot Object Detection

cloud的版本升级
![[cloud native] MySQL index analysis and query optimization](/img/ca/79783721637641cb8225bc26a8c4a9.png)
[cloud native] MySQL index analysis and query optimization

JS_ Realize the separation of multiple lines of text into an array according to the newline
随机推荐
Win10 sound icon has no sound
系统集成项目管理工程师(软考中级)重点知识、背诵版
Laplace distribution
Problems encountered in inserting large quantities of data into the database in the project
Kali安装pip以及pip换源
游戏三子棋
[word] how to generate the index directory on the left
[steering wheel] the super favorite idea efficiency artifact save actions is uninstalled
Introduction to C language I. branch and loop statements
使用堡垒机(跳板机)登录服务器
Notes on the basics of using parameters in libsvm (1)
Deep analysis of data storage in memory
Requests crawler implements a simple web page collector
无法自动装配,未找到“RedisTemplate类型的Bean
Game three piece chess
JS_ Realize the separation of multiple lines of text into an array according to the newline
Introduction to C language II. Functions
Influxdb未授权访问&CouchDB权限绕过
24.全局事件总线
MySQL queries all parents of the current node