# three phase volt measurement using resistor network method

1. ## three phase volt measurement using resistor network method

hi all
right now am designing three phase protection circuit
for that i planned to measure the voltage using resistor net work method, herewith i had attached my circuit and my volt measuring code,
everything working good but in sometimes the R phase connected to AN0 pin shows high reading, kindly go through my code and give your valuable suggestions.

2. ## Re: three phase volt measurement using resistor network method

Hi,

327 lines of undocumented code. Thanks for this riddle.

You want us to find the error around "AN0" but there is no "AN0" in your code.

"Three phase" makes me assume you talk about "AC" .... then you talk about "shows high reading"
* is it logic level HIGH?
* or high DC analog voltage?
* or is it high calculated AC amplitude?

We don't know about: the used microcontroller, schematic, compiler....

--> give useful and complete informations.

Klaus

•

3. ## Re: three phase volt measurement using resistor network method

hi Klausst
i ill tell you clearly am going to sense Three phase AC voltage using resistor divider method,

Three phases say R Y B am converting high voltage AC to controller accepted voltage using resistor network and then i fed into PIC16f887 RA0(Rphase), RA1(Yphase), RA5(B phase)

Phases Y and B are giving correct value but the trouble is in R phase which is connected to microcontroller Pin RA0( ADC input 0). some time its gives correct value say 415, but in sometimes the values goes upto 520 like that and after some time its shows the correct value...

if there is and bug in my code kindly give your suggestion. i ill post the voltage measuring code here.... and also i attached the circuit in my previous post.

4. ## Re: three phase volt measurement using resistor network method

I don't see a specific reason in the code for getting outliers in the first channel.

Determining the absolute maximum of instantaneous voltage is however a poor method to measure AC voltage. A simple reason might be that the input voltage is actually distorted, or there can be crosstalk on the PCB.

I would try with a low pass filter, e.g. 100 nF in parallel to 3.3k voltage divider resistor.

•

5. ## Re: three phase volt measurement using resistor network method

hi FvM

the problem not comes all the times but some time only in first channel rest of the channel are ok...
i ill add a low pass filter and check it again....

•

6. ## Re: three phase volt measurement using resistor network method

Hi,

I guess the problem is in the schematic.Maybe floating inputs (digital or analog), noisy supply voltage, noisy reference voltage, unsuitable anti aliasing filters, pushing negative voltages into analog pins...all this is explained in datasheets and application notes)

But all in all, the code is a very dirty solution...and I guess schematic and PCB layout, too.
* Either learn to design mire clean solutions (there are more than enough tutorials, code examples, descriptions, forum threads, videos...available)
* or accept dirty results

Klaus

7. ## Re: three phase volt measurement using resistor network method

like KlausST said your code is undocumented
(except in a few places, where is is redundant)

you need to document your code because:
it makes it a lot easier to help

a few weeks after the project is done, you won't remember
what you did, so you'll have to re-invent the whole thing
so a change can be made

you can pass it on to a newbie for maintenance

you're stuck with this project forever and can't move on to
something new and better

there is no such thing as Dilberts holy Grail of programming -
10,000 lines of spaghetti logic -it won't take long for management
to get frustrated and fire you

8. ## Re: three phase volt measurement using resistor network method

hi wwfeldman
thanks for your wordings ! i will improve myself quickly....

•

9. ## Re: three phase volt measurement using resistor network method

This is wrong.

Code:
casting to 16-bit variable needed.

It is better if you use INT0 to detect ZC of Phase R and then after ZC is detected you start reading the phase voltages.

Also, you cannot and should not feed AC voltage with negative part to PIC ADC input pins. Level shift the AC signal to so that the scaled AC signal doesn't have any negative part and it should vary between 0 to 5V DC. If nominal voltage is 440V then make scaled 2.5V = 440V AC voltage.

- - - Updated - - -

My method of Phase voltage reading for your PIC is not so good because there is only one INT0 pin and you can only detect ZC of any one phase with it without using any external logic gates. The problem is then you have to use a timer interrupt to detect the ZC of other 2 Phases but the ZC will vary based on mains frequency and when that happens you will not get precise voltage readings.

I have done a 3-Phase voltage measurement using PIC18F46K22 which has 3 INTx pins and I have used them with 3 ZCD circuits and I start measuring the voltages on ZCs based upon mains frequency. I, however, assume that at all times the frequency of all the phases will be the same.

- - - Updated - - -

Your circuit modified to handle 500Vrms max for the Phase voltages. +5V DC Offset obtained from PIC's 5V Power Supply.

Initially, I designed the 3x ZCD circuits for PIC18F46K22 for my Pump Starter Cum Automatic Water Level Controller but later modified it for you. You can either use the 3x ZCD circuits and XOR gates to get the ZC signal or just one ZCD say ZC_R circuit to get the ZC signal without XOR gates.

In the XOR circuit, the high-to-low of ZC signal gives the zero crossings of the ZC_R signal.

- - - Updated - - -

My previous circuit (PDF file) had issues related to ADC input voltage.

I have fixed it. Here is the new circuit. You can use it. It handles max 500Vrms.

10. ## Re: three phase volt measurement using resistor network method

hi baileychic
First of all i would like to say Thanks for your wonderful effort for me... i really appreciate your works..
ya there is some problem in my code and my hardware too... but unfortunately the pcb design over and i got 110 nos of pcb, i could not able to modify the PCB right now, but i will made some changes in my code and i use it for rightnow ! later i ill consider your suggestion and i ill work in bread board and i ill update here..

11. ## Re: three phase volt measurement using resistor network method

Your

Code:
void GetVolt3()
code is not good. It tries to find the peak value of voltages but that is only good for sinusoidal voltage. If your voltage is distorted due to load then you will not get the correct voltage readings.

1 members found this post helpful.

hi to all