Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com 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

0xbadcaffe

Newbie
Newbie level 2
Joined
Mar 5, 2023
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
19
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?

Thanks
 

KlausST

Super Moderator
Staff member
Advanced Member level 7
Joined
Apr 17, 2014
Messages
23,244
Helped
4,738
Reputation
9,497
Reaction score
5,125
Trophy points
1,393
Activity points
153,963
Hi,

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?

Klaus
 

FvM

Super Moderator
Staff member
Advanced Member level 7
Joined
Jan 22, 2008
Messages
50,970
Helped
14,629
Reputation
29,534
Reaction score
13,733
Trophy points
1,393
Location
Bochum, Germany
Activity points
291,643
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.
 

0xbadcaffe

Newbie
Newbie level 2
Joined
Mar 5, 2023
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
19
Hi
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.
 

mtwieg

Advanced Member level 6
Advanced Member level 6
Joined
Jan 20, 2011
Messages
3,750
Helped
1,300
Reputation
2,606
Reaction score
1,339
Trophy points
1,393
Activity points
28,681
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...
 

LaTeX Commands Quick-Menu:

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top