Go Down

### Topic: 3 Phase sequence indicator (Read 1 time)previous topic - next topic

#### cedarlakeinstruments #15
##### Dec 03, 2018, 05:30 pm
Take another look at my post #7 and see if it applies...

When i try with the DC source it displays the number correct, but if i connect the A0 to the rectifier it displays always '0'. Check the attachments below
Electronics and firmware/software design and assistance. No project too small

#### geoland #16
##### Dec 05, 2018, 03:42 pmLast Edit: Dec 05, 2018, 07:26 pm by geoland
I think i'm close now, please check attachments, The R and B values are the maximum values read in A0 and A1(Or at least i hope), B are the instant readings in A1. So the next step is to compare the readings in A0,A1 and A2. As we know each phase seperation in 3 phase system is 120°, So in 50Hz the period is 20ms, so the difference of the each phase is 6.66666 ms . As you in attachment the max value(V peak) is 117-118 ,about 0.55 volt. So i must compare the value of A0 with the value of A1 after 6.6666ms, if they are about the same then the sequence is RIGHT,else if the value of A0 equals the value of A2 after 6.6666ms then the sequence is LEFT. Another thing i have to figure out is, for the system to work with different Hz, for example with 60Hz 3phase systems without need to change the code. So i need the code to check the period and then proceed to the rest. Till now i successfully display the readings in A0,A1,A2,here is the code:

#include <LiquidCrystal.h>
LiquidCrystal lcd (12,11,5,4,3,2);
int max1=0,max2=0;

void setup() {
// put your setup code here, to run once:
lcd.begin(16,4);
}

void loop() {
// put your main code here, to run repeatedly:
lcd.setCursor(0,1);
int value=analogRead(A0);
int value1=analogRead(A1);
int value2=analogRead(A2);
for (int i=0;i<250;i++)
{
if (value>max1)
{
max1=value;
}
}
for (int r=0;r<250;r++)
{
if(value1>max2)
{
max2=value1;
}
}
lcd.setCursor(0,0);
lcd.print("R:");
lcd.print(max1);
lcd.setCursor(0,1);
lcd.print("Y:");
lcd.print(max2);
lcd.setCursor(0,2);
lcd.print("B:");
lcd.print(value2);

}

#### cedarlakeinstruments #17
##### Dec 06, 2018, 02:47 am
If I understand this project, you are trying to understand the order of phasing of a three-phase signal. Wouldn't it be much simpler to record the zero crossings of each channel, so you don't have to worry about speed of analog acquisition or signal amplitude?
Electronics and firmware/software design and assistance. No project too small

#### geoland #18
##### Dec 06, 2018, 08:04 pmLast Edit: Dec 06, 2018, 08:10 pm by geoland
Yeah it sounds like a good idea.Can you give me an example??
should i check it using something like this??
while (r==0)
{
mark1=millis();
}
while (y==0)
{
mark2=millis();
}
while (b==0);
{
mark3=millis();
}

if (mark1<mark2 && mark2<mark3)
{
lcd.print("RIGHT");
}
else
lcd.print("left");

#### wvmarle #19
##### Dec 07, 2018, 04:37 am
That code contains three infinite loops.
Why don't you describe in detail in words and images what you actually try to accomplish (and use code tags when posting code).
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

#### cedarlakeinstruments #20
##### Dec 07, 2018, 05:18 pm
Basically I would configure each signal input as an interrupt. Timestamp when each positive zero-crossing occurs. The order of triggering will tell you the order of phasing and you can derive frequency from the timestamps.

That should be enough to get you started. If you need the code written, PM me and I can quote you a fixed amount.
Electronics and firmware/software design and assistance. No project too small

#### geoland #21
##### Dec 10, 2018, 03:25 pmLast Edit: Dec 10, 2018, 03:27 pm by geoland
That code contains three infinite loops.
Why don't you describe in detail in words and images what you actually try to accomplish (and use code tags when posting code).
i wanna Arduino check the sequence of a 3 phase system, also check the frequency.
I think i figured how to check the sequence in 50Hz system, now all i wanna do is first find the frequency and then proceed to the rest

#include <LiquidCrystal.h>
LiquidCrystal lcd (12,11,5,4,3,2);
int max1=0,max2=0;
unsigned long period;
long previousmillis = 0;
unsigned long currentmillis,endmillis;
int led=6;

void setup() {
// put your setup code here, to run once:
lcd.begin(16,4);
}

void loop() {
// put your main code here, to run repeatedly:
int phase1=analogRead(A0); // A0 value phase 1 R
int phase2=analogRead(A1); // A1 Value phase 2 Y
int phase3=analogRead(A2); // A2 Value phase 3 B
//Check if sequence is RYB or RBY
//I do that by comparing the Values or R and Values of Y and B after 6.66666 ms (difference of each phase is 120 degrees in 50Hz system)
//The Max Values in A0,A1,A2(3 phases) are 625, equals 3 Vpeak.
lcd.setCursor(0,2);
if (phase1>200)
{
delay(6.666);
if (phase2>200)
{
lcd.print("RIGHT"); //Print RIGHT if phase1>200 and after 6.666ms phase2>200
}
if (phase3>200)
{
lcd.print("LEFT"); //Print Left if phase1>200 and after 6.666ms phase3>200
}
}
for (int r=0;r<250;r++)
{
if(phase1>max2)
{
max2=phase1; //Check the max value readings
}
}
lcd.setCursor(0,0);
lcd.print("Max Value:");
lcd.print(max2);
lcd.setCursor(0,1);
lcd.print("period:");

}

#### wvmarle #22
##### Dec 10, 2018, 09:51 pm
i wanna Arduino check the sequence of a 3 phase system
What do you mean with this, exactly?

Quote
, also check the frequency.
That's a matter of measuring how long time there is between two zero crossings.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

#### Paul_KD7HB #23
##### Dec 10, 2018, 10:28 pm
What do you mean with this, exactly?

That's a matter of measuring how long time there is between two zero crossings.
After reading these posts for a while I think the OP is looking for the "rotation" of the phases.

Fairly important in a few situations. I recall when the power company replaced one blown transformer of a set of three and got the phasing wrong. All the IBM tape drives immediately unwound all the 1200 ft. reels of tape we had mounted.

But the phase rotation is only usable if you knew the rotation before the incident.

Paul

#### geoland #24
##### Dec 11, 2018, 02:05 am
What do you mean with this, exactly?
Check the rotation of the motor

[/quote]
That's a matter of measuring how long time there is between two zero crossings.
[/quote]
Yeah i have some dificculty doing this any example??

#### cedarlakeinstruments #25
##### Dec 11, 2018, 03:28 am
I think what OP is looking for is pretty clear. It's the solutions I find questionable.
Electronics and firmware/software design and assistance. No project too small

#### wvmarle #26
##### Dec 11, 2018, 10:46 am
Check the rotation of the motor
That's normally done with an encoder.

If you're actually looking for the rotation of the PHASES themselves, that again should easily be doable with the same zero crossing, combined with a reading halfway the crossings to find whether it's a positive or negative half of the cycle.

Quote
That's a matter of measuring how long time there is between two zero crossings.

Yeah i have some dificculty doing this any example??
Code: [Select]
`void loop() {  for (byte i = 0; i < N_PHASES; i++) {    if (digitalRead(zeroCrossingPin[i]) == HIGH && previousReading[i] == LOW) {      currentMicros[i] = micros();      timePassed[i] = currentMicros[i] - previousMicros[i];      frequency[i] = 2 * 1000000 / timePassed[i];      previousMicros[i] = currentMicros[i];      previousReading[i] == HIGH;    }     else {      previousReading[i] = LOW;    }  }}`

Basic example of frequency reading using zero detection. N_PHASES is the number of phases, probably 3.

Separately feed the three phases through proper voltage divider and offset to analog inputs, halfway the frequency (which should be very constant) read whether you have a positive or negative wave. If you do this exactly halfway (should be easy: frequency should be very constant) and if you know the waveform (sine?) you can even get the RMS and peak voltage values.

Come to think of it: it should be quite easy to get a circuit that produces a high signal during the positive half, and a low signal during negative wave. That way you can measure both frequency and phase rotation through just the digital pins. The edges of the block wave are at the zero crossings and give you the frequency, the high/low part tells you where in the cycle you are.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

Go Up