当前位置:网站首页>Esp32 monitors the battery voltage with ULP when the battery is powered
Esp32 monitors the battery voltage with ULP when the battery is powered
2022-07-01 06:37:00 【Morning breeze】
Chen Tuo 2022/06/01-2022/06/01
1. summary
stay 《ESP32 How is the deep sleep current lower than 10uA》
https://zhuanlan.zhihu.com/p/521640890
https://blog.csdn.net/chentuo2000/article/details/125033711?spm=1001.2014.3001.5502
and 《ESP32 - ULP The coprocessor reads the on-chip Hall sensor in low-power mode HALL SENSOR》
https://zhuanlan.zhihu.com/p/522082909
https://blog.csdn.net/chentuo2000/article/details/125048580?spm=1001.2014.3001.5502
In two articles we discussed ESP32 stay deep sleep Current in mode , In this article, we test based on official routines ESP32 When the battery is powered ULP Monitor battery voltage .
about ESP32 The current under various working modes can be referred to 《 understand ESP32 Sleep mode and its power consumption 》 One article .
https://zhuanlan.zhihu.com/p/521885688
https://blog.csdn.net/chentuo2000/article/details/125042156?spm=1001.2014.3001.5502
2. Official documents
- Official routine
《ULP Coprocessor Detect ESP32 Brownout》
https://gitee.com/chentuo2000/esp-iot-solution/tree/release/v1.1/examples/ulp_examples/ulp_detect_brownout
This example utilizes ULP Coprocessor ADC Measurement function , Polling in the background to detect VDD33 The voltage value of the pin , And deal with it when the voltage is unstable .
- Hardware connection
In this case , choice SAR ADC1 Of the 7 passageway (GPIO34), Through external jumpers , Connected to VDD33 Pin for voltage measurement , Test the use of the circuit board 《ESP32 How is the deep sleep current lower than 10uA》 The board introduced in the article .
For details, please refer to ESP32 Technical manual
https://www.espressif.com.cn/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf
- How software works
Lord CPU After non sleep mode is activated , The following settings are required :
1) To configure SAR ADC1, And enable ULP Access to its functions
2) Initialize and enable RTC Watchdog timer
3) Load and start ULP Program
ULP After the program starts, it will always poll for detection VDD33 The voltage value of the pin :
1) If the voltage value is lower than the programmed value Brownout threshold , Turn off the digital kernel , RF circuits , And stop CPU
2) If the voltage value rises from low to set Brownout threshold ,ULP adopt RTC WDT Timeout resets the entire system
Be careful : because ULP Modules that do not have access to the digital part , Therefore, it cannot be read EFUSE Medium ADC Calibrate parameters to SAR ADC1 Calibrate the measurement results , So finally SAR ADC1 There will be some deviations in the measurement results of different module types .
ULP Coprocessors currently only support assembly development , The corresponding assembler is described in detail in the routine documentation .
- ESP-IoT-Solution brief introduction
The official routine is esp-iot-solution In the library .
https://docs.espressif.com/projects/espressif-esp-iot-solution/zh_CN/latest/gettingstarted.html
- ESP-IoT-Solution edition
Different versions ESP-IoT-Solution The explanation is as follows :
- ESP-IoT-Solution Programming Guide
https://docs.espressif.com/projects/espressif-esp-iot-solution/zh_CN/latest/index.html
3. obtain ESP-IoT-Solution
- Get orders
If from the official of Lexin github Library Download is difficult , You can start with gitee Clone a library on , And then from gitee Upload and download . Here is the download from my cloned Library , My library is private , You need to clone one yourself .
- Official routine
Be careful , The experimental routine is v1.1 In the version .
- download esp-iot-solution v1.1
cd ~/esp
git clone -b release/v1.1 --recursive https://gitee.com/chentuo2000/esp-iot-solution.git
from gitee When downloading clone library , The subject is going well , Having trouble downloading submodules , You need to manually download the following sub modules :
Download manually according to the source and the corresponding installation path .
If you still can't download , You can download this from the link below 3 Sub module :
download Adafruit-GFX-Library.tar.gz
https://download.csdn.net/download/chentuo2000/85481416
download ugfx.tar.gz
https://download.csdn.net/download/chentuo2000/85481491
download lvgl.tar.gz
https://download.csdn.net/download/chentuo2000/85481538
4. development environment
《 Use Lexin domestic Gitee Image building ESP32 development environment 》
https://zhuanlan.zhihu.com/p/348106034
https://blog.csdn.net/chentuo2000/article/details/113424934?spm=1001.2014.3001.5501
5. Build the project
- Copy official routine
Copy the official example project to ESP-IDF Beyond development tools :
cd ~/esp
cp -r ~/esp/esp-iot-solution/examples/ulp_examples/ulp_detect_brownout/ ~/esp/
- Project tree
cd ulp_detect_brownout
- Refresh esp-idf Environmental Science
get_idf
Be careful : Each time you open the terminal, enter sdk Execute this command once
- Set the target chip
idf.py set-target esp32
- Clear previous builds
- Configuration items
idf.py menuconfig
1) Set up Flash The memory size is 4MB
2) ULP It is enabled by default
preservation , sign out .
- Compile the project
idf.py build
- Burn project
see USB Serial port COM slogan :
burning :
idf.py -p /dev/ttyS3 -b 115200 flash
- Enable monitor
idf.py monitor -p /dev/ttyS3
(Ctrl+] You can exit the monitor program )
Lord CPU After starting , Print regularly ULP Read the VDD33 Pin voltage value (ADC Original value and converted voltage value ).ULP The coprocessor is set to timing 100ms Wake up detection VDD33 Pin voltage value , In the example Brownout Threshold set to 2.76v.
The following is the running log of the program :
4095 Is the measured value ,3.3 Is the converted voltage .
边栏推荐
猜你喜欢

【微信小程序】一文解决button、input、image组件

产品学习(二)——竞品分析

C语言课设学生选修课程系统(大作业)

树莓派4的WiFi设置

Free trial of self-developed software noisecreater1.1

Software engineering review
![[automatic operation and maintenance] what is the use of the automatic operation and maintenance platform](/img/14/756d566744d6e4a988a284c5b30130.png)
[automatic operation and maintenance] what is the use of the automatic operation and maintenance platform

图解事件坐标screenX、clientX、pageX, offsetX的区别

ESP32在电池供电时用ULP监测电池电压

下载外文期刊的方法
随机推荐
[wechat applet low code development] second, resolve the code composition of the applet in practice
[unity shader amplify shader editor (ASE) Chapter 9]
Design of sales management system for C language course (big homework)
Free trial of self-developed software noisecreater1.1
存储函数学习笔记
Summary of wechat official account embedded program to jump to wechat
How did ManageEngine Zhuohao achieve the goal of being selected into Gartner Magic Quadrant for four consecutive years?
Software engineering review
C language course is provided with employee information management system (large operation)
The code generator has eliminated the styling of xxxx js as it exceeds the max of 500kb
[automatic operation and maintenance] what is the use of the automatic operation and maintenance platform
Postgraduate entrance examination directory link
【微信小程序低代码开发】二,在实操中化解小程序的代码组成
Chapitre V gestion des entrées / sorties
Router 6/ 以及和Router5 的区别
@Transactional的传播属性REQUIRES_NEW深入理解
数据库对象:视图学习记录
C语言课设工资管理系统(大作业)
MySQL learning
C语言课设学生信息管理系统(大作业)