The Godfather talking
You may crack software. How about me?
Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 08, 2016, 05:05:15 17:05


Login with username, password and session length


Pages: [1]
Print
Author Topic: TRUE RMS AC VOLT METER USING MICROCONTROLLER  (Read 21085 times)
0 Members and 1 Guest are viewing this topic.
shams_iqbal
Newbie
*
Offline Offline

Posts: 30

Thank You
-Given: 5
-Receive: 12


« on: April 24, 2011, 12:11:20 00:11 »

HI TO ALL FRIENDS
                    I AM DESIGNING TRUE RMS VOLT METER USING ATMEGA8 MICRO CONTROLLER I HAVE COMPLETED CODE BUT THERE IS RESULT READING ERROR VERY TIME IT GIVES DIFFRENT VALUE I WANNA READ 0 TO 300 VOLT AC CAN ANY ONE HELP ME IN DETAIL THAT HOW TO OVERCOME READING ERROR  I MEAN PROCEDURE OF RMS CALCULATION IF ANY ONE HAVE ANY COMPLETE PROJECT OF TRUE AC RMS VOLTMETER WITH MICROCONTROLLER USING RMS CALCULATION THEN PLZ POST SPECILAY I NEED CODE OR CALCULATION PROCEDURE
Logged
metal
Global Moderator
Hero Member
*****
Offline Offline

Posts: 2018

Thank You
-Given: 514
-Receive: 477


Top Topic Starter


« Reply #1 on: April 24, 2011, 09:04:01 09:04 »

Show your code so others can help you.
Logged

nothing to say..
borberk
V.I.P
Senior Member
*****
Offline Offline

Posts: 298

Thank You
-Given: 309
-Receive: 598


« Reply #2 on: April 24, 2011, 09:17:07 09:17 »

You may have hardware problem not only software.
Calculation can be done like this:

http://www.easycalculation.com/statistics/learn-rms.php
Logged
pickit2
Moderator
Hero Member
*****
Offline Offline

Posts: 3816

Thank You
-Given: 567
-Receive: 2049


There is no evidence that I muted SoNsIvRi


« Reply #3 on: April 24, 2011, 01:09:28 13:09 »

easiest way to avoid read errors, over such a large voltage range (0 to 300Volts) is to use a look-up table.
Logged

Note: If you have no posts other than, I want or reporting a dead link Then you can't complain If I remove your post So Stop Leeching
solutions
Hero Member
*****
Offline Offline

Posts: 1446

Thank You
-Given: 590
-Receive: 851



« Reply #4 on: April 24, 2011, 07:37:06 19:37 »

easiest way to avoid read errors, over such a large voltage range (0 to 300Volts) is to use a look-up table.
That assumes 0 THD sinewaves....otherwise a LUT won't work.
Logged
itp
Junior Member
**
Offline Offline

Posts: 58

Thank You
-Given: 188
-Receive: 20


« Reply #5 on: April 25, 2011, 06:03:00 06:03 »

Hi,
This link is a good reference to start.
http://www.avrfreaks.net/index.php?module=Freaks%20Tools&func=viewItem&item_id=582

Regards
Itp
Logged
shams_iqbal
Newbie
*
Offline Offline

Posts: 30

Thank You
-Given: 5
-Receive: 12


« Reply #6 on: April 28, 2011, 01:35:59 13:35 »

You may have hardware problem not only software.
Calculation can be done like this:

http://www.easycalculation.com/statistics/learn-rms.php
         THANKS for ur reply but can u define that what would be hardware problem and other is i am using bascom avr and code is written and tested even i am able to test it on labcenter proteus software but at one reading i get calculated value and on other i get some time ZERO AND EVEN EVRY TIME THERE IS HUGE ERROR ALMOST MORE THEN 30 VOLTS eg. first it display 220 volt then it show 234 then 208 , and so on
                  HERE IS MY FULL CODE  FOR THIS PROJECT
Do



If Cal = 1 Then                                             'IF TOTEL SUM IS CALCULATED THEN DO SQUIER ROOT OF IT
Cal = 0
Newsum = Newsum / Countw
Countw = 0
Outvolt = Sqr(newsum)
Cls
Locate 1 , 1
Lcd " SAMPLE " ; Sample
Locate 2 , 1
Lcd " OUTVOLT " ; Outvolt
End If

Loop

End                                                         'end program
'HERE IS TIME BASE INTRUPPET FOR ADC SAMPLING
Timebase:

Adcsra.6 = 1

Getsample = 1
Incr Count
If Count = 40 Then
Count = 0
Cal = 1
End If


Return

'HERE IS SQUIER OF EACH SAMPLE

Adc_isr:

Aref = Adc
Sample = Aref - 512                                         ' READ ADC VALUE AND TRIM OFFSET
Sum = Sample * Sample                                       'SQUIER OF EACH SAMPLE
Adsum = Adsum + Sum                                         'ADD TOTALEL SUM
If Countw = 40 Then                                         'CHEK IF U GOT 40 VALUES THEN SET FLAG FOR CALCULATION OF SQUIER ROOT
Cal = 1                                                     ' CLEAR OLD SUMING VERIABLE
Newsum = Adsum
Adsum = 0

End If

Return


           AND FOR  CIRCUIT ITS VERY SIMPLE I AM USING AC SINE WAVE VOLTAGE GENERATOR WITH 2.5 VOLT OFFSET VALUE AS ITS CENTER POINT SORRY I TRIED BUT UNABLE TO POST CIRCUIT HERE
             
                         NOW HOPE SO VERY ONE IS CLEAR WITH MY WORK N WHAT I NEED TO COMPLETE THIS PROJECT IS
1NPUT VOLTAGE RANGE 0 TO 300 VAC
AND INPUT FREQ IS 45 TO 65 HZ OR IF IT MAY BE GREATER THEN BEST



Posted on: April 28, 2011, 01:32:17 13:32 - Automerged

easiest way to avoid read errors, over such a large voltage range (0 to 300Volts) is to use a look-up table.
dear there is not enough memory left so this method can not be used even avr is fast enough to calculate in real time

Posted on: April 28, 2011, 01:34:17 13:34 - Automerged

Show your code so others can help you.
dear i have posted code now plz help
Logged
solutions
Hero Member
*****
Offline Offline

Posts: 1446

Thank You
-Given: 590
-Receive: 851



« Reply #7 on: April 28, 2011, 03:06:17 15:06 »

I am not a s/w guy, BUT....

1) You don't initialize Adsum the first time through that I can tell.  If that's the case, whatever is randomly in the register is what's used...all depends when the interrupt hits
2) You increment "COUNT", but your variable elsewhere is "Countw"
3) You dont do any declarations, but I am guessing this is all signed integer?  If so, counting the sign bit, your math roundoff/truncation error may totally suck at 16 bits (if that's what you are using)
4) You have <200usec to do all this between samples...
5) You did remember to put a 1.2kHZ LP AAF in front of your ADC I hope
6) 10 bits with 300V pk is +/-0.6V resolution with perfect linearity....good luck with that one, especially since you are doing a prescale of at least 120;1 (600Vpk-pk to 0-5V and offset 2.5V), meaning you're in the noise floor pretty quickly if you are not mighty careful...but it doesn't work with the bench generator, so you haven't peeled to that part of the onion just yet
7) Stop being a girl...write it all in assembler :-)
« Last Edit: April 28, 2011, 03:19:46 15:19 by solutions » Logged
Eskimo
V.I.P
Inactive
*****
Offline Offline

Posts: 5

Thank You
-Given: 1
-Receive: 1


« Reply #8 on: April 28, 2011, 06:22:44 18:22 »

I think it can help you (page 17),

http://atmel.com/dyn/resources/prod_documents/doc2566.pdf
Logged
solutions
Hero Member
*****
Offline Offline

Posts: 1446

Thank You
-Given: 590
-Receive: 851



« Reply #9 on: April 28, 2011, 08:55:03 20:55 »

Page 15:

"Accumulated data is stored 32 bits wide (signed long) and the calculation result is
stored as a floating-point number."
Logged
shams_iqbal
Newbie
*
Offline Offline

Posts: 30

Thank You
-Given: 5
-Receive: 12


« Reply #10 on: April 28, 2011, 11:23:46 23:23 »

I am not a s/w guy, BUT....

1) You don't initialize Adsum the first time through that I can tell.  If that's the case, whatever is randomly in the register is what's used...all depends when the interrupt hits
2) You increment "COUNT", but your variable elsewhere is "Countw"
3) You dont do any declarations, but I am guessing this is all signed integer?  If so, counting the sign bit, your math roundoff/truncation error may totally suck at 16 bits (if that's what you are using)
4) You have <200usec to do all this between samples...
5) You did remember to put a 1.2kHZ LP AAF in front of your ADC I hope
6) 10 bits with 300V pk is +/-0.6V resolution with perfect linearity....good luck with that one, especially since you are doing a prescale of at least 120;1 (600Vpk-pk to 0-5V and offset 2.5V), meaning you're in the noise floor pretty quickly if you are not mighty careful...but it doesn't work with the bench generator, so you haven't peeled to that part of the onion just yet
7) Stop being a girl...write it all in assembler :-)


                          thanks dear here is complete project i have uploaded vedio on youtube also
              HERE IS LINK
               http://www.youtube.com/watch?v=1qyV_UJQLiA
now here is code for this video



'***************** TRUE RMS METER
'SEP 5 2010
'$sim
$crystal = 8000000
$regfile "m8def.dat"

'for attiny 26 timer0 is used as time base n timer1 for pwm
' here config for attiny 26
Config Adc = Single , Prescaler = 32
Admux = 0
Adcsra = &B10001101

On Adc Adc_isr

Config Portd = Output

'Config Timer0 = Timer , Prescale = 8
'Enable Timer0
'On Timer0 Timebase
'Tccr2 = &B00001011
'Ocr2 = 78
'Ocr2 = 125
Enable Ovf2
Tccr1a = 2
Tccr1b = 26
Capture1 = 500
'Config Portd = Output
On Timer1 Timebase
'Dim Doom As Bit

Enable Timer1
'On Timer2 Update
'Enable Timer2

$lib "lcd4busy.lib"

'define the used constants
'I used portA for testing
Const _lcdport = Portb
Const _lcdddr = Ddrb
Const _lcdin = Pinb
Const _lcd_e = 1
Const _lcd_rw = 2
Const _lcd_rs = 3


'this is like always, define the kind of LCD
Config Lcd = 20 * 4

'--------------------- veriables
Dim Getsample As Bit
Dim Cal As Bit
Dim Sample As Integer
Dim Count As Byte , Channel As Byte
Dim Sample_h As Byte At Sample Overlay
Dim Sample_l As Byte At Sample + 1 Overlay
Dim Ref As Word
Dim Sum As Long
Dim Adsum As Long
Dim Newsum As Long
Dim Aref As Word
Dim Countw As Byte
Dim Outvolt As Long
'Dim Cal As Bit

';;;;;;;;;;;;;;;;;;; intiliaz
'Cls
'Lcd " HELLO "
'Wait 2
Channel = 2
Ref = Getadc(0)

Admux = 0
Enable Interrupts
'+++++++++++++++++++++++++ main prog
Do



If Cal = 1 Then
Set Portd.1                                                 'IF TOTEL SUM IS CALCULATED THEN DO SQUIER ROOT OF IT
Cal = 0
Newsum = Newsum / 20
'Countw = 0
Outvolt = Sqr(newsum)
'Reset Portd.1
Cls
Locate 1 , 1
Lcd " SAMPLE " ; Sample
Locate 2 , 1
Lcd " OUTVOLT " ; Outvolt
Reset Portd.1
End If

Loop

End                                                         'end program
'HERE IS TIME BASE INTRUPPET FOR ADC SAMPLING
Timebase:
Set Portd.0
Adcsra.6 = 1

Getsample = 1

If Count = 20 Then
Count = 1
'Cal = 1
Else
Incr Count
End If


Return

'HERE IS SQUIER OF EACH SAMPLE

Adc_isr:

Aref = Adc
Sample = Aref - 512                                         ' READ ADC VALUE AND TRIM OFFSET
Sum = Sample * Sample                                       'SQUIER OF EACH SAMPLE
Adsum = Adsum + Sum                                         'ADD TOTALEL SUM
If Count = 20 Then                                          'CHEK IF U GOT 40 VALUES THEN SET FLAG FOR CALCULATION OF SQUIER ROOT
Cal = 1                                                     ' CLEAR OLD SUMING VERIABLE
Newsum = Adsum
Adsum = 0

End If
Reset Portd.0
Return



                 NOW WHAT IS MY ACTUAL PROBLEM
WHEN I CHANGE SAMPLING INTERVAL THEN IT GIVES ERROR IN THIS STATE IT WILL WORK FOR ONLY 50HZ FREQUENCY AND SHOWS QUITE WELL RESULT BUT IF AC VOLTAGE FREQUENCY IS CHANGED THEN ERROR INCREASE AND THATS THE PROBLEM SO HOW TO OVERCOME THIS ISSUE 
                                OTHER FACTOR IS
                     I AM QUITE SURE THAT THIS WILL ONLY WORK WITH SINEWAVE INPUT AND WITH DIFFERENT INPUT WAVE SHAPE IT WILL NOT WORK  FINE THERE IS A THING CALLED CREST FACTOR HOW TO IMPLEMENT THIS IN CODE NO IDEA NOW AFTER WATCHING THIS VIDEO U CAN SEE HARD WARE ISSUE IF THERE ARE STILL EXIST THEN PLZ POINT OUT LIKE FILTER AND ANY OTHER FURTHER
                CAN U GUIDE THEN PLZ  I WILL BE THANK FULL TO U

AND SORRY FOR BAD ENGLISH BECAUSE I AM TIERED BUT STILL WORKING ON THIS PROJECT
Logged
solutions
Hero Member
*****
Offline Offline

Posts: 1446

Thank You
-Given: 590
-Receive: 851



« Reply #11 on: April 29, 2011, 01:13:05 13:13 »

You can't use a timebase open loop and guess a precise line frequency.

You need to actively mask and unmask your interrupts, initializing variables while masked- interrupts can happen before, during, or after variables init.  

You need to trigger your measurements based on zero crossings, not a timebase, or at least have the timer phase locked or calibrated to the line frequency, which in places like India, can vary as much as 25%.
Logged
Eskimo
V.I.P
Inactive
*****
Offline Offline

Posts: 5

Thank You
-Given: 1
-Receive: 1


« Reply #12 on: April 29, 2011, 08:20:16 20:20 »

For better accuracy you need to count power of 2 samples ex. 32 or 64 or more.

Posted on: April 29, 2011, 08:13:42 20:13 - Automerged

CREST FACTOR you can evaluate as a maximum sample[V] / U(RMS)[V]
Logged
shams_iqbal
Newbie
*
Offline Offline

Posts: 30

Thank You
-Given: 5
-Receive: 12


« Reply #13 on: April 30, 2011, 02:27:57 02:27 »

For better accuracy you need to count power of 2 samples ex. 32 or 64 or more.

Posted on: April 29, 2011, 08:13:42 20:13 - Automerged

CREST FACTOR you can evaluate as a maximum sample[V] / U(RMS)[V]


          THANKS FOR REPLY
                  OK HERE U MENTION CREST FACTOR BUT IF I EMBED IN CODE THEN HOW I CAN
AND CAN U PLZ HELP ME OUT A LITTLE FOR CODE AND FOR UR OPINION OF SAMPLES I AM INCREASING TO 64 SAMPLES PER FULL WAVE FOR BETTER RESULATION FOR INCREASING TO SAMPLE COUNT PER FULL WAVE IT ONLY NEEDS TO CHANGE CAPTURE  VALUE TO 312 IN CODE
"  Capture1 = 312 "
AND DO U THINK SO THAT CREST FACTOR WILL SOLVE THE PROBLEM OF VOLTAGE CALCULATION ERROR
AND HOW THE PROFESSIONAL TRUE RMS VOLT METER CAN CALCULATE MORE BANDWIDTH EG 10 HZ TO 100 HZ EVEN MORE ANY IDEA WHAT TOPOLOGY THEY R USING ESPECIALLY ONE APPLICATION I SAW UPS WHICH IS SHOWING THREE RMS VALUES INPUT VOLTAGE OUTPUT VOLTAGE AND OUTPUT CURRENT  PLZ SHARE
Logged
solutions
Hero Member
*****
Offline Offline

Posts: 1446

Thank You
-Given: 590
-Receive: 851



« Reply #14 on: April 30, 2011, 08:12:51 08:12 »

A true RMS voltmeter measures the heating power (temperature) in a resistor....LinearTech has an appnote on it. You want 1GHz bandwidth? No probs.

Crest factor does ZERO for you.  It's just a calculation you can make and display once you have the RMS value.

You are subject to a lot of quantization error as you get near pi/2 in phase.  You are subject to sampling jitter errors near zero cross.

All that said,as I have said before, you need to manage your timebase to where it is locked to zero crossings and you need to consistently launch and turn off your interrupts. You also need double word precision and floating point math.  Note that you should gather samples only, THEN do the math offline versus realtime computation which is overkill.

The binary sampling size is the least of your worries right now (for your division, it just means simple arithmetic shifts, so it is computationally efficient...but that doesn't matter if you are not doing realtime calcs)

ALL CAPS IS CONSIDERED IN INTERNET ETIQUETTE TO BE YELLING OR FREAKING OUT....are you?
« Last Edit: April 30, 2011, 08:22:25 08:22 by solutions » Logged
shams_iqbal
Newbie
*
Offline Offline

Posts: 30

Thank You
-Given: 5
-Receive: 12


« Reply #15 on: April 30, 2011, 05:43:49 17:43 »

             dear ur analysing is correct for zero crossing error this is genrating result error
but due to
           my actual application i cannot increase samples to more then 64 samples per full wave where i am sampling other adc channels also where adc is limited to 15 k samples at maximum performance with least error
          6 chanels are used and  and so far i have to sample other adc chanels also so time base is fixed but there are some end and last way to lock it with mains frequency where i have no chance to get error eliminating  i know these all issues i am working on this project since last two months
         for rms to dc converter chips they will add an extra cost for my project even if some one will build this project then he need to buy a chip where i am using microcontroller which is capable for high computing power so y not use its internal resources

 what about assembly and basic i think u r assembly guy so u know that variable must be initialized but in basic there is built in routine where all variables are clear to 0 at booting of chip and y i must perform all function in low level routine although its more difficult to debug more time consuming to write code where i know that i have enough computing power available for my functions performing in high level and code area also   
                      7) Stop being a girl...write it all in assembler :-)
            and most important this is a project for other learners too so that's y i am posting it open source here so assembly programing requires good knowledge to understand but high level mostly people can understand and go through it

for floating point its not capable due to cpu usage many other function are also performed in single chip in real time just think if i am building pure sine wave ups with atmega8 then how many resources will be available for this application  regarding to hardware and software computing

                for zero trigger i already tested that it didn't solve problem the only last key point is to lock total samples with input frequency in phase accurately then error will be eliminated so first sample will be taken after zero cross input and 32th sample should  be taken at exact zero cross
            for crest factor what if i measure ac current then it is most important to embed this factor also where current wave shapes can be not pure sine wave
        it seems u have good and practical knowledge regarding to this application so now plz can u guide me in real way to completing this project i will like if u share ur professional knowledge to writing some code here at professional approach
Logged
solutions
Hero Member
*****
Offline Offline

Posts: 1446

Thank You
-Given: 590
-Receive: 851



« Reply #16 on: April 30, 2011, 09:54:50 21:54 »

You'd better read your datasheet carefully.  I think the AVR I used, if memory serves correctly, requires you to throw away the first ADC sample after you switch channels because the value it returns is usually garbage from the S/H prior contents.  Maybe they've fixed that, but you better take a look to be sure.

You still have not said what you are using for a Nyquist filter and what kind of rolloff it has per octave.  I suspect you don't have one with the way you are adjusting sampling rates without too much concern.

In BASIC you have to declare your double word integers - it is not a default. If you just have 16 bit integers, you ARE going to get severe errors and inconsistency due to quantization, jitter, truncation and accumulator errors.

To me, if all this is surmounted, it sounds like you need a dedicated RMS calculator chip.  Get over it and use one more CHEAP AVR (an ATTiny) just for the RMS calculation and A/D, maybe some other housekeeping/glue/port expansion. You're not going to get resources in a constrained processor that are not available to you or that are already used up.

I don't know why you need crest factor, which is useless for RMS voltage computation,  as I am not clear on what you are building. You started the thread with voltmeter, and now you are talking sinewave UPS. A pure sinewave UPS is a lookup table...almost ZERO CPU resource.  I don't understand, actually we don't have enough information to understand, what is eating your CPU up realtime.

I am likely off the net for quite a few days (and might get muted anyway for being a smart aleck, just for a bit of fun, at the moderator), so please don't feel I am ignoring you.  Lots of talent here to help you out.
Logged
ALLPIC
V.I.P
Active Member
*****
Offline Offline

Posts: 113

Thank You
-Given: 64
-Receive: 72


« Reply #17 on: May 01, 2011, 06:57:11 06:57 »

signed long tmp;
void voltage_adc(unsigned char channel)
{
   
    unsigned int no_samples,no_samples1;
    unsigned int ExitDelay;
   union chartype AdcCh;

    tmp1 = 0;
    no_samples1 = 0;
    tmp = 0;
    VCFG = 0;
    ADCS1 = 0;
    ADCS0 = 1;
    ADFM = 1;
    ADON = 1;
   

   AdcCh.byte = channel;
   CHS0 = AdcCh.part.bit0;
   CHS1 = AdcCh.part.bit1;
   CHS2 = AdcCh.part.bit2;
   CHS3 = AdcCh.part.bit3;
    DelayMs(5);
    tmp = 0;
   ExitDelay = 0;


   tmp = get_adc(channel);
   if(tmp<=2)
   {
       while(tmp <= 2)
       {
           tmp = get_adc(channel);
         ExitDelay++;
         if(ExitDelay>3000)
            return;
   
       }
   }
   else
   {
      while(tmp >= 2)
       {
           tmp = get_adc(channel);
         ExitDelay++;
         if(ExitDelay>3000)
            return;
   
       }
      ExitDelay = 0;
      while(tmp <= 2)
       {
           tmp = get_adc(channel);
         ExitDelay++;
         if(ExitDelay>3000)
            return;
   
       }
   }
   ExitDelay = 0;
   for(no_samples=0;no_samples<=1000;no_samples++)
   {
      tmp = get_adc(channel);
      if(tmp<-2 || tmp>2)
      {
         no_samples1++;
         tmp = abs(tmp);
         tmp = tmp*tmp;
         tmp1 = tmp1+tmp;
      }
   }
   
   tmp1 = tmp1/no_samples1;
   tmp1 = sqrt(tmp1);
   if(tmp1<4)
      tmp1 = 0;

}


simple way of measuring.

Remember hardware is most important when you are doing any RMS

hope this will help
Logged
shams_iqbal
Newbie
*
Offline Offline

Posts: 30

Thank You
-Given: 5
-Receive: 12


« Reply #18 on: May 05, 2011, 04:35:57 04:35 »

You'd better read your datasheet carefully.  I think the AVR I used, if memory serves correctly, requires you to throw away the first ADC sample after you switch channels because the value it returns is usually garbage from the S/H prior contents.  Maybe they've fixed that, but you better take a look to be sure.

You still have not said what you are using for a Nyquist filter and what kind of rolloff it has per octave.  I suspect you don't have one with the way you are adjusting sampling rates without too much concern.

In BASIC you have to declare your double word integers - it is not a default. If you just have 16 bit integers, you ARE going to get severe errors and inconsistency due to quantization, jitter, truncation and accumulator errors.

To me, if all this is surmounted, it sounds like you need a dedicated RMS calculator chip.  Get over it and use one more CHEAP AVR (an ATTiny) just for the RMS calculation and A/D, maybe some other housekeeping/glue/port expansion. You're not going to get resources in a constrained processor that are not available to you or that are already used up.

I don't know why you need crest factor, which is useless for RMS voltage computation,  as I am not clear on what you are building. You started the thread with voltmeter, and now you are talking sinewave UPS. A pure sinewave UPS is a lookup table...almost ZERO CPU resource.  I don't understand, actually we don't have enough information to understand, what is eating your CPU up realtime.

I am likely off the net for quite a few days (and might get muted anyway for being a smart aleck, just for a bit of fun, at the moderator), so please don't feel I am ignoring you.  Lots of talent here to help you out.

 Shocked
    thanks
as i started embedded programing in assembly launguage since 1999 so for calculation i mostly care about code and variables
        double word signed integer = long (32bit signed integer )in bascom avr compiler 
    ADC it only gives first time garbage acording to ur reading of data sheet but then it work fine if it gives every time garbage then this chip is use less and no one will use these chips so this point is not important due to if first time measurement is not good then we can ignore this and continue to other reading and u just wasting ur energy to being extra sensitive moderator for extra and weight less points
12 years of experience teach me that what is ur application and what  should be the project
         multiply is not a problem but divide and squire root  is big burden on any 8 bit microcontroller where if we divide 32bit signed integer in 8 bit chips they can do but two many time is consumed
      mostly 8 bit microcontroller dont have 32 bit hardware math processor
for sine wave ups thats just a point for utilization this function and thats y mine approach is to gain very easy and efficient solution for real time use 
          but i am still improving this project and reduced error to almost 5 to 7 count with input frequency 45 to 65 hz even more frequency range when i complete this project then i will post this project as open source
          and attiny chip can also perform this task with 32 general purpose registers and built in adc with only three io ports wich controls cd4094 shift register to interface lcd  Grin great idea  yes offcourse i will try attiny chip also even 8 pin or 14 pin chip same with lcd interface or analog output for reading with any volt meter and some cheep pic chips also with source code in three flavor assembly , basic and c for hobiest to professional engineer use Tongue
             i will say that not result full approach from u even u can see there is another post after u that proves some real time approach against my post and u just moving my post to left to right and right to left       so for ur next reply i will try to ignore your any reply to this post  due to totally use less info
            bithe way thanks for contribution just making fun for u and wasting mine time to write u these quote 
Logged
chinninitin
Active Member
***
 Muted
Offline Offline

Posts: 136

Thank You
-Given: 145
-Receive: 37



« Reply #19 on: June 07, 2011, 06:56:27 18:56 »

Bit difficult to work with with ATMEGA8 kind of uC

because you need to take sample and soon as u get sample square it and keep doing it till you complete samples/sec

then square root it.  you will get raw rms value, and scale it for your front end components such as potential dividers

so I suggest better go for ASICs from ADI or ST (STPM10)

or go with any uc (MSP430 from TI) having MAC such as MSP430F2313 or F425 etc..

Regards
Chinni
Logged
optikon
V.I.P
Hero Member
*****
Offline Offline

Posts: 604

Thank You
-Given: 460
-Receive: 1604


« Reply #20 on: June 29, 2011, 01:28:23 01:28 »


You did not specify what kind of accuracy you require for your RMS measurements? I didn't see you mention that. To me, if the chip IC can meet that requirement, you should just do that. Otherwise, what you are suggesting is to somehow measure these AC voltages more accurate than an RMS converter IC and write an algorithm that would do a better job. I voted to just interface to the IC if you need the measurements.
Logged

I can explain this to you. I can't comprehend it for you.
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC