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);
}