how to change the ESP-32 ADC sampling rate?
-
- Posts: 2
- Joined: Wed May 12, 2021 3:34 pm
how to change the ESP-32 ADC sampling rate?
I have a project, in which I need to acquire a 4096 samples of a 60 Hz frequency signal. Using the analogRead () function, with a maximum of 3 signal cycles, I would like to know how to increase the number of cycles for the 4096 samples of the 60 Hz frequency signal without changing the resolution, changing only the sampling rate.
Re: how to change the ESP-32 ADC sampling rate?
So you want to increase the sampling rate of analogRead(), can you post some code so we can see what you are doing currently?
-
- Posts: 827
- Joined: Mon Jul 22, 2019 3:20 pm
Re: how to change the ESP-32 ADC sampling rate?
arduino-esp32 has an operating system running, which will use some cpu cycles and make any sort of timing technique fail. I would suggest you use a peripheral (pulse counter or rmt) to capture your data without the cpu. If you are trying to do RMS or something where the timing is not as critical as max/min, you can use the I2S to capture data from ADC. https://github.com/espressif/arduino-es ... eq_ADC.ino
-
- Posts: 2
- Joined: Wed May 12, 2021 3:34 pm
Re: how to change the ESP-32 ADC sampling rate?
using the function analogSetCycles (255); I achieved a gain in the number of cycles, however, I would like to obtain a greater gain of cycles, however, the function has a maximum parameter of 255, I tried to use the function analogSetSamples (2); however, I got a distortion in the values read, so, I wanted an alternative to increase the number of cycles, I followed the image of the normal result and with the increase of cycles:
image of the normal number of ESP-32 cycles:
https://mega.nz/file/3i5BCKhY#8mcg6UbON ... fQ8vtqqhjc
image with the analogSetCycles () function; implemented:
https://mega.nz/file/f24z3SBA#Qv4JdxhAk ... AN7njYVYcs
image of the normal number of ESP-32 cycles:
https://mega.nz/file/3i5BCKhY#8mcg6UbON ... fQ8vtqqhjc
image with the analogSetCycles () function; implemented:
https://mega.nz/file/f24z3SBA#Qv4JdxhAk ... AN7njYVYcs
Who is online
Users browsing this forum: Baidu [Spider] and 74 guests