当前位置:网站首页>Application of first-order complementary filtering to STM32 ADC acquisition
Application of first-order complementary filtering to STM32 ADC acquisition
2022-07-25 06:18:00 【sinat_ twenty-six million five hundred and twenty-eight thousan】
Everybody knows ,adc collection , Regardless of the resolution , In particular, the values of collected voltage and current have a certain drift , For example, drift 100mv Left and right is a very normal phenomenon .
Many people use average filtering , What I want to say here is that it's actually useless , I've been using this before , The effect of sincerity is very poor .
In fact, this question can be used Average filtering Add First order complementary filtering Relatively perfect filtering of fluctuations .
I only use average filter to drift in 100mv, With complementary filtering, the drift is basically only 10mv. It's already quite perfect .
Let go 10 Times of words , Yours ad The values are basically completely constant .
Here is the code , I won't introduce the idea of first-order complementary filtering , In fact, it is a matter of weight , Which moment do you believe more ? Do not understand their own Baidu .
void DEVICE_INFO::TX_updata(){// Use a first-order complementary filtering algorithmstatic u16 bre_i=0;static u16 bre_ii=0;static u16 bre_v=0;static u16 bre_vv=0;u16 adci,adcv;unsigned char r_buff[33];//TX electric currentadci=Get_Adc_Average(ADC_CH11,10); // Here are 10 Sub average filteringadci=(adci*3300)/4096;//TX_electricity=adci;// voltageadcv=Get_Adc_Average(ADC_CH10,10);adcv=(adcv*3300)/4096;//TX_voltage=adcv;// Explain 0.92 and 0.08 Is the weight ,0.000001 Is the processing cycle , I handle it faster here , The unit is sTX_electricity=0.92*(TX_electricity-bre_i*0.000001)+0.08*bre_ii;TX_voltage=0.92*(TX_voltage-bre_v*0.000001)+0.08*bre_vv;bre_ii=bre_i; // Save last valuebre_i=adci; // Save this valuebre_vv=bre_v;bre_v=adcv; // Save this value}
I believe that many algorithms are one idea , What will it be like in your own system , Still have to figure it out for yourself .
边栏推荐
- Leetcode/ number of 1 in the first n digit binary
- Codeforces Round #809 (Div. 2)
- Daily question brushing record (XXVIII)
- (Niuke multi School II) G-LINK with monotonic subsequence (construction question)
- Leetcode/ binary addition
- U-boot-1.1.6 transplant notes (beginner)
- Mysql database backup and recovery
- Jstat command summary [easy to understand]
- Classic cases of static keywords and block blocks
- leetcode/整数除法
猜你喜欢

JZ7 重建二叉树

node.express中req.body总是undefind解决

The LAF protocol elephant of defi 2.0 may be one of the few profit-making means in your bear market

HTB-Optimum

四、MFC工具栏、运行时类信息机制、运行时创建机制
![(14) [driver development] configuration environment vs2019 + wdk10 write XP driver](/img/90/0d94d26be8128d77de65919763fda5.png)
(14) [driver development] configuration environment vs2019 + wdk10 write XP driver

Sword finger offer 54. the k-th node of the binary search tree
![[ultra detailed diagram] FPN + mask RCNN](/img/ef/ddd62fe7e54074c134aa5ee4cc5840.png)
[ultra detailed diagram] FPN + mask RCNN

JTAG debugging source level debugging of arm bare board debugging

NFT: how to improve rentable NFT (erc-4907)
随机推荐
Date (day 76)
(2022 Niuke multi school) D-Link with game glitch (SPFA)
Mysql database backup and recovery
Evolution of coupon architecture under C2B mode
Using JS to realize the linkage effect of form form's secondary menu
Some common interview questions about IO stream and string
R奇怪语法总结
Interlocked atom access series of functions
Leetcode/ number of 1 in the first n digit binary
[daily practice] day (14)
Installation and configuration of automatic operation and maintenance management workers ansible
Siggraph 2022 -- rendering iridescent rock dove neck feathers
HTB-Arctic
Cout format output common functions and flags summary
VO, dto, do, Po distinction and use
How does vscode enable multiple terminals? How to display horizontally?
"Wei Lai Cup" 2022 Niuke summer multi school training camp 2 link with game glitch (SPFA finds positive and negative links)
Common API of window
Dry goods | training AI model can't find data? Collect 20 selected open source communities!
日期(DAY 76)