EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Topics / SOURCE CODE for THREE PHASE 440 VOLTS PHASE DETECTOR/FAILURE

SOURCE CODE for THREE PHASE 440 VOLTS PHASE DETECTOR/FAILURE

|

Projects › Projects › SOURCE CODE for THREE PHASE 440 VOLTS PHASE DETECTOR/FAILURE

  • This topic has 1 reply, 2 voices, and was last updated 10 years, 7 months ago by Prabakaran P M.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • July 11, 2015 at 1:56 pm #3760
    Dhananjaya
    Participant
    Dear Sir/Madam please give any idea/concept for AC Phase detecting either Present/Absent (Logic 1/0)without converting DC volt to detect TTL PIC16F676 microcontroller someone already implemented this products but know i am also implementing  this concept on same circuits but I have dont know the logic/ C code for this know I am tried as follows but still i cant  able to detecting phase
     
    three phase (RY & B) AC analog inputs directly connected microcontroller pin without converting DC volts / reduced the voltage by using resistor divider circuit  series with of 2.2Mohm 0.5watt+5Mohm 0.25watt connected to microcontroller(PIC16F676 pins RA0,RA1 & RA2). and internal oscillator like
     
    #define _XTAl_FREQ 4000000
    __CONFIG(0x3FF4)
    #define R_phase RA0
    #define Y_phase RA1
    #define B_phase RA2
     
    #define Three_phase_LED RC0
    #define Two_phase_LED RC1
    #define Single_phase_LED RC2
    #define NO_phase_LED RC3
     
    char phaseRflag = 0;  // flag variables for each phase
    char phaseYflag = 0;
    char phaseBflag = 0;
     
    char single_phase_flag = 0;  // used for single phase detection test
     
    unsigned int sample = 0; // used to set "for loop" duration
     
    void main()
    {
      CMCON=0x07;
      ANSEL=0x00; 
      TRISA =0b001111;
      PORTA=0b001111;
      TRISC=0b000000;
      PORTC=0b00000;
     
      while(1) // while loop to test phases continously
        {
        phaseRflag = 0;  // phase flags are set to zero
        phaseYflag = 0;
        phaseBflag = 0;
       
       // a "for loop" tests the inputs for 20 milliseconds, setting a flag if a logic 1 is read
     
        for(sample = 16000; sample > 0; sample–)  // test all phases for at least 20 milliseconds
            {
            if(R_phase)        // if a 1 is detected on a phase set a flag to 1;
               phaseRflag = 1;
            if(Y_phase)
               phaseYflag = 1;   
            if(B_phase)
               phaseBflag = 1; 
            }                          // end of the  for loop   
     
        // phase tests running as before, except now looking at the flag settings
        // test for all phases on


      
        if(phaseRflag && phaseYflag && phaseBflag) 
           Three_phase_LED = 1;  // RC0 pin connected(Three_phase) LED will Glow ON
        else
           Three_phase_LED = 0;
     
        // test for phase R and B on


     
        if(phaseRflag && phaseBflag && !phaseYflag)
            Two_phase_LED = 1;    // RC1 pin connected(Two_phase) LED will Glow ON
        else
            Two_phase_LED = 0; 
     
        // test for a single phase on


     
     
        single_phase_flag = 0;  // set if only a single phase was detected
     
        if(phaseRflag || !phaseYflag || !phaseBflag)  // only R_phase is on
             single_phase_flag = 1;  
       
        if(!phaseRflag || phaseYflag || !phaseBflag)  // only Y_phase is on
             single_phase_flag = 1; 
       
        if(!phaseRflag || !phaseYflag || phaseBflag)  // only B_phase is on
             single_phase_flag = 1; 
       
        if(single_phase_flag == 1)   // if  a single phase was detected
             Single_phase_LED = 1;   // RC2 pin connected(Single_phase) LED will Glow ON
        else
             Single_phase_LED = 0;   // single phase LED off
        
        // test for no phases on


       
        if(!phaseRflag && !phaseYflag && !phaseBflag)
           NO_phase_LED = 1;    // RC3 pin connected(No_phase) LED will Glow On    
        else
           NO_phase_LED = 0;
       }   // end of while loop
    }      // end of main
     
     
    In this pregame only  
           NO_phase_LED = 1;    LED is On  always….  
    August 14, 2015 at 5:56 am #13169
    Prabakaran P M
    Participant

    First check the outpit of the voltage divider in each phase about voltage and if it is possible check with CRO. 

    If your project is only to detect the phase then add diode inthe output of voltage divider which will act as a half rectifier.

     

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • H bridge current direction logic March 11, 2026
  • LM741 alternatives? March 11, 2026
  • Very Curious Issue With DS3231 RTC Clock March 10, 2026
  • Distorted output from buffer March 10, 2026
  • Motor Getting Hot March 10, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise