Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

AC Frequency measurement using STM32/ADC

Not open for further replies.


Mar 5, 2023
Reaction score
Trophy points
Activity points
Hi All
Not sure if this is the right thread.
Doing a new design.
Trying to figure out if STM32H7 with its internal ADCs is capable for the problem or should I use an FPGA.

The problem is:
I need to measure the frequency and amplitude of 12 AC input signals.
The frequency is 400hz and sampling must be at 2Khz.
The ADC resultion can be 12bit.
Is it possible using the STM32H7? perhaps with DMA?



You are posting in the "power" thread, but the problem has nothing to do with power.
Indeed it's not clear what the priblem is:
* software, algorithm?
* hardware?
* matgematics?

If you know the frequency is 400Hz, why do you need to measure it? So I guess there is a "range". -> You need to tell us.
What's the input waveform?

I personally don't recommend to do frequency measurement with ADC. Doing it with a digital capture unit is way more simple and still rather accurate.

What's the range of amplitude?
What resolution, accuracy, precision do you expect for freq and ampl?
What is the expected output data rate for freq and ampl?


I'd split the question.
1. Can we sample ADC continuously at 2 kHz with STM32H7 - yes
2. Requirements for signal pre-processing - e.g. anti-aliasing filters
3. Motivation for frequency measurement through ADC measurement and possibe methods

Can be useful if the input is a complex mixture of multiple signals and noise. All-digital-PLL (generating a reference sine with NCO) is a popular method.

You are right there is no "problem", I'm trying to figure out whether I can use the STM32H7 with the given use case.
I guess the problem can be classified as "how to measure the input voltage from 12 AC inputs."

The input waveform is sinusoidal.
The input voltage will be lowered from high voltage to fit the MCUs voltage levels.
We need a 7% accuracy on the voltage (amplitude) and 5% on the frequency.
We must use the internal ADC in the STM32H7.

When you say "sampling must be at 2Khz" are you referring to the sampling rate of the ADC? If so, then yes a STM32H7 can definitely do that easily. An Arduino could probably do it easily.

But I wonder if you actually meant you want to update the measured frequency every 500us, or with 500us latency. That is a completely different story...

Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to