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.

Peak detection in software

Status
Not open for further replies.

techie

Advanced Member level 3
Joined
Feb 5, 2002
Messages
839
Helped
58
Reputation
116
Reaction score
9
Trophy points
1,298
Location
Pakistan
Activity points
7,805
In order to measure the line voltage 220Vac/50Hz with a low accuracy (+/- 2%), I need to peak of the rectified waveform by the ADC of a microcontroller. If I use a low value of filter capacitor, the ripple os too much to give even low accuracy. If I use a high value, the response of voltage drop is toooo low. Any ideas what to do here.
 

Hi,

Put a diode in serie with your resistor that you use to charge the C also use a large R to discharge the C all the time...

paul.
 

If you can measure undetected signal calculate differentiation for consequitive results .
d = measure2 - measure1 .
Then compare consequitive d results and when d will
be minimal measure 1 and 2 will give you 220 AC voltage peak value . Just Low pass filter will be needed
(if voltage drops and peaks do not have to be measured ) which cut off freq above 50 Hz .
Sampling frequency must be much more high than 50 Hz to properly detect peak value.

From simple math differential of cos is sin and when sin pass the 0 it means least acceleration change which could only be the case of peak in cos signal .
 

Following the same Arten idea; I read some time ago a paper and the method used is d = (measure2)^2 - (measure1 )^2, I remember that this formula is related to the power of the signal. Now I'm looking for this related paper, if I find it I’ll tell you.

Best regards....

I used this formula to detect spike in a function into a 16f877, and work very well.
 

I just got another idea. If I use a simple peak detector (diode, capacitor and large discharge resistor) and then read the charged capacitor for the peak value, and then use a port pin of microcontroller to discharge the capacitor through a small resistor, I can achieve both objectives of a ripple free measurement and fast response.

Any comments on this scheme before I try it out?
 

hi,
techie said:
In order to measure the line voltage 220Vac/50Hz with a low accuracy (+/- 2%), I need to peak of the rectified waveform by the ADC of a microcontroller. If I use a low value of filter capacitor, the ripple os too much to give even low accuracy. If I use a high value, the response of voltage drop is toooo low. Any ideas what to do here.

it is not good idea to use peak detector if you have noisy signal
you'd better have to use long, not rectangular window,
(Blakman-Harris, Hamming etc...)
calculate sum(sqr-signal(i)*sqr-window(i)) and then divide it by sum(sqr-window)
note:
---the sampling freq must be >>50Hz (eg 400Hz)
---window must be >> than period (eg 200ms)
---sum(sqr-window) is a constant
---sqr-window[N] is a constant array
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top