very good and informative. i wish i came across this video when i was a newbie. I figured out though that one thing that was worth mentioning is the Nyquist theorem, especially when adc'ng waveforms. It literally is a determining factor on which micro-controllers to use or avoid due to their maximum functionality of the ADC sampling capability. But am late on this and perhaps someone can find it on another video on youtube
Жыл бұрын
Yes, I agree that signal processing and analysis is an important subject that in university is covered by a few electronics and math courses as well, if we want to go into the details of why certain theorems and practical advices hold true. The software implementation is also connected to the hardware frontend, like the kind of filters you use on the input of the adc. I would recommend finding content on signal processing and analysis on youtube, which can be adapted to the STM32 adc quite easily. We're just talking about sampling time, sampling period and adc resolution and reference voltage. With these you're basicaly set. I would like to do some practical demonstration with some theory, but currently I'm limited with the gear down to a dev board and a pc. Maybe someday. Thanks for watching.
@kiausiniukova28423 жыл бұрын
Hey, thank you for this video. I have a question, so this code basically reads analog voltage and writes to an integer and next cycle it will overwrite old value. But if i want to store all data or just have all ADC readings, should i use an array instead of integer? Lets say i want to measure Sin wave for 5 sec and see all the values, is it possible with this code or should i use an array instead of your adcval integer?
3 жыл бұрын
You should create an array of (uint16_t) elements of maximum size that you need. First you need to figure out your sample rate, which has to be larger than 2 times the maximum frequency that you want to capture. This is important, or else you will not get a perfect sine wave. If your maximum frequency is 1kHz, you should sample with at least 2kHz. You can sample with interrupt using a timer which triggers one at 2kHz and read from ADC and put a value into the array, remembering your current write position, or you can connect timer to trigger ADC to perform a conversion. Then you can configure ADC to trigger interrupt when its done and do the same as before. The most elegant solution would be to have same thing as in second case, but instead of interrupt, ADC would issue DMA request. DMA would copy value to that array without disturbing you. After it's done copying a number of samples set (for 5 seconds at 2kHz sample rate is 10k samples) DMA can trigger interrupt that it's done and you can read the data. You can also make things continuous with cyclic buffer with two parts along with DMA. There are still a lot of things to think about when sampling a signal. For data flow check out my DMA video. I will make a video about sampling in the future and all the things you need to think about. Stay tuned.
@kiausiniukova28423 жыл бұрын
@ thank you very much. Waiting for new tutorials !
@hcovic3 жыл бұрын
Hvala
@mursalaboobacker35932 жыл бұрын
you really did the external adc with spi , can you make a video about that, it is usefull for me and others, sorrry for my poor language
2 жыл бұрын
I'll find a few external ADCs around the shop. I'll make it just like the i2c example video.