A switch detection circuit, method and intelligent lighting fixture
By designing a detection circuit for identifying ordinary switches and new switches, using processors and ULP coprocessors to detect level signals, the problem that ordinary switches cannot be remotely/intelligently controlled is solved, and accurate detection of switch types and support for IoT functions of new switches are achieved.
Patent Information
- Application Number
- CN202111480782.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-06
- Publication Date
- 2025-06-20
- Estimated Expiration
- 2041-12-06
AI Technical Summary
Existing ordinary switches cannot be remotely/intelligently controlled after being turned off, and there is a lack of circuits to identify ordinary switches and new switches, which affects the implementation of IoT functions of new switches.
A switch detection circuit is designed to distinguish between ordinary switches and new switches by connecting rectifier bridges, voltage divider resistor groups, voltage regulator diodes and signal lines.
Accurate detection of switch types is achieved, CPU resource occupancy and power consumption is reduced, detection efficiency is improved, and the Internet of Things functions of new switches are supported.
Smart Images

Figure CN114167275B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of intelligent lamp switch detection, and particularly relates to a switch detection circuit, method and intelligent lamp. Background Art
[0002] At present, in the off state of the wall switch (ordinary switch) on the market, the intelligent lamp is not powered on, which cannot meet the requirements of remote control / intelligent control. In order to overcome the defect that the ordinary switch cannot be remotely / intelligently controlled after being turned off, our company has developed a new type of switch specially designed for intelligent lamps. This new type of switch does not lose power and will not have the problem of being unable to be remotely / intelligently controlled after being turned off. Moreover, the new type of switch also has an Internet of Things function. However, at present, there is a lack of a circuit for identifying ordinary switches and new type switches, and it is not clear whether the Internet of Things function of the new type switch can be realized. Summary of the Invention
[0003] In view of this, the present invention aims to provide a switch detection circuit, method and intelligent lamp to provide a detection circuit for identifying whether the switch in the circuit is a new type switch or an ordinary switch.
[0004] To achieve the above object, the technical solution of the present invention is realized as follows:
[0005] In a first aspect, the present invention provides a switch detection circuit, which is arranged on the AC circuit controlled by the switch to be measured;
[0006] One end of the detection circuit is connected to the positive extreme of the rectifier bridge, and the other end is connected to the negative extreme of the rectifier bridge. It includes a first voltage-dividing resistor group and a voltage-regulator diode Z1 connected in sequence. The voltage-regulator diode Z1 is connected in parallel with a second voltage-dividing resistor group, and the second voltage-dividing resistor group includes more than two resistors;
[0007] The second voltage-dividing resistor group is connected to a signal line, and the signal line is connected to a processor.
[0008] Further, the anode terminal of the voltage-regulator diode is connected to the negative extreme of the rectifier bridge, and the negative extreme of the rectifier bridge is grounded.
[0009] Further, the first voltage-dividing resistor group includes a resistor R1 and a resistor R2 connected in series.
[0010] Further, the second voltage-dividing resistor group includes a resistor R3 and a resistor R4 connected in series, where one end of the resistor R4 is connected to the resistor R3, and the other end is connected to the negative terminal of the rectifier bridge;
[0011] The signal input terminal of the signal line is connected to the circuit between the resistor R3 and the resistor R4.
[0012] Further, a filter capacitor C1 is also connected in parallel with the resistor R4.
[0013] Further, the switch detection circuit is also connected to an LED driving circuit. A partition LED is provided on the circuit connected to the LED driving circuit. The anodic end of the partition LED is connected to the positive end of the rectifier bridge, the cathodic end is connected to a partition electrolytic capacitor, and the other end of the partition electrolytic capacitor is connected to the LED driving circuit.
[0014] In a second aspect, the present invention provides a detection method based on the switch detection circuit described in the first aspect above. The processor includes a ULP co-processor and a CPU connected thereto, and the method includes the following steps:
[0015] 1. The ULP co-processor initializes the pin settings and writes this pin to the 16-bit general register of the ULP co-processor.
[0016] 2. Write the default current pin state to the 16-bit general register of the ULP co-processor.
[0017] 3. Compare the current state of the pin with the value stored in the register last time. If they are equal, increment the flag bit by one. If they are not equal, continue to run.
[0018] 4. If the flag bit is greater than a fixed value and the current state of the pin is different from the stored state, restore the initialization value of the ULP co-processor and send the information to the CPU. After receiving the signal, the CPU makes corresponding processing according to the application scenario.
[0019] In a third aspect, the present invention provides an intelligent lamp, which has a switch detection circuit, and the switch detection circuit adopts the detection circuit described in the first aspect above.
[0020] Compared with the prior art, the switch detection circuit, method and intelligent lamp of the present invention have the following advantages:
[0021] (1) The switch detection circuit of the present invention has a simple structure, low cost, reliable performance, and can effectively and accurately detect the type of switch.
[0022] (2) The switch detection method of the present invention reduces the occupancy of CPU resources, has low power consumption, and high detection efficiency. Description of the Drawings
[0023] The drawings constituting a part of the present invention are used to provide a further understanding of the present invention. The schematic embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation to the present invention. In the drawings:
[0024] Figure 1It is a block diagram of the principle of the switch detection circuit according to the embodiment of the present invention;
[0025] Figure 2 It is a circuit diagram of the switch detection circuit according to the embodiment of the present invention;
[0026] Figure 3 It is a logic block diagram of the detection method according to the embodiment of the present invention;
[0027] Figure 4 It is a waveform diagram of the level signal of the ordinary switch according to the embodiment of the present invention;
[0028] Figure 5 It is a waveform diagram of the level signal of the new switch according to the embodiment of the present invention. Specific embodiments
[0029] It should be noted that, without conflict, the embodiments in the present invention and the features in the embodiments can be combined with each other.
[0030] In the description of the present invention, it should be understood that the orientation or positional relationship indicated by the terms "center", "longitudinal", "transverse", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc. is based on the orientation or positional relationship shown in the drawings, and is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and thus should not be construed as a limitation to the present invention. In addition, the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, the features defined with "first", "second", etc. may explicitly or implicitly include one or more of such features. In the description of the present invention, unless otherwise specified, the meaning of "plurality" is two or more.
[0031] In the description of the present invention, it should be noted that, unless otherwise clearly defined and limited, the terms "installed", "connected", "connected" should be understood in a broad sense. For example, it may be a fixed connection, a detachable connection, or an integral connection; it may be a mechanical connection or an electrical connection; it may be directly connected or indirectly connected through an intermediate medium, and it may be the communication inside two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood through specific situations.
[0032] The present invention will be described in detail below with reference to the drawings and in combination with the embodiments.
[0033] Embodiment 1:
[0034] As Figure 1 、 Figure 2 shown, this embodiment provides a switch detection circuit, which is arranged on the AC circuit controlled by the switch to be measured;
[0035] One end of this detection circuit is connected to the positive terminal of the rectifier bridge, and the other end is connected to the negative terminal of the rectifier bridge. It includes a first voltage dividing resistor group and a voltage stabilizing diode Z1 connected in sequence. The voltage stabilizing diode Z1 is connected in parallel with a second voltage dividing resistor group, and the second voltage dividing resistor group includes more than two resistors;
[0036] The second voltage dividing resistor group is connected to a signal line, the signal line is connected to a processor, the processor is connected to a wireless communication module to achieve intelligent / remote control, and the wireless communication module uses but is not limited to a WiFi module.
[0037] Among them, the processor can use an independent CPU, or a combined processor as described in the following solution, that is, an ulp co-processor + CPU combined processor.
[0038] The anode end of the voltage stabilizing diode is connected to the negative terminal of the rectifier bridge, and the negative terminal of the rectifier bridge is grounded.
[0039] The first voltage dividing resistor group includes a resistor R1 and a resistor R2 connected in series.
[0040] The second voltage dividing resistor group includes a resistor R3 and a resistor R4 connected in series. One end of the resistor R4 is connected to the resistor R3, and the other end is connected to the negative electrode of the rectifier bridge;
[0041] The signal input end of the signal line is connected to the circuit between the resistor R3 and the resistor R4.
[0042] The resistor R4 is also connected in parallel with a filter capacitor C1.
[0043] This switch detection circuit is also connected to an LED driving circuit. There is a blocking LED on the circuit connected to the LED driving circuit. The anode end of the blocking LED is connected to the positive terminal of the rectifier bridge, the cathode end is connected to the blocking electrolytic capacitor, and the other end of the blocking electrolytic capacitor is connected to the LED driving circuit.
[0044] Detection principle: The output of the rectifier bridge passes through R1 and R2, is regulated by Z1, and then the WIFI module can detect the level signal of the switch through the voltage division of R3 and R4. C1 is used for filtering. D1 will use the electrolytic capacitor necessary for LED driving later. The function of D1 is to block the electrolytic capacitor so that the electrolytic capacitor will not affect the accuracy of detecting the switch.
[0045] Since the waveforms of the new switch and the ordinary switch are different, the detection circuit mainly identifies the switch type based on this point, determines whether it is the new switch of our company or the ordinary switch. If it is an ordinary switch, the relevant functions cannot be executed. If it is detected that the switch applied in this AC circuit is the switch of our company, the processor can remotely / intelligently control the new switch to execute relevant actions according to the relevant instructions of the user or the intelligent control system, thereby realizing the corresponding functions.
[0046] It should be noted that the detection method used by the switch detection circuit of this application during detection can be implemented using existing programs. The processor only needs to analyze the level signals to achieve this. The level signals of ordinary switches and new switches are as Figure 4 , Figure 5 shown. As shown in the figure, if the time interval is greater than 500 ms, it is an ordinary switch. If the time interval is between 10 ms and 100 ms, it is a new switch. The detection method in Embodiment 2 can also be used. The processor of this method is a combination processor of ulp co-processor + CPU, with lower energy consumption and reduced CPU occupancy rate. Combined with the detection method, the detection efficiency and accuracy are higher.
[0047] Embodiment 2:
[0048] This embodiment proposes a detection method based on the switch detection circuit described in the above first aspect (as Figure 3 shown), including the following steps:
[0049] 1. Initialize the pin settings of the ulp co-processor and write this pin into the 16-bit general register of the ulp co-processor;
[0050] 2. Write the default current pin state into the 16-bit general register of the ulp co-processor;
[0051] 3. Compare the current state of the pin with the value stored in the register last time. If they are equal, increment the flag bit by one. If they are not equal, continue to run;
[0052] 4. If the flag bit is greater than a fixed value (filtering voltage fluctuations, AC signals) and the current state of the pin is different from the stored state, restore the initialization value of the ulp co-processor, and send an interrupt message to the cpu (if the cpu is in the deep sleep state, it needs to wake up the cpu first and then send the interrupt). After receiving the signal, the cpu makes corresponding processing according to the application scenario.
[0053] During detection, it is necessary to continuously perform the switch action on the switch to be tested three times. When the switch to be tested is closed, the electrolytic capacitor supplies power to the circuit. The ulp of this application wakes up once every 1s, and the cpu is in the sleep state (while reducing the CPU occupancy rate, this combined processor also effectively reduces power consumption). After the ulp coprocessor detects the switch level signal, it wakes up the cpu and sends an interrupt. After receiving the interrupt signal, the cpu records the time. After receiving the next interrupt signal, the cpu records the time again. By judging the time interval between the two interrupts, it is determined what type of switch this is. As shown in the figure, if the time interval is greater than 500ms, it is a normal switch; if the time interval is between 10ms and 100ms, it is a new type of switch. This application reduces the occupancy of mcu resources and has low power consumption. The waveform diagrams of the normal switch and the new type of switch are as Figure 4 , Figure 5 shown.
[0054] Embodiment 3:
[0055] The present invention provides an intelligent lamp. Other technologies of the lamp can adopt the existing technologies. Among them, the intelligent lamp has a switch detection circuit, and the switch detection circuit adopts the detection circuit and detection method described in any one of the above embodiments. The structure of the intelligent lamp can be realized by using the existing technologies, which will not be elaborated here.
[0056] The above are only the preferred embodiments of the present invention, and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A detection circuit based on a switch detection circuit, characterized in that, The detection circuit is serially arranged with the switch to be measured; One end of the detection circuit is connected to the positive terminal of the rectifier bridge, and the other end is connected to the negative terminal of the rectifier bridge. The detection circuit includes a first voltage-dividing resistor group and a voltage-stabilizing diode Z1 connected in sequence. The voltage-stabilizing diode Z1 is connected in parallel with a second voltage-dividing resistor group, and the second voltage-dividing resistor group includes more than two resistors; The second voltage-dividing resistor group is connected to a signal line, and the signal line is connected to a processor; The processor includes an ulp co-processor and a cpu connected thereto. The detection method executed according to the detection circuit includes the following steps: S1. The ulp co-processor initializes the pin settings and writes this pin into the general register of the ulp co-processor; S2. Write the default current pin state into the general register of the ulp co-processor; S3. Compare the current state of the pin with the value stored in the register last time. If they are equal, increment the flag bit by one. If they are not equal, continue to run; S4. If the flag bit is greater than a fixed value and the current state of the pin is different from the stored state, restore the initialization value of the ulp co-processor and send the information to the cpu. After receiving the signal, the cpu makes corresponding processing according to the application scenario; When the switch to be measured is closed, the circuit is powered by an electrolytic capacitor, the cpu is in the sleep state. After the ulp co-processor detects the switch level signal, it wakes up the cpu and sends an interrupt. After receiving the interrupt signal, the cpu records the time. After receiving the next interrupt signal, the cpu records the time. The switch type is judged by judging the time interval between the two interrupts.
2. The detection circuit according to claim 1, characterized in that: The positive terminal of the voltage-stabilizing diode is connected to the negative terminal of the rectifier bridge, and the negative terminal of the rectifier bridge is grounded.
3. The detection circuit according to claim 1, characterized in that: The first voltage-dividing resistor group includes a resistor R1 and a resistor R2 connected in series; 4. The detection circuit according to claim 1, characterized in that: The second voltage-dividing resistor group includes a resistor R3 and a resistor R4 connected in series. One end of the resistor R4 is connected to the resistor R3, and the other end is connected to the negative electrode of the rectifier bridge; The signal input end of the signal line is connected to the circuit between the resistor R3 and the resistor R4; 5. The detection circuit according to claim 4, characterized in that: A filter capacitor C1 is also connected in parallel with the resistor R4; 6. The detection circuit according to claim 1, characterized in that: The switch detection circuit is also connected to an LED driving circuit. A partition LED is provided on the circuit connected to the LED driving circuit. The positive terminal of the partition LED is connected to the positive terminal of the rectifier bridge, the negative terminal is connected to a partition electrolytic capacitor, and the other end of the partition electrolytic capacitor is connected to the LED driving circuit; 7. An intelligent lamp, characterized in that: The intelligent lamp has a switch detection circuit, and the switch detection circuit adopts the detection circuit according to any one of claims 1-6.
Citation Information
Patent Citations
A built-in relay state detection circuit
CN105021979A
Switch detection circuit and intelligent lamp
CN216792385U