phase sequence detection using arduino

can anybody know how to use optocoupler for detecting phase sequence and its correction using arduino.I am using arduino MEGA2560. Can any body can help me please in programming

Give a full description of your project or we are unable to work out what you actually need to do.


this is circuit diagram


And what does it do? What do you want it to do.

Give us a description of its purpose.

We don't want to have to work out what it is doing. If you want help give us all we need to know.


Is this a phase rotation indicator for a 3-phase source? Are signals R-Y, Y-B, B-R representative of Red-Yellow, Yellow-Blue, Blue-Red phase connections? If so, then these colors are assigned Red (phase A), Yellow (phase B), Blue (phase C), so the signals could be designated A-B, B-C, and C-A.

Take a look at how two quadrature encoder output signals are evaluated to determine CW or CCW direction. It would be easy to expand on this method to include one more signal and determine ABC or CBA phase rotation.

Hi, The project monitors the three phase supply to some high priority device, such as a mains water pump. It detects if should the power be disconnected that when it is turned back on, is in the same phase sequence to ensure the pump rotates in the correct direction. It also monitors each phase voltage and current, to check for any supply failures or motor failures.

How do I know, I repair them, one customer has 140 of them, all with a component design fault that reared its head after 3 years, all within the following 3 months.

Tom....... :)

i want to check if 3 phases RYB are in phase sequence if there is any interchange between any phases like RBY then motor will rotate in opposite this project i want to avoid it and put the motor in same phase as previous.So please anybody help me in programming.i have an idea that check zero crossing of each phase using optocoupler and give it to arduino and check sequence of input in please help me in this method

please help me

How to get Arduino know which phase is reverse or phase change because all phase have same volt approx or it may change slighty from main supply.

int i = 0;
void setup()
  pinMode(A0, INPUT);
  pinMode(A1, INPUT);
  pinMode(A2, INPUT);
void loop()
  double r = analogRead(A0);
  double y = analogRead(A1);
  double b = analogRead(A2);
  if (r > 300 && r < 750){
    delay (6.66666666);
    if ((y > 300 && y < 750) && (i == 0))
      i = 1;
    if ((b > 300 && b < 750) && (i == 0))
      i = 1;

can anyone explain this code for phase sequence indicator? ::)

You can buy such devices quite cheaply - see eg

You could well make one using an arduino - my worry would be interfacing to a 415vac supply, which, unless you understand what you're doing, and build with appropriately rated components, and insulate it well could be very dangerous.

NOT a breadboard job.

Note there are various different colour codes for the wiring... which can be confusing.


Basically phase 1 is the reference, 2 lags it by 120 degrees, 3 lags by 240 degrees.


KATARIYAKISHAN: can anyone explain this code for phase sequence indicator? ::)

I won't detect phase difference or sequence, in my opinion it is junk. Tom... :o :)