Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
24 views21 pages

Eeeelatest

The document discusses the design and implementation of a Zero Crossing Detector Circuit using the PIC16F877A microcontroller, which detects the zero crossing points of a sine wave for applications in AC power control. It outlines the necessary components, including voltage limiting resistors, a bridge rectifier, and an NPN transistor, and provides code examples for programming the microcontroller to generate a pulse during zero crossing events. Additionally, it highlights the applications of zero crossing detection in synchronization, dimmer control, and audio signal processing.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
24 views21 pages

Eeeelatest

The document discusses the design and implementation of a Zero Crossing Detector Circuit using the PIC16F877A microcontroller, which detects the zero crossing points of a sine wave for applications in AC power control. It outlines the necessary components, including voltage limiting resistors, a bridge rectifier, and an NPN transistor, and provides code examples for programming the microcontroller to generate a pulse during zero crossing events. Additionally, it highlights the applications of zero crossing detection in synchronization, dimmer control, and audio signal processing.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 21
2127124, 8:55 PM. Zero Crossing Detector Circuit using Pie Mirocontroller Next-Day Company Registration - Get Started Advertisement °F Don't iss Business Tx Deatnes: at Zero Crossing Detector Circuit using Pic Microcontroller Offshore Company with Ease: Mauritius Awaits Zero crossing detector circuit is designed to detect the zero crossing of a sine wave. It is used for AC Power control circuits. If you are an electronics engineer and you are working on power electronics projects, you may come across many situations where you have to read the frequency of a sine wave or you want to detect the zero crossing of a sine wave. Whenever a sine wave crosses from the positive cycle to the negative cycle or from the negative cycle to the positive cycle, you can also detect the zero crossing of a sine wave with the help of a simple operational amplifier. have already posted an article on zero crossing detection using op-amp. But in this article, | am going to discuss how to detect zero crossing using the PIC16F877A microcontroller and some other simple electronic components. There are many projects on zero crossing detection available on many websites. However, none of them provides complete information about the zero crossing detector circuit. In many power electronics projects, you want to use zero crossing detection and also a microcontroller. For example, the zero crossing detector circuit is used in sine wave frequency measurement. In a digital frequency meter, you want to display the frequency value on a liquid crystal display. So you must need a micracontroller that can ‘ntps:Imicrocontolesiab comizero-cossing-detectr-circul-sing-pic-microcontoler! sia 2127124, 8:55 PM. Zero Crossing Detector Circuit using Pic Microcontraller ‘= Single phase sine wave inverter ‘* Three-phase sine wave inverter What is Zero Crossing Detection? Zero crossing detection refers to the identification of points in an electrical waveform where the voltage or current signal crosses the zero-volt reference level. In an AC (alternating current) waveform, the voltage and current oscillate between positive and negative values, crossing zero volts or zero current at regular intervals. The zero crossing points occur twice during each cycle of the AC waveform (once during the positive half-cycle and once during the negative half-cycle). Ca hy -hour Build Time. Quality Guaranteed Most Soldermask Colo ane) ey ee ee Zero Crossing Detector Circuit Components The following main components are used in this electrical project. Brief descriptions of these components are also given below: Empower Your Business with Expert Help Ccomany Parnes Voltage source 220volt or 120 volt sine wave voltage source which you want to detect zero crossing using zero crossing detector circuit using pic microcontroller. Voltage limiting resistors Two voltage limiting resistors are used to limit the voltage. The maximum voltage drops across these resistors. AC voltage less than 5 volts appears across the full bridge rectifier. Now the question is, why do we need voltage limiting resistors in this circuit? Because microcontrollers cannot read voltage more than 5 volts, or voltage more than 5 vaits can nermanentiy damage the microcantraller Twin 720K racictars are ised ac voltage limiting racists. ‘ntps:microcontrolesiab comizero-cossing-detectr-circul-sing-pic-microcontoler! 2a 2127124, 8:55 PM. Bridge rectifier Zero Crossing Detector Circuit using Pie Mirocontroller After voltage-limiting resistors, a full bridge rectifier circuit is used, It is used to convert the negative cycle into a positive half cycle or to convert AC voltage into pulsating DC voltage. This is because, after the full bridge, an NPN transistor is used as a switch that only turns off on zero crossing. NPN transistor ‘The NPN transistor is used in this project as a switch, which provides a positive edge interrupt to the microcontroller during zero crossing. You can use any NPN transistor. | have used the 2N3904 NPN transistor in this project. Advertisement Sz ‘Step Into Entrepreneurship - Register Your Company Here Comany Parnes PIC16F877A microcontroller The specific relevant content for this request. if necessary, delimited with characters: PIC16F877A microcontroller is the main part of this project because it measures zero crossing with an external interrupt. Whenever the sine wave crosses zero point, a positive edge interrupt is produced at the output of the NPN transistor. The microcontroller measures this interrupt and generates a small pulse at PORT D pin number zero or PDO." Circuit diagram of zero crossing detector circuit using PIC microcontroller Acircult diagram of a zero-crossing detector Is given. | have tried to explain all the components of the zero-crossing detector circuit above. But if you still have any confusion, your comments are welcome. ‘ntps:microcontrolesiab comizero-cossing-detectr-circul-sing-pic-microcontoler! 324 2127/24, 8:55 PM Zero Crossing Detector Circuit using Pie Mirocontroller Ra a 2 a Sa Faw vasa ae mat Sayre Rasaunumersevner a * ee eee r Adverfisement a moo os moses A rcasocca ezanrecs FA Sh fe 1 s oo tes = a : iL ese ite: Bose a aves. Se circuit lagram of zero crossing detector using pc microcontroller Microcontroller PIC16F877A uses an external interrupt to read the zero crossing point of a sine wave. If you are unfamiliar with programming PIC microcontrollers and would like to learn about them, please refer to the following articles * Getting started with pic microcontrollers * What is best way to learn AVR microcontroller Simulation Simulation results of the zero-crossing detector circuit are shown in the figure below. Labels are also shown for zero-crossing, pulse, and interrupt. Beneficial Ownership Compliance Simpifiod ‘Conary Parnrs htpsmicrocontrolersab.com/zero-crossing-detectorcrcut-using-pe-mierocontoller 424 2127124, 8:55 PM aaa Zero Crossing Detector Circuit using Pie Microcontroller xt Interrupt EREEEEE zero crossing detector circuit, List of components Category,Reference,Value,Order Code Resistors,"R1",330, Resistors,"R2",10k, Resistors,"R4",10k, Integrated Circuits,"U2",PIC16F877A, Transistors,"Q1",2N3904, Miscellaneous, "BR1",2W04G, Miscellaneous,"X1",CRYSTAL, Code ‘The code for this project is written in the MIKROC compiler and 8Mhz crystal is used in this project. If you do not know how to use MikroC for Pic, you can refer to these tutorials: ‘© How to Use "MikroC PRO for PIC" to Program PIC Microcontrollers * Pic microcontroller programming in c using Mikroc Pro for PIC The following code is an implementation of zero crossing detection using a PIC16F877A microcontroller written in the MikroC programming language. The program utilizes an external interrupt triggered by a falling edge on the BO pin, which is connected to a zero-crossing detection circuit. The zero crossing event is signaled by setting a flag htpsmicrocontrolersab.com/zero-crossing-detectorcicult-using-pic-mierocontoller 921 2127/24, 8:55 PM Zero Crossing Detector Circuit using Pie Mirocontroller /1 Components: // 1, Microcontroller with external interrupt capability // 2. LED connected to PORTD, Pin @ (RD@) // 3. Zero crossing detection using external interrupt on R80 J/ define Flag for zero crossing detection unsigned char Flagreg; sbit ZC at Flagreg.90; // Interrupt Service Routine for external interrupt void ingageHAsdchent { if (INTCON. INTF) { // INTF flag raised, indicating an external interrupt (zero crossing) z=; // Set zero crossing flag INTCON.INTF = 8; // Clear the interrupt flag } > void main() { // Initialize PORTB, PORTD, and configure pins PORTB = @; TRISB = @x01; // RBA is configured as input for external interrupt PoRTD = @; TRISD = @; —_// PORTD configured as output for LED // Configure external interrupt settings OPTTON_REG. INTEDG // Interrupt on falling edge INTCON.INTF = 05 // Clear the interrupt flag INTCON.INTE = 13 // Enable external interrupt INTCON.GIE = 1. // Enable global interrupt 11 Main loop while (1) { if (zc) { // Zero crossing occurred PORTD.F® = 1; // Send a 1ms pulse by turning on the LED delay_ns(1); PORTD.FO = 8; // Turn off the LED 2 =o; // Reset zero crossing flag htpsmicrocontrolersab.com/zero-crossing-detectorcrcut-using-pe-mierocontoller 621 2127124, 8:55 PM. Zero Crossing Detector Circuit using Pie Mirocontroller How Does Code Work? Here is a line-by-line explanation of the code: These lines declare an unsigned char variable called FagReg which will store the flag for zero crossing detection. ‘The sbit keyword is used to define a single bit variable named zc at the bit position 80 of Flagreg. Advertisement ‘Company Registration Made Simple & Speedy unsigned char FlagReg; sbit ZC at Flageg.80; This is the interrupt service routine (ISR) for the external interrupt. Whenever there is an external interrupt triggered, this ISR will be executed. It checks if the interrupt flag INTF in the INrcoN register is raised, indicating an external interrupt (zero crossing). Ifthe flag is raised, it sets the 2c flag to 1 and clears the interrupt flag void interrupt() t if (INTCON. INTF) w= 4a INTCON.INTF = 0: } } ‘These lines initialize the PORTB, PORTD registers by setting them to 0 (no voltage) and configure the corresponding pins as inputs and outputs. PORTS is configured as an input for the external interrupt, and PORTD is configured as, an output for the LED. void main() { PORTS = 0; TRISB = @x01; PoRTD = @; TRISD = 0; ‘ntps:Imicrocontrolesiab comizero-cossing-detectr-circl-sing-pic-microcontoler! nt 2127124, 8:55 PM. Zero Crossing Detector Circuit using Pie Mirocontroller to enable the external interrupt. rNTCoN. iE is set to enable global interrupts, OPTION_REG. INTEDG = 0; INTCON. INTF INTCON. INTE INTCON.GIE This is the main loop of the program. It continuously checks the value of the zc flag. Ifthe flag is set (indicating a zero crossing), it sets the RDO pin (connected to an LED) to 1 to generate a ms pulse. Then it waits for 1 millisecond ysing the detay_ns function. After that, it sets the RDO pin back to 0 to turn off the LED. Finally, it resets the zc flag toe sement Your Business: Ready, Set, Open while (1) « if (20) PORTD.FO = 1; delay_ms(1); PORTD. Fa Ze = 03 } The code essentially waits for a zero crossing event, and when detected, it generates a 1ms pulse on an LED using the PIC microcontroller. Zero Crossing Detection Applications Zero crossing detection is particularly useful in various applications, and it serves several purposes: Synchronization: In power systems, zero crossing detection is crucial for synchronizing the operation of devices or systems with the AC waveform. For example, itis often used in phase-locked loops (PLLs) to synchronize the frequency and phase of an oscillator with an incoming AC signal ‘ntps:Imicrocontrolesiab comizero-cossing-detectr-circl-sing-pic-microcontoler! 821 2127124, 8:55 PM. Zero Crossing Detector Circuit using Pie Microcontroller Your Business, Open Dimmer Control: In lighting systems, especialy in dimmer circuits for incandescent or dimmable LED bulbs, zero crossing d&Q4RISH NAA loyed to control the timing of the phase-cut dimming. This helps in minimizing the ‘generation of electrical noise and reduces stress on the lamp. ‘Audio Signal Processing: In audio applications, zero crossing detection can be used for various purposes, such as pitch detection, audio compression, and waveform analysis. Zero crossing detection is typically implemented using specialized circuits or algorithms in digital signal processing. Itinvolves monitoring the waveform and detecting the point at which the signal crosses the zero level. This Information is then utilized for synchronization or control purposes in various electronic systems and applications. You may also like to read: Your One-Stop Business Solution ‘omany Parnes * Zero Crossing Detection Circuits Examples MOC3041 Zero Crossing Optocoupler Pinout and Examples ‘© How to Use Transistor as a Switch ‘© 4N25 Phototransistor Optocoupler IC i PIC microcontroller projects, Power electronics projects ‘ntps:microcontrolesiab comizero-cossing-detectr-circul-sing-pic-microcontoler! 921 2127124, 8:55 PM. Zero Crossing Detector Circuit using Pie Mirocontroller ‘Company Parnes Subscribe to Blog via Email Enter yout NFIPSEUFES to subscribe to this blog and receive notifications of new posts by email Email Address SUBSCRIBE 33 thoughts on “Zero Crossing Detector Circuit using Pic Microcontroller” RAHUL ‘August 9, 2015 at 10:51 am. this post is very useful for mei expect more from you . thank you @® Reply Bilal Malik October 14, 2015 at 1:16 pm you are welcome. Keep visiting our blog for more useful information Reply ‘ntps:Imicrocontrolesiab comizero-cossing-detectr-circl-sing-pic-microcontoler! 0121 2127124, 8:55 PM. Zero Crossing Detector Circuit using Pie Mirocontroller What is the difference between a ZCD realised using an Op-amp and a ZCD realised using a microcontroller? If we can create a microcontroller based ZCD why are Op-amp ones still in use? Reply Bilal Malik October 14, 2015 at 1:15 pm Advertisement Using microcontroller you can use it for many other function which requires for power electronics circuits like firing angle control circuit. But you can also use op amp for same function. Microcontroller reduces required circultry for designing any circuit Reply Magnoum March 4, 2016 at 11:55 pm thank you for sharing this project , please tell me how can i measure and display phase angle between 2 sinusoides Reply BILAL Malik March 5, 2016 at 1:02 am use timers between consecutive zero crossings Reply A May 14, 2016 at 7:13 pm ‘ntps:Imicrocontrolesiab comizero-cossing-detectr-circl-sing-pic-microcontoler! san 2127124, 8:55 PM Zero Crossing Detector Circuit using Pie Microcontroller Reply Shyama Sravani July 12, 2016 at 11:39 am Hi Thankatbvegtisemnsfotmation...Can you please tell me whether this zero crossing circuit can be applied to ‘STMS Discovery micro controller also, If no can you please suggest for this zero crossing with STM&S Discovery micro controller. Reply ramana July 30, 2016 at 12:45 am yes it can be applied to stm8.Same principle Realy andi cooper ‘August 21, 2016 at 6:46 am Helpful discussion ~ | loved the specifics - Does someone know where | might be able to acquire a blank a form copy to edit? Reply Meng Kimsros ‘August 25, 2016 at 3:03 pm ‘ntps:Imicrocontrolesiab comizero-cossing-detectr-circl-sing-pic-microcontoler! rat 2127124, 8:55 PM Zero Crossing Detector Circuit using Pie Microcontroller | see a project that is a circuit for control temperature and it also use zero cross. But i do not know why we use zero cross and what the zero cross processing in it. Could you explain me, please? Reply suraj February 2, 2017 at 2:01 pm Advertisement Sir,i want code for zct in MPLab compiler plz Reply Arshad April 6, 2017 at 5:44 pm How to measure time at the output of Zero cross detector to find out frequency of voltage signal because £©1/2T so if we find out the time between zero crossing we can calculate frequency Reply David April 16, 2017 at 11:36 pm What is if on the output of the Bridge Reticifier is a offset and the NPN doesnt switch anymore? Reply Sanjay ‘August 31, 2017 at 10:56 pm ‘ntps:Imicrocontrolesiab comizero-cossing-detectr-circl-sing-pic-microcontoler! 19121 2127124, 8:55 PM Zero Crossing Detector Circuit using Pie Microcontroller Bilal Malik ‘August 31, 2017 at 11:29 pm contact me at [email protected] if you want to avail paid services Reply Advertisement Mohit Mathur November 17, 2017 at 12:38 am Why npn transistor is giving pulses on zero crossing here? Shouldn't it be always on because there is always positive voltage across base-emitter junction? Please explain. Reply Nureign July 26, 2018 at 6:07 pm wow this is wonderfull, i really benefit frm this, can you please answer this questions * how do we now if the crossing is from negative to positive or opposite, and from my multimeter the emitter -collector voltage which is what i consider as the interrupt value is always giving me 4.04mV when, isent in 220Vac Reply Mohit Mathur November 17, 2017 at 12:45 am | got previous one but, how will we determine whether the zero crossing is negative to positive transition of positive to negative transition of voltage? ‘ntps:Imicrocontrolesiab comizero-cossing-detectr-circl-sing-pic-microcontoler! aie 2127124, 8:55 PM. Zero Crossing Detector Circuit using Pie Mirocontroller selnet November 24, 2017 at 11:42 pm Hi Would you please give me any idea about measuring the sinewave amplitude using this zerocrossing metod :Thanks in advance Realy Advertisement Ashwitha March 15, 2018 at 11:05 pm Sir help me write an arm microcontroler program to find zero crossing in sine wave and display number of zero crossing upon occurance of an interrupt, Reply BIZUMUREMY! Jean claude August 14, 2019 at 10:23 pm can you modify if for three phase load control Reply Madiha March 4, 2020 at 9:56 am lam using stm32f4 series , how we can detect the zero crossings of multilevel inverter using only the microcontroller without any kind of additional circuit using kell vision for programming. Reply a ‘ntps:Imicrocontrolesiab comizero-cossing-detectr-circl-sing-pic-microcontoler! 16121 2127124, 8:55 PM Zero Crossing Detector Circuit using Pie Microcontroller Microcontrollers Lab March 14, 2020 at 1:17 pm Hi Which type of signal you are using? AC high volt? Reply Advertisement Madiha March 14, 2020 at 2:05 pm 220 volts ac supply .. actually | have to parallel the five level inverters...for which | need zero crossing detection Reply Microcontrollers Lab March 14, 2020 at 2:12 pm You have to use external components. You can give high voltage to a microcontroller directly. Use a step down transformer to convert 220-12 volts. Then use a voltage divider to further step down to less than 5 volts. After that convert negative cycle into postivie cycle using a bridge rectifier or op-amp ( by increasing dc level of AC) Then you can use this circuit. Reply Madiha March 14, 2020 at 2:19 pm Can we do that by programming on keil 2? Like | am usnig strn32f407 Reply ‘ntps:Imicrocontrolesiab comizero-cossing-detectr-circl-sing-pic-microcontoler! 1621 2127124, 8:55 PM Zero Crossing Detector Circuit using Pie Microcontroller Microcontrollers Lab March 14, 2020 at 2:30 pm Yes you can do that Reply Advertisement Amr April 20, 2020 at 11:08 am How to differentiate between positive to negative and negative to positive because it will be very important a my three phase firing circuit Reply Benjamin May 15, 2020 at 3:42 am Itis very useful information blog. Thank you for your sharing, Reply Harshal Sambhaji Wagaj September 1, 2020 at 10:18 pm. How we can find out zero crossing detector using comparator Reply ‘ntps:Imicrocontrolesiab comizero-cossing-detectr-circl-sing-pic-microcontoler! aie 2127124, 8:55 PM. Hello Folks, Iwant to make program for ZCD using Atmega‘6, my aim is to make dimmable light without using PWM, Can anyone help me? What should | do? | have written sample program of ON and OFF which Ihave shown below. ii#ifndet F_CPU #define F_CPU 16000000UL Itendif include #include inelydvertisement void init_ports0) € DDRB=0x08; /* Make PORTB as output PORT*/ PORTB=0x08; /* Write the value on PORTS*/ y void init_interrupts) { li), Disable global interrupt GICR=(1<

You might also like