The Simplest Digital Filter (STM32 Implementation) - Phil's Lab #92

The Simplest Digital Filter (STM32 Implementation) - Phil's Lab #92

Phil’s Lab

1 год назад

78,426 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@robertpeters9438
@robertpeters9438 - 15.12.2023 02:57

USE BROADER GRAPH LINES FOR US TO SEE THE COLORS.

Ответить
@hessel9390
@hessel9390 - 23.11.2023 20:31

So if we put 2 LowPass filters behind each other we can make a 2nd degree low pass filter? And then if we combine a low pass and high pass filter you can make a band pass filter?

Ответить
@dmitry.shpakov
@dmitry.shpakov - 15.06.2023 19:00

It would be nice to see a performance comparison of the two representations of the equation:
1. y_n = alpha * x_n + ( 1 - alpha ) * y_n-1
2. y_n = y_n-1 + alpha * ( x_n - y_n-1 )
Because the first equation uses two multiplication operations and one summation, but the second equation uses one multiplication operation and two summations.

Ответить
@Ncky
@Ncky - 28.04.2023 01:01

It would be nice if you could add this to your planned projects. Digital filter with stm32 that will work like MSEGQ7 ic and drive addressable led strips.

Ответить
@russianultraviolet4441
@russianultraviolet4441 - 12.03.2023 18:34

Thanks! Could elaborate on higher order filters? What can we achive by going 2nd through 5th order? They are not hard to implement . If u can implent the 1st order then u can impent the 5th order as well. Can i get a really steap ripple-free high-pass filter by going a few orders higher? Thanks again

Ответить
@sumedhburbure4173
@sumedhburbure4173 - 06.02.2023 07:23

Great video!

Ответить
@---658
@---658 - 05.02.2023 10:57

Thanks you very much for detailed and focus video. Really cool! Best regards

Ответить
@koenvercammen2259
@koenvercammen2259 - 03.02.2023 09:40

and now in assembly while using the dsp/simd commands of the cortex and storing the IFE_EMA in the TCM ;-)

Ответить
@MEan0207
@MEan0207 - 30.01.2023 08:12

Thank you

Ответить
@volkanozdemir44
@volkanozdemir44 - 28.01.2023 02:21

Do you think EAGLE better than KiCAD?

Ответить
@1over137
@1over137 - 27.01.2023 23:49

It has been pointed out to me that you don't need buffers, circular arrays, double buffering, DMA or even interrupts to process a realtime audio stream. I refused to believe it, but I tried it and... block reading and block writing 1 stereo sample at a time still leaves you PLENTY of time to process each sample through the filters. Zero latency. No sample rate conversion either, that happens automatically when you trigger off the cadence of the output. Also, the SAI blocks are worth looking into. They can be easily used as basic I2S interfaces as normal, but can do way more, including the support for 8 octet unblocking FIFO.

Ответить
@KingdomChablo
@KingdomChablo - 27.01.2023 19:07

Hi Phil, (this relates to all of your projects you design and make) I would like to know how you effectively document a project. From start to finish. What software do you use to actually do this? I see you do alot of work which is very impressive. Some projects, such as the xilinx one isn't straightforward. So how do you do project management so effectively.

Ответить
@MarkSJBeard
@MarkSJBeard - 27.01.2023 17:04

I have used these filters for years in simple digital filtering applications. And this video treats the subject very well. The one thing I would disagree with is that these filters are bad at separating frequencies. They’re not, you just have to use them within the range of their effective capability.

For a low pass filter of this form, A = Fc/Fs where Fc the cutoff frequency and Fs is the sample frequency. BUT… the effective capability limit is that A <= 1/2pi, and the lower A the more faithful the response. The video focuses on A values close to zero and one, neither of which are particularly useful as practical filters, and values above 1/2pi, which are beyond the effective capability of the filter.

The filter is simple and effective, but the trade off for this simplicity is that you need a high sampling frequency compared to the cutoff frequency. Such a simple filter needs a lot of samples to work with. And if your application is capable of supporting that restriction, i.e. you can take at least 6.28 samples per filter time constant (and preferably plenty more than that), and you have sufficient math resolution (hence floating point) then it will do what you need.

Ответить
@TheGmr140
@TheGmr140 - 27.01.2023 06:25

Cool

Ответить
@anagram
@anagram - 26.01.2023 18:04

Great video! The technical aspect is well explained, but I was wandering how do the filter sound on common waveforms and a real world example.

Ответить
@myetis1990
@myetis1990 - 25.01.2023 15:12

Hey Phil, great content as ever.
I would love to see a video that shows the usage of CORTEX-M4F DSP features.
using this feature with DMA would be very delicious for many applications(especially kalman filtering :)

Ответить
@adrianovianawerneck472
@adrianovianawerneck472 - 25.01.2023 14:55

I Phil good with these videos.

Ответить
@seany9519
@seany9519 - 25.01.2023 09:20

Great video Phil, your hardware setup is really clean. It would interesting if you explored linear phase FIR filters. Those filters enable finer control over magnitude and phase response while offering constant group delay. Very important in many applications. A DSP board like yours could implement some reasonably long filters

Ответить
@maxsintar108
@maxsintar108 - 24.01.2023 21:53

Hi Phil, great video as always. I noticed you defined a filter structure in section .audiobuffer. Is that section defined in a linker script? Would be interesting to see any linker script tutorial from you!

Ответить
@robdavis3220
@robdavis3220 - 24.01.2023 18:20

great stuff. Nice to see an actual implementation in C , not just a bunch of theory. Can you show some higher order filters as well , maybe 2'nd and 3'rd order.

Ответить
@MusaYmc
@MusaYmc - 24.01.2023 08:59

Never would have though I'd be implementing filters on stm32 for fun, thank you for the guide!

Ответить
@3238juan
@3238juan - 23.01.2023 11:44

Tks! can you show a tutorial on designing a board for the f1c100s/ f1c200s?
I think this SOC is a beast for its price

Ответить
@Xer777Xes
@Xer777Xes - 23.01.2023 07:23

Could you make a video with the goertzel algorithm?

Ответить
@7alfatech860
@7alfatech860 - 23.01.2023 03:15

Great content as always!

Ответить
@marek_ryn
@marek_ryn - 22.01.2023 16:45

Hi! As always excellent video. Is there a chance to show hot to use CMSIS DSP library on STM32?

Ответить
@shaungovender7805
@shaungovender7805 - 22.01.2023 14:10

Hi Phil, as always your DSP videos are pure quality. Loving this content. Perhaps in future you could also do videos on Digital Control Systems. A lot of DSP theory overlaps with digital control.

Ответить
@Heisenberg2097
@Heisenberg2097 - 22.01.2023 10:55

I recently tried Platform IO to compile for ESP32 and it is so much faster than Arduino IDE.

Ответить
@thelastofthemartians
@thelastofthemartians - 22.01.2023 03:15

Nice vid as usual. One minor point though: it may be better to compute 1-alpha once and store it in the struct rather than compute it for every sample. Mind you, the compiler might do that optimisation for you anyway. It would be interesting to see the assembler code it produced.

Ответить
@UncleWalter1
@UncleWalter1 - 22.01.2023 02:27

This makes me think of the filter I used to implement in flash games when I was a kid to smooth out motion. It worked out to something like Yₙ = Yₙ₋₁ + (Xₙ - Yₙ₋₁) * α. In practice it was current_position += (target_position - current_position) / how_sluggish_I_want_it_to_move because it was easier for me to visualise the motion increment as dividing up the line between current_position and target_position. Later I changed the last part to a multiply when I learn about how expensive division can be. Though in fixed-point, a lot of the time, the division does get optimised out. Don't use it for much these days except lazily removing zipper noise from level controls, but it's a handy one-liner nonetheless.

Ответить
@PatrickHoodDaniel
@PatrickHoodDaniel - 21.01.2023 23:24

Excellent video and a filter I will use in my video, but I will probably dumb it down for my audience. I will be using an accelerometer for robotic balancing applications (spikes occur if there are abrupt vibrations, whether from abump, or from the vibration from a servo), but I was also thinking of using gyro and adding angular velocity (in some way) to improve the angle measurement. I will try the filtering first to see how well it works. I may need to use a filter that considers more samples as well. When I get to this video, I will make sure to mention this video so viewers can get more detail.

Ответить
@eleclab4244
@eleclab4244 - 21.01.2023 21:47

Great as always mr.phil! Have you tried the SigmaDSP from analog devices?

Ответить
@naturevolt
@naturevolt - 21.01.2023 21:43

Phil - nice video. A unique thing about alpha = 0.5 for the low pass case is that it can be solved with just shifting the input by one bit (divide by 2) and adding it to the previous solution shifted by one bit (divide by 2). This is math any low end micro can achieve.

Ответить
@Kurtsi
@Kurtsi - 21.01.2023 21:28

Glad to find your channel! There seems to be incorrect sign at the Sigma operator on the high pass block diagram. According to the block diagram, it is x(z) + x(z-1).

Ответить
@sc0or
@sc0or - 21.01.2023 21:26

Is this true that the alpha means a reduction ratio at a freq nykvist/2? I can see that alha 0.1 means -20dB at f/2, and alpha 0.5 means -6dB at the same freq.

Ответить
@MSP757
@MSP757 - 21.01.2023 20:43

I've started using STM32 from st32f401 (blackpill board). And its ADC upset me much, because even with noise very low noise levels on oscilloscope that thing gave me 6-7 stable bits out of 12bit mode. Some people said pcb design is bad, others that chip itself has pretty bad ADC. But nevertheless I started to search noise canceling technics and found pretty good method in AN4073 which is basically median filter + moving average filter. But I think it can be improved even more with EMA filter. Thanks.

Ответить
@isaacclark9825
@isaacclark9825 - 21.01.2023 20:22

Great content, as always! I'd be interested in seeing how you set up double buffering with DMA on an STM32H7. It seems that folks have had problems with that in the past.

Ответить
@richardhayter7799
@richardhayter7799 - 21.01.2023 19:36

Very professional and clear. Thanks.

Ответить
@thetastefultoastie6077
@thetastefultoastie6077 - 21.01.2023 19:27

I found this low-pass filter in a flash game over 10yrs ago and have been using it everywhere since, it's so useful!
Although the one I found was in the form: smoothed += (raw - smoothed) / factor; // Where factor is 1 or more

Ответить
@AmitSharma-bm2qj
@AmitSharma-bm2qj - 21.01.2023 19:25

Great 👍

Ответить
@LLiiaamm_
@LLiiaamm_ - 21.01.2023 19:08

Great video as always! Would love to see an implementation of a Chorus effect. It utilizes LFO, delays, and can easily be switched between vibrato and chorus by changing the wet and dry mix.
Keep it up, Phil 👍

Ответить
@Quantum_Dots
@Quantum_Dots - 21.01.2023 18:38

Awesome

Ответить
@mbarras_ing
@mbarras_ing - 21.01.2023 18:23

Brill as always Phil, very clear explanation. Wish I had these when starting out.

I remember the aha moment when I "implemented" a moving average filter in excel (of all software..). But the cells helped me think of the z domain, and individual samples.

Ответить
@guruG509
@guruG509 - 21.01.2023 18:21

Pls make a video on quaternions

Ответить
@pietrogagliano4484
@pietrogagliano4484 - 21.01.2023 18:21

Awesome! I always love these digital filter videos and I'll have to really start doing some digital filter hardware design projects myself! Thank you for the great content as always! I just wanted to ask as well about the status of the advanced hardware design course, can't wait for it to come out. Thank you again Phil

Ответить
@VladimirDjokic
@VladimirDjokic - 21.01.2023 18:13

Cool, I ❤ your videos

Ответить
@matthewprestine1974
@matthewprestine1974 - 21.01.2023 18:10

The H723 has a built-in FMAC, ever consider covering this as a topic? Many of these higher end units have these features and would be a great series to compare them to roll your own types.

Ответить
@tamaseduard5145
@tamaseduard5145 - 21.01.2023 18:10

👍🙏❤

Ответить
@HOKKEY
@HOKKEY - 21.01.2023 18:05

Thank You for Sharing !!

Ответить