Compatible detection circuit and zero-crossing detection, gate detection and power-off memory detection methods thereof
By designing a compatible detection circuit and using the high and low level signals of the diode switch module and the optocoupler detection module, the functions of zero-crossing detection, door detection and power-off memory detection in dishwashers and steaming and baking machines are realized, solving the problem of MCU The problem of excessive AD port resource usage saves components and PCB space.
Patent Information
- Application Number
- CN202011183341.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-29
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2040-10-29
AI Technical Summary
Existing dishwasher and all-in-one steamer and oven controllers need to separate two circuits when performing zero detection and door detection, resulting in excessive occupation of the MCU's AD port resources, increasing the number and cost of components, and occupying the PCB layout. space.
Design a compatible detection circuit. Through the diode switch module and the optocoupler detection module, the optocoupler detection module is used to output high and low levels to the control module, and the pulse waveform is obtained for zero-crossing detection, gate detection and power-down memory detection. It only occupies The AD port resources of an MCU enable three types of detection to be performed simultaneously.
It saves components, reduces costs, and reduces the occupation of PCB layout space. It also realizes the functions of zero-crossing detection, gate detection, and power-off memory detection.
Smart Images

Figure CN112595951B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of ground line detection, and in particular relates to a compatible detection circuit and a zero-crossing detection, a gate detection and a power-off memory detection method thereof. Background Art
[0002] The dishwashers and steam oven controllers on the market use two separate circuits or two circuits for independent detection when performing zero detection and door detection. However, this detection method requires the use of the AD port resources of two MCUs, which results in the use of one more AD port resource of the MCU, which in turn leads to the increase of components, increased costs, and occupation of PCB layout space. Summary of the invention
[0003] In order to solve the above problems, the present invention provides a compatible detection circuit, which only occupies one AD port resource of the MCU and has only one circuit, and can simultaneously perform zero detection, gate detection and power-off memory detection, saving components, reducing costs and saving PCB layout space.
[0004] Another object of the present invention is to provide a zero-crossing detection method.
[0005] Another object of the present invention is to provide a door detection method.
[0006] Another object of the present invention is to provide a power-off memory detection method.
[0007] The technical solution adopted by the present invention is:
[0008] A compatibility detection circuit comprises a diode switch module, an optocoupler detection module and a control module, wherein the optocoupler detection module is electrically connected to the diode switch module and the control module, wherein the optocoupler detection module outputs high and low levels to the control module according to the opening and closing of the diode switch module, and the control module obtains a pulse waveform according to the high and low levels of the optocoupler detection module for performing zero-crossing detection, gate detection and power-off memory detection.
[0009] Preferably, the diode switch module includes a fifth diode D5, a sixth diode D6, a seventh diode D7, an eighth diode D8 and a switch K2, the anode of the fifth diode D5 is connected in parallel to the live wire and one end of the switch K2, the other end of the switch K2 is connected to the cathode of the seventh diode D7, the anode of the seventh diode D7 is connected to the anode of the eighth diode D8, the cathode of the eighth diode D8 is connected in parallel to the neutral wire and the anode of the sixth diode D6, and the cathode of the sixth diode D6 is connected to the cathode of the fifth diode D5.
[0010] Preferably, the optocoupler detection module includes a fifth resistor R5, a sixth resistor R6, a seventh resistor R7, a fifth capacitor C5, a sixth capacitor C6 and a photoelectric coupler U2, one end of the fifth resistor R5 is connected to the common connection end of the fifth diode D5 and the sixth diode D6, the other end of the fifth resistor R5 is connected in parallel to one end of the sixth resistor R6, one end of the fifth capacitor C5 and the first pin of the photoelectric coupler U2, the other end of the sixth resistor R6, the other end of the fifth capacitor C5 and the second pin of the photoelectric coupler U2 are all connected to the common connection end of the seventh diode D7 and the eighth diode D8, the fourth pin of the photoelectric coupler U2 is connected in parallel to one end of the seventh resistor R7 and one end of the sixth capacitor C6, the other end of the seventh resistor R7 is connected to the power supply, and the other end of the sixth capacitor C6 and the third pin of the photoelectric coupler U2 are both grounded.
[0011] Preferably, the seventh pin of the control module is connected to the common connection end of the seventh resistor R7 and the sixth capacitor C6, the first pin of the control module is connected to the power supply, and the sixth pin of the control module is grounded.
[0012] Another technical solution of the present invention is achieved in this way:
[0013] A zero-crossing detection method using the compatibility detection circuit comprises the following steps:
[0014] S1, the optical coupler detection module outputs high and low levels to the control module according to the opening and closing of the diode switch module;
[0015] S2, the control module obtains a pulse waveform according to the high and low levels of the optical coupler detection module;
[0016] S3. The control module determines whether a rising edge of the pulse waveform is detected. If so, it is determined to be a zero-crossing point. Otherwise, it is not a zero-crossing point.
[0017] Another technical solution of the present invention is achieved in this way:
[0018] A door detection method using the compatibility detection circuit comprises the following steps:
[0019] S1, the optical coupler detection module outputs high and low levels to the control module according to the opening and closing of the diode switch module;
[0020] S2, the control module obtains a pulse waveform according to the high and low levels of the optical coupler detection module;
[0021] S3. The control module compares the pulse width of the pulse waveform with a preset pulse width to determine the open and closed state of the door.
[0022] Preferably, S3 comprises the following steps:
[0023] S31, the control module acquires a first pulse width T1 according to an on pulse waveform of the diode switch module, and the control module acquires a second pulse width T2 according to a off pulse waveform of the diode switch module;
[0024] S32. Compare the first pulse width T1 with the preset third pulse width T3. If the first pulse width T1 is within the error range, it is judged as an open door. Compare the second pulse width T2 with the preset fourth pulse width T4. If the second pulse width T2 is within the error range, it is judged as a closed door.
[0025] Preferably, the S32 also includes: if the comparison result between the first pulse width T1 and the preset third pulse width T3 is not within the error range, no processing is performed; if the comparison result between the second pulse width T2 and the preset fourth pulse width T4 is not within the error range, no processing is performed.
[0026] Preferably, T1=T3±5mS, and T2=T4±5mS.
[0027] Another technical solution of the present invention is achieved in this way:
[0028] A power-off memory detection method using the compatibility detection circuit comprises the following steps:
[0029] S1, the optical coupler detection module outputs high and low levels to the control module according to the opening and closing of the diode switch module;
[0030] S2, the control module obtains a pulse waveform according to the high and low levels of the optical coupler detection module;
[0031] S3. The control module detects the number of pulse waveforms within a fixed period and determines whether it is greater than a preset pulse number threshold. If it is, it is determined to be in a power-on state. Otherwise, it is determined to be in a power-off state. In the power-off state, the control module saves the current state, and when the power is restored after the power is off, it continues to work in the power-off state.
[0032] Compared with the prior art, the compatibility detection circuit of the present invention outputs high and low levels to the control module according to the opening and closing of the diode switch module through the optical coupling detection module. The control module obtains a pulse waveform according to the high and low levels of the optical coupling detection module for performing zero-crossing detection, gate detection and power-off memory detection, thereby occupying only one AD port resource of the MCU. With only one circuit, zero detection, gate detection and power-off memory detection can be performed simultaneously, saving components, reducing costs, and saving PCB layout space. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 is a circuit diagram of a compatibility detection circuit provided in Embodiment 1 of the present invention;
[0034] Figure 2 is a pulse waveform diagram of a compatibility detection circuit provided in Example 1 of the present invention;
[0035] Figure 3 is a flow chart of a zero-crossing detection method provided by Embodiment 2 of the present invention;
[0036] Figure 4 is a flow chart of a door detection method provided by Embodiment 3 of the present invention;
[0037] Figure 5 This is a flow chart of a power-off memory detection method provided in Example 4 of the present invention.
[0038] Description of Reference Numerals
[0039] 1-Diode switch module, 2-Optical coupler detection module, 3-Control module. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0041] Example 1
[0042] Embodiment 1 of the present invention provides a compatibility detection circuit, such as Figure 1-2 As shown, it includes a diode switch module 1, an optocoupler detection module 2 and a control module 3. The optocoupler detection module 2 is electrically connected to the diode switch module 1 and the control module 3. The optocoupler detection module 2 outputs high and low levels to the control module 3 according to the opening and closing of the diode switch module 1. The control module 3 obtains a pulse waveform according to the high and low levels of the optocoupler detection module 2 for zero-crossing detection, gate detection and power-off memory detection.
[0043] In this way, the optocoupler detection module 2 outputs high and low levels to the control module 3 according to the opening and closing of the diode switch module 1. The control module 3 obtains a pulse waveform according to the high and low levels of the optocoupler detection module 2 for zero-crossing detection, gate detection and power-off memory detection, thereby occupying only one AD port resource of the MCU. With only one circuit, zero detection, gate detection and power-off memory detection can be performed simultaneously, saving components, reducing costs, and saving PCB layout space.
[0044] The diode switch module 1 includes a fifth diode D5, a sixth diode D6, a seventh diode D7, an eighth diode D8 and a switch K2, the anode of the fifth diode D5 is connected in parallel to the live wire and one end of the switch K2, the other end of the switch K2 is connected to the cathode of the seventh diode D7, the anode of the seventh diode D7 is connected to the anode of the eighth diode D8, the cathode of the eighth diode D8 is connected in parallel to the neutral wire and the anode of the sixth diode D6, and the cathode of the sixth diode D6 is connected to the cathode of the fifth diode D5.
[0045] In this way, by opening and closing the switch K2, the live wire ACL can form different loops, and then the photocoupler U2 is turned on or off to form a high or low level, so that the control module 3 can perform zero-crossing detection, gate detection and power-off memory detection.
[0046] The optocoupler detection module 2 includes a fifth resistor R5, a sixth resistor R6, a seventh resistor R7, a fifth capacitor C5, a sixth capacitor C6 and a photoelectric coupler U2, one end of the fifth resistor R5 is connected to the common connection end of the fifth diode D5 and the sixth diode D6, the other end of the fifth resistor R5 is connected in parallel to one end of the sixth resistor R6, one end of the fifth capacitor C5 and the first pin of the photoelectric coupler U2, the other end of the sixth resistor R6, the other end of the fifth capacitor C5 and the second pin of the photoelectric coupler U2 are all connected to the common connection end of the seventh diode D7 and the eighth diode D8, the fourth pin of the photoelectric coupler U2 is connected in parallel to one end of the seventh resistor R7 and one end of the sixth capacitor C6, the other end of the seventh resistor R7 is connected to the power supply, and the other end of the sixth capacitor C6 and the third pin of the photoelectric coupler U2 are both grounded.
[0047] In this way, when the switch K2 is disconnected (i.e., the gate is open), the positive half cycle of the mains electricity forms a loop through the fifth diode D5, the fifth resistor R5, the photocoupler U2 and the eighth diode D8, the photocoupler U2 is turned on, and the ZERO / gate detection (signal signal) outputs a low level 0V, and the rising and falling edges of the positive half cycle will appear near the zero crossing as the falling edge and rising edge of the pulse; when the negative half cycle of the mains electricity does not form a loop through the sixth diode D6, the fifth resistor R5, the photocoupler U2 and the seventh diode D7 and the switch K2, the photocoupler U2 is not turned on, and the ZERO / gate detection (signal signal) outputs a high level VDD, at this time, the level and the rising and falling edges of the positive half cycle will appear near the zero crossing as the falling edge and rising edge of the pulse to form a pulse width T1. Figure 2 As shown, it is the positive half cycle waveform when the door is opened and the detected pulse waveform.
[0048] When the switch K2 is closed (i.e., the door is closed), the positive half cycle of the mains electricity forms a loop through the fifth diode D5, the fifth resistor R5, the photocoupler U2 and the eighth diode D8, the photocoupler U2 is turned on, and the ZERO / gate detection (signal signal) outputs a low level of 0V; when the negative half cycle of the mains electricity is reversed, it forms a loop through the sixth diode D6, the fifth resistor R5, the photocoupler U2, the seventh diode D7 and the switch K2, the photocoupler U2 is turned on, and the ZERO / gate detection (signal signal) outputs a low level of 0V, and the rising edge of the positive half cycle and the falling edge of the negative half cycle will have a pulse width T2 near the zero crossing, such as Figure 2 As shown, the positive half-cycle and negative half-cycle flip waveforms and the detected pulse waveforms when the door is closed.
[0049] The seventh pin of the control module 3 is connected to the common connection end of the seventh resistor R7 and the sixth capacitor C6, the first pin of the control module 3 is connected to the power supply, and the sixth pin of the control module 3 is grounded.
[0050] In this way, the high and low level signals sent by the optical coupler detection module 2 are received through the seventh pin of the control module 3 , and the power supply is received through the first pin of the control module 3 .
[0051] The compatibility detection circuit of the present invention outputs high and low levels to the control module according to the opening and closing of the diode switch module through the optical coupling detection module, and the control module obtains a pulse waveform according to the high and low levels of the optical coupling detection module for performing zero-crossing detection, gate detection and power-off memory detection, thereby occupying only one AD port resource of the MCU, and only one circuit is required to perform zero detection, gate detection and power-off memory detection simultaneously, thereby saving components, reducing costs and saving PCB layout space.
[0052] Example 2
[0053] like Figure 3 As shown, Embodiment 2 of the present invention provides a zero-crossing detection method using the compatible detection circuit, comprising the following steps:
[0054] S1, the optical coupler detection module outputs high and low levels to the control module according to the opening and closing of the diode switch module;
[0055] S2, the control module obtains a pulse waveform according to the high and low levels of the optical coupler detection module;
[0056] S3. The control module determines whether a rising edge of the pulse waveform is detected. If so, it is determined to be a zero-crossing point. Otherwise, it is not a zero-crossing point.
[0057] Thus, zero-crossing detection: Figure 2It can be seen that there are pulse rising edges for opening and closing the door. When the MCU detects the pulse rising through the IO port, it is judged as zero crossing. The MCU can control the contactor and relay coil within T2 time to ensure that the contacts are opened or closed when the AC zero current is minimum, thereby suppressing the generation of arcs, playing a good protective role, and extending the life of the contacts.
[0058] Example 3
[0059] like Figure 4 As shown, Embodiment 3 of the present invention provides a door detection method using the compatibility detection circuit, comprising the following steps:
[0060] S1, the optical coupler detection module outputs high and low levels to the control module according to the opening and closing of the diode switch module;
[0061] S2, the control module obtains a pulse waveform according to the high and low levels of the optical coupler detection module;
[0062] S3. The control module compares the pulse width of the pulse waveform with a preset pulse width to determine the open and closed state of the door.
[0063] The S3 comprises the following steps:
[0064] S31, the control module acquires a first pulse width T1 according to an on pulse waveform of the diode switch module, and the control module acquires a second pulse width T2 according to a off pulse waveform of the diode switch module;
[0065] S32, comparing the first pulse width T1 with the preset third pulse width T3, if the first pulse width T1 is within the error range, it is determined to be an open door, comparing the second pulse width T2 with the preset fourth pulse width T4, if the second pulse width T2 is within the error range, it is determined to be a closed door. If the comparison result of the first pulse width T1 with the preset third pulse width T3 is not within the error range, no processing is performed, and if the comparison result of the second pulse width T2 with the preset fourth pulse width T4 is not within the error range, no processing is performed.
[0066] In this way, the door detection software determines: the control module MCU sets the door opening pulse width threshold T3 and the door closing pulse width threshold T4; the control module MCU timer reads the door opening pulse width T1 and the door closing pulse width T2 through the IO port, and compares them with the set thresholds T3 and T4: when T1 = T3 ± 5mS, it is open; when T2 = T4 ± 5mS, it is closed. Thus, the door opening and closing states are determined.
[0067] Example 4
[0068] like Figure 5 As shown, Embodiment 4 of the present invention provides a power-off memory detection method using the compatibility detection circuit, comprising the following steps:
[0069] S1, the optical coupler detection module outputs high and low levels to the control module according to the opening and closing of the diode switch module;
[0070] S2, the control module obtains a pulse waveform according to the high and low levels of the optical coupler detection module;
[0071] S3. The control module detects the number of pulse waveforms within a fixed period and determines whether it is greater than a preset pulse number threshold. If it is, it is determined to be in a power-on state. Otherwise, it is determined to be in a power-off state. In the power-off state, the control module saves the current state, and when the power is restored after the power is off, it continues to work in the power-off state.
[0072] In this way, the power-off memory judgment: Figure 2 It can be seen that within a certain period T0, the number of pulses for opening the door is less than the number of pulses for closing the door, and the pulse width for opening the door is wider than the pulse width for closing the door. The control module MCU sets the pulse number threshold N (for example, 3). When the number of pulses read by the MCU within T0 is greater than the threshold N (for example, 3), there is power; otherwise, there is power failure. In the case of power failure, the MCU saves the current data or status to the EEP ROM. When the power is restored after the power failure, it can continue to work in the state when the power was off.
[0073] The zero-crossing detection method, the gate detection method and the power-off memory detection method of the present invention output high and low levels to the control module according to the opening and closing of the diode switch module through the optical coupling detection module, and the control module obtains a pulse waveform according to the high and low levels of the optical coupling detection module for performing zero-crossing detection, gate detection and power-off memory detection, thereby occupying only one AD port resource of the MCU, and only one circuit is required to perform zero detection, gate detection and power-off memory detection simultaneously, thereby saving components, reducing costs and saving PCB layout space.
[0074] The above is only a preferred specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A compatibility detection circuit, characterized in that: It includes a diode switch module, an optical coupler detection module and a control module, wherein the optical coupler detection module is electrically connected to the diode switch module and the control module, wherein the optical coupler detection module outputs high and low levels to the control module according to the opening and closing of the diode switch module, and the control module obtains a pulse waveform according to the high and low levels of the optical coupler detection module for performing zero-crossing detection, gate detection and power-off memory detection; The diode switch module includes a fifth diode D5, a sixth diode D6, a seventh diode D7, an eighth diode D8 and a switch K2, the anode of the fifth diode D5 is connected in parallel to the live wire and one end of the switch K2, the other end of the switch K2 is connected to the cathode of the seventh diode D7, the anode of the seventh diode D7 is connected to the anode of the eighth diode D8, the cathode of the eighth diode D8 is connected in parallel to the neutral wire and the anode of the sixth diode D6, and the cathode of the sixth diode D6 is connected to the cathode of the fifth diode D5.
2. The compatibility detection circuit according to claim 1, characterized in that: The optocoupler detection module includes a fifth resistor R5, a sixth resistor R6, a seventh resistor R7, a fifth capacitor C5, a sixth capacitor C6 and a photoelectric coupler U2, one end of the fifth resistor R5 is connected to the common connection end of the fifth diode D5 and the sixth diode D6, the other end of the fifth resistor R5 is connected in parallel to one end of the sixth resistor R6, one end of the fifth capacitor C5 and the first pin of the photoelectric coupler U2, the other end of the sixth resistor R6, the other end of the fifth capacitor C5 and the second pin of the photoelectric coupler U2 are all connected to the common connection end of the seventh diode D7 and the eighth diode D8, the fourth pin of the photoelectric coupler U2 is connected in parallel to one end of the seventh resistor R7 and one end of the sixth capacitor C6, the other end of the seventh resistor R7 is connected to the power supply, and the other end of the sixth capacitor C6 and the third pin of the photoelectric coupler U2 are both grounded.
3. The compatibility detection circuit according to claim 2, characterized in that: The seventh pin of the control module is connected to the common connection end of the seventh resistor R7 and the sixth capacitor C6, the first pin of the control module is connected to the power supply, and the sixth pin of the control module is grounded.
4. A zero-crossing detection method using the compatibility detection circuit according to any one of claims 1 to 3, characterized in that: The steps include: S1, the optical coupler detection module outputs high and low levels to the control module according to the opening and closing of the diode switch module; S2, the control module obtains a pulse waveform according to the high and low levels of the optical coupler detection module; S3. The control module determines whether a rising edge of the pulse waveform is detected. If so, it is determined to be a zero-crossing point. Otherwise, it is not a zero-crossing point.
5. A door detection method using the compatibility detection circuit according to any one of claims 1 to 3, characterized in that: The steps include: S1, the optical coupler detection module outputs high and low levels to the control module according to the opening and closing of the diode switch module; S2, the control module obtains a pulse waveform according to the high and low levels of the optical coupler detection module; S3. The control module compares the pulse width of the pulse waveform with a preset pulse width to determine the open and closed state of the door.
6. The door detection method according to claim 5, characterized in that: The S3 comprises the following steps: S31, the control module acquires a first pulse width T1 according to an on pulse waveform of the diode switch module, and the control module acquires a second pulse width T2 according to a off pulse waveform of the diode switch module; S32. Compare the first pulse width T1 with the preset third pulse width T3. If the first pulse width T1 is within the error range, it is judged as an open door. Compare the second pulse width T2 with the preset fourth pulse width T4. If the second pulse width T2 is within the error range, it is judged as a closed door.
7. The door detection method according to claim 6, characterized in that: The S32 also includes: if the comparison result between the first pulse width T1 and the preset third pulse width T3 is not within the error range, no processing is performed; if the comparison result between the second pulse width T2 and the preset fourth pulse width T4 is not within the error range, no processing is performed.
8. The door detection method according to claim 6 or 7, characterized in that: The T1=T3±5mS, the T2=T4±5mS.
9. A power-off memory detection method using the compatibility detection circuit according to any one of claims 1 to 3, characterized in that: The steps include: S1, the optical coupler detection module outputs high and low levels to the control module according to the opening and closing of the diode switch module; S2, the control module obtains a pulse waveform according to the high and low levels of the optical coupler detection module; S3. The control module detects the number of pulse waveforms within a fixed period and determines whether it is greater than a preset pulse number threshold. If it is, it is determined to be in a power-on state. Otherwise, it is determined to be in a power-off state. In the power-off state, the control module saves the current state, and when the power is restored after the power is off, it continues to work in the power-off state.
