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.

Looking for a light code to measure RMS

Status
Not open for further replies.

et.vinny

Newbie level 3
Joined
Dec 15, 2005
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,303
Heloo, this is my first post, excuse my bad English, therefore it is not my native language.
I am wanting to mount a measurer of tension AC, in the PIC.
My problem is in the account to calculate the RMS, therefore it is using much memory of the PIC, therefore it is in C. Somebody would have some code to calculate RMS, in ASM, or C but ligth?
Using PIC16F876 or PIC16F877

Thaks

ET
 

Tohu

Full Member level 1
Joined
Jun 9, 2004
Messages
96
Helped
16
Reputation
32
Reaction score
4
Trophy points
1,288
Activity points
1,328
Re: Measure RMS

What be type of the signal, you know the form /sin, square etc./or this is random AC signal ?
 

et.vinny

Newbie level 3
Joined
Dec 15, 2005
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,303
Re: Measure RMS

Is sin, for eletric energy.

Thaks

ET
 

xxargs

Full Member level 4
Joined
Jul 28, 2002
Messages
229
Helped
44
Reputation
88
Reaction score
2
Trophy points
1,298
Activity points
4,642
Re: Measure RMS

et.vinny said:
Is sin, for eletric energy.

Thaks

ET

if only one sinus carrier at AC-insignal, is easy (0.7071 * Up-p)/2 = voltage RMS

Up-p is measured voltage peak to peak.

---

but if measure complex multi frequency and noise signal is more difficult.

remember RMS means 'root mean square' and represent powers heat disspated from resistance with any wave form Voltage (from GHz to DC) equal as DC-voltage over same resistance for same power disppased.


In time discrete way, using square of input signal value (eg. make power-slice of sampel), integrate over the time (sum value of couple of power-slice, ex 256 sampel) and take out 1 sampel part of power in sum of power-slice (1/256 of sum value - ie median value) and take square root of this value and you have RMS voltage for this aktual 256 sampel window..


you need also take away exactly same amount of power from sum you put in 256 step before - ie need remember 256 sampel value ala fifo.. - or sum value run up like KWh-meter... or you need make discharge routin for sum as simular RC-circurits or higer order filter (lot of float-number calculate...)


- or using analog voltage to RMS-converter circurit before PIC input - is using analog quadratic circurit (and also handle very high frequency without aliasing problem compare to sampel rate ala PIC), RC-circurit/intergrator to make intergration of power and also discharge of this on 'natural' time-discrete way, and analog square root-circurit last step to give RMS-value out.




/xxargs
 

smxx

Full Member level 4
Joined
Aug 18, 2005
Messages
194
Helped
25
Reputation
50
Reaction score
13
Trophy points
1,298
Location
iran(ahwaz)
Activity points
2,546
Measure RMS

hi
for sine wave ,if you have 2 sample with 90 angle(y(Θ)and y(Θ+90))
you can calculate peek of signal
Ym²=y(Θ)²+y(Θ+90)² Yrms=Ym/√2
 

Eric Best

Member level 4
Joined
Sep 3, 2001
Messages
78
Helped
25
Reputation
50
Reaction score
13
Trophy points
1,288
Activity points
951
Re: Measure RMS

rms value can be measured beforehand by hardware using one of available rms converters from Maxim or Analog Devices like AD736, 737 etc. although in this case I think it would be luxury

Best Regards
Eric
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top