A key detection circuit and an electronic device
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Utility models(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-11
- Publication Date
- 2026-08-11
AI Technical Summary
[0019]本申请实施例提供的按键检测电路中,应用于装配机械轴或光轴的按键结构。一对连接点,第一端与电源连接,第二端接地。连接点在按键结构装配机械轴且机械轴处于下压状态的情况下导通,否则断开。光导通组件,包括发光器件与光敏开关;发光器件,第一端与所述连接点的第一端连接,第二端接地光敏开关,第一端与所述电源连接,第二端接地。
Smart Images

Figure CN224624734U_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of button detection technology, specifically relating to a button detection circuit and electronic device. Background Technology
[0002] Keyboards, as a common input device, are mainly divided into two categories based on their key triggering principles: mechanical switch keyboards and optical switch keyboards.
[0003] A mechanical switch keyboard has mechanical switches installed inside the keys. When the user presses a key, an electrical signal is transmitted to the circuit board, enabling the key to function.
[0004] An optical axis keyboard has an optical axis inside each key and a light-conducting component consisting of a light-emitting device and a photosensitive switch. When a user presses a key, the optical axis blocks the light path between the light-emitting device and the photosensitive switch. The photosensitive element detects the change in light signal, converts it into an electrical signal, and transmits it to the circuit board to complete the key press.
[0005] With the rapid development of the electronics industry, users are increasingly demanding greater compatibility and flexibility from keyboards. For example, users want to be able to choose between mechanical or optical switches for individual keys on the same keyboard, depending on their needs. Traditional solutions require separate key detection circuits for mechanical and optical switches, which leads to complex circuit board structures.
[0006] Therefore, there is an urgent need for a key detection circuit that can be compatible with both mechanical and optical axes, simplifying the circuit structure and reducing design costs. Utility Model Content
[0007] To overcome the aforementioned technical deficiencies, this application provides a key detection circuit and an electronic device, aiming to solve the above problems.
[0008] To solve the above-mentioned technical problems, this application adopts the following technical solution:
[0009] According to one aspect of the embodiments of this application, a key detection circuit is provided, applied to a key structure equipped with a mechanical axis or an optical axis. The key detection circuit includes: a pair of connection points, the first end of which is connected to a power supply and the second end of which is grounded; a light-conducting component, including a light-emitting device and a photosensitive switch; the light-emitting device, the first end of which is connected to the first end of the connection point and the second end of which is grounded; the photosensitive switch, the first end of which is connected to the power supply and the second end of which is grounded; the first end of the photosensitive switch is also connected to a voltage detection circuit; the voltage detection circuit is used to determine the key press status based on the voltage change at the first end of the photosensitive switch; wherein, when the key structure is equipped with a mechanical axis, the connection point is connected to the mechanical axis, and the connection point is conductive when the mechanical axis is in a depressed state, otherwise it is disconnected; the photosensitive switch is conductive when the light-emitting device is working and there is no obstruction between them; when the key structure is equipped with an optical axis and the optical axis is in a depressed state, the optical axis forms an obstruction between the light-emitting device and the photosensitive switch.
[0010] In some embodiments of this application, the button detection circuit further includes a first resistor; a first end of the first resistor is connected to a power supply, and a second end of the first resistor is connected to a first end of a connection point and a first end of a light-emitting device.
[0011] In some embodiments of this application, the voltage detection circuit includes a second resistor, a third resistor, and a controller; the first end of the second resistor is connected to a power supply, and the second end of the second resistor is connected to the first end of the photosensitive switch and the first end of the third resistor; the second end of the third resistor is grounded; the first end of the photosensitive switch is also connected to the controller, and the second end is grounded; the controller is used to determine the button press status based on the voltage change at the first end of the photosensitive switch.
[0012] In some embodiments of this application, the controller is also connected to a filter circuit.
[0013] In some embodiments of this application, the filtering circuit includes a filtering capacitor; the first end of the filtering capacitor is connected to the controller, and the second end is grounded.
[0014] In some embodiments of this application, the light-emitting device is an infrared light-emitting diode; the photosensitive switch is a phototransistor.
[0015] In some embodiments of this application, the phototransistor is an NPN type phototransistor.
[0016] In some embodiments of this application, the optical axis includes a light-shielding member; when the optical axis is in a depressed state, the light-shielding member of the optical axis forms a blockage between the light-emitting device and the photosensitive switch.
[0017] According to one aspect of the embodiments of this application, an electronic device is provided, including a key detection circuit as described above.
[0018] As can be seen from the above technical solution, this application has at least the following beneficial effects:
[0019] The key detection circuit provided in this application embodiment is applied to a key structure equipped with a mechanical axis or optical axis. A pair of connection points are included, with the first end connected to a power supply and the second end grounded. The connection points are conductive when the key structure is equipped with a mechanical axis and the mechanical axis is in a depressed state; otherwise, they are disconnected. The light-conducting component includes a light-emitting device and a photosensitive switch; the light-emitting device has its first end connected to the first end of the connection point and its second end grounded; the photosensitive switch has its first end connected to the power supply and its second end grounded.
[0020] When assembling a mechanical shaft into a button structure, if the mechanical shaft is not triggered, the connection point is disconnected, the photosensitive switch is turned on, and the voltage detection circuit detects the voltage at the first terminal of the photosensitive switch to determine that the button has not been triggered and pressed. If the mechanical shaft is triggered, the connection point is turned on, the photosensitive switch is turned off, and the voltage detection circuit detects the voltage at the first terminal of the photosensitive switch to determine that the button has been triggered and pressed.
[0021] When the optical axis is assembled into the button structure, when the optical axis is not triggered, the photosensitive switch is turned on, and the voltage detection circuit detects the voltage at the first end of the photosensitive switch to determine that the button has not been triggered and pressed; when the optical axis is triggered, the photosensitive switch is turned off, and the voltage detection circuit detects the voltage at the first end of the photosensitive switch to determine that the button has been triggered and pressed.
[0022] Therefore, this button detection circuit does not need to distinguish between mechanical and optical axes in the button structure; it only needs to detect the voltage at the first terminal of the photosensitive switch through a voltage detection circuit to determine the button press status. Compared to the traditional approach of designing separate detection circuits for mechanical and optical axes, this solution simplifies the circuit structure and reduces design costs. Attached Figure Description
[0023] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 A schematic structural diagram of an electronic device provided in an embodiment of this application;
[0025] Figure 2 This is a circuit diagram of a key detection circuit provided in an embodiment of this application.
[0026] Figure 3 This is a schematic diagram showing the connection between the mechanical shaft and the PCB board in an embodiment of this application;
[0027] Figure 4 This is a schematic diagram showing the connection between the optical axis and the PCB board in an embodiment of this application.
[0028] Figure label:
[0029] 1. Mechanical axis; 2. Signal pin; 3. Optical axis; 4. PCB board; 5. Optical conduction component; 6. Light-emitting device; 7. Photosensitive switch; 8. Light shield; 10. Button; 100. Electronic device. Detailed Implementation
[0030] The following specific embodiments illustrate the implementation of this application. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. Although the description of this application is presented in conjunction with preferred embodiments, this does not mean that the features of this application are limited to this embodiment. On the contrary, the purpose of describing the application in conjunction with embodiments is to cover other options or modifications that may be derived based on the claims of this application. To provide a thorough understanding of this application, many specific details will be included in the following description. This application may also be implemented without using these details. Furthermore, to avoid confusion or obscuring the focus of this application, some specific details will be omitted in the description. It should be noted that, unless otherwise specified, the embodiments and features in the embodiments of this application can be combined with each other.
[0031] Figure 1 This is a schematic structural diagram of an electronic device provided in an embodiment of this application, such as... Figure 1 As shown, the electronic device 100 includes at least one button 10.
[0032] The electronic device 100 includes devices such as a keyboard and a game controller, and the buttons 10 on the electronic device 100 are used to input corresponding electrical signals. When a user presses any button 10, the button 10 can transmit a specific signal to the corresponding electronic device 100, such as a switch command or a control command, thereby realizing operations such as inputting data to the electronic device 100.
[0033] Keyboards, as a common input device, are mainly divided into two categories based on their key triggering principles: mechanical switch keyboards and optical switch keyboards.
[0034] Mechanical switch keyboards, in particular, have mechanical switches installed inside the keys. When a user presses a key, an electrical signal is transmitted to the circuit board, enabling the key to function.
[0035] An optical axis keyboard has an optical axis inside each key and a light-conducting component consisting of a light-emitting device and a photosensitive switch. When a user presses a key, the optical axis blocks the light path between the light-emitting device and the photosensitive switch. The photosensitive element detects the change in light signal, converts it into an electrical signal, and transmits it to the circuit board to complete the key press.
[0036] It should be noted that the structure and principle of mechanical shafts and optical shafts are existing technologies and will not be elaborated here.
[0037] With the rapid development of the electronics industry, users are increasingly demanding greater compatibility and flexibility from their keyboards. For example, users want individual keys on the same keyboard to be able to be equipped with either mechanical or optical switches as needed. In traditional solutions, each key requires a separate detection circuit for mechanical and optical switches. This not only leads to a complex circuit board structure but also consumes a significant amount of GPIO resources.
[0038] Based on this, this application aims to provide a key detection circuit that is compatible with both mechanical and optical axes, simplifying the circuit structure and reducing design costs.
[0039] The key detection circuit provided in this application will be described in detail below with reference to specific embodiments.
[0040] Figure 2 A circuit schematic diagram of a key detection circuit provided in an embodiment of this application is shown below. Figure 2 As shown, the key detection circuit includes a PCB board 4, a pair of connection points, a light-conducting component 5, and a voltage detection circuit disposed on the PCB board 4. The key detection circuit is applied to an electronic device 100, which includes at least one key structure equipped with a mechanical axis 1 or an optical axis 3. This key structure can selectively mount either the mechanical axis 1 or the optical axis 3 as needed. It should be understood that the key structure has a mounting position for mounting either the mechanical axis 1 or the optical axis 3. When the mechanical axis 1 is in the mounting position, the key structure is triggered by the mechanical axis 1; when the optical axis 3 is in the mounting position, the key structure is triggered by the optical axis 3.
[0041] In this embodiment of the application, a pair of connection points are provided, with the first end connected to the power supply and the second end grounded. When the mechanical shaft 1 is assembled in the button structure, the connection points are connected to the mechanical shaft 1, and the two connection points are connected when the mechanical shaft 1 is in a pressed state; otherwise, they are disconnected.
[0042] Figure 3 This is a schematic diagram showing the connection between the mechanical shaft and the PCB board in an embodiment of this application.
[0043] like Figure 3As shown, when a mechanical switch 1 is assembled on the button structure, the two signal pins 2 of the mechanical switch 1 are electrically connected to the PCB board 4. Furthermore, both ends of the connection point are connected to the two signal pins 2 of the mechanical switch 1. When the user does not trigger the mechanical switch 1, the two signal pins 2 of the mechanical switch 1 are not conductive, and the two connection points are in a disconnected state; when the user triggers the mechanical switch 1, the two signal pins 2 of the mechanical switch 1 are conductive, and the two connection points are conductive.
[0044] Figure 4 This is a schematic diagram showing the connection between the optical axis and the PCB board in an embodiment of this application.
[0045] like Figure 4 As shown, the light-conducting component 5 includes a light-emitting device 6 and a photosensitive switch 7. In some embodiments of this application, the light-emitting device 6 is an infrared light-emitting diode (LED); the photosensitive switch 7 is a phototransistor. The phototransistor can be an NPN type phototransistor. The infrared LED and the phototransistor are mounted on the PCB board 4 and arranged opposite to each other. When the infrared LED is working, the infrared light emitted by the infrared LED can be received by the phototransistor. When the phototransistor receives infrared light, it enters the conducting state.
[0046] like Figure 2 As shown, the light-emitting device 6 has its first end connected to the first end of the connection point and its second end grounded; the photosensitive switch 7 has its first end connected to the power supply and its second end grounded; the first end of the photosensitive switch is also connected to the voltage detection circuit; the voltage detection circuit is used to determine the button pressing status based on the voltage change at the first end of the photosensitive switch.
[0047] The photosensitive switch 7 is turned on when the light-emitting device 6 is working and there is no obstruction between them; when the optical axis 3 is assembled in the button structure and is in a depressed state, the optical axis 3 forms an obstruction between the light-emitting device 6 and the photosensitive switch 7. Figure 4 As shown, in some embodiments of this application, the optical axis 3 includes a light-shielding member 8; when the optical axis 3 is in a depressed state, the light-shielding member 8 of the optical axis 3 forms a blockage between the light-emitting device 6 and the photosensitive switch 7.
[0048] It is understandable that when the optical axis 3 is installed on the button structure, when the user does not trigger the optical axis 3, the optical axis 3 will not block the light-emitting device 6 and the photosensitive switch 7; when the user triggers the optical axis 3, the light-blocking part 8 of the optical axis 3 moves down, blocking the light-emitting device 6 and the photosensitive switch 7.
[0049] The key detection circuit provided in this application embodiment is applied to a key structure equipped with a mechanical axis or optical axis. A pair of connection points are included, with the first end connected to the power supply and the second end grounded. The connection points are conductive when the mechanical axis 1 is assembled in the key structure and the mechanical axis 1 is in a depressed state; otherwise, they are disconnected. The light-conducting component 5 includes a light-emitting device 6 and a photosensitive switch 7; the light-emitting device 6 has its first end connected to the first end of the connection point and its second end grounded; the photosensitive switch 7 has its first end connected to the power supply and its second end grounded.
[0050] When the mechanical shaft 1 is assembled in the button structure, when the mechanical shaft 1 is not triggered, the connection point is disconnected. At this time, the photosensitive switch 7 is turned on, and the voltage detection circuit detects the voltage at the first end of the photosensitive switch to determine that the button 10 is not triggered and pressed. When the mechanical shaft 1 is triggered, the connection point is turned on, the photosensitive switch 7 is turned off, and the voltage detection circuit detects the voltage at the first end of the photosensitive switch to determine that the button 10 is triggered and pressed.
[0051] When the optical axis 3 is assembled in the button structure, when the optical axis 3 is not triggered, the photosensitive switch 7 is turned on, and the voltage detection circuit detects the voltage at the first end of the photosensitive switch to determine that the button 10 is not triggered and pressed; when the optical axis 3 is triggered, the photosensitive switch 7 is turned off, and the voltage detection circuit detects the voltage at the first end of the photosensitive switch to determine that the button 10 is triggered and pressed.
[0052] Therefore, this button detection circuit does not need to distinguish whether the button structure uses mechanical axis 1 or optical axis 3. It only needs to detect the voltage at the first terminal of the photosensitive switch through the voltage detection circuit to determine the button press status. Compared with the traditional approach of designing separate detection circuits for mechanical axis and optical axis, this solution simplifies the circuit structure and reduces design costs.
[0053] To better understand the implementation process of the key detection circuit in the embodiments of this application, please refer to the following: Figure 2 Explanation of circuit principles:
[0054] When mechanical shaft 1 is assembled in the button structure, when mechanical shaft 1 is not triggered, the connection point is disconnected. At this time, the first end of the connection point is at a high level, the infrared LED is turned on, and the phototransistor is turned on after receiving the infrared light emitted by the infrared LED. The low-level signal at the collector of the phototransistor is transmitted to the GPIO port of the controller. The controller receives the low-level signal and determines that button 10 has not been triggered and pressed.
[0055] When mechanical axis 1 is triggered, the connection point is turned on. At this time, the first end of the connection point is at a low level, the infrared LED is cut off, the phototransistor does not receive the infrared light emitted by the infrared LED, the phototransistor is cut off, and the high-level signal at the collector of the phototransistor is transmitted to the GPIO port of the controller. The controller receives the high-level signal and determines that button 10 is triggered and pressed.
[0056] When the optical axis 3 is assembled in the button structure, the connection point is always in the open state. When the optical axis 3 is not triggered, the infrared LED is turned on, and the phototransistor is turned on after receiving the infrared light emitted by the infrared LED. The low-level signal at the collector of the phototransistor is transmitted to the GPIO port of the controller. When the controller receives the low-level signal, it determines that the button 10 has not been triggered and pressed.
[0057] When optical axis 3 is triggered, the infrared LED is turned on, and the phototransistor cannot receive the infrared light emitted by the infrared LED. The phototransistor is turned off, and the high-level signal at the collector of the phototransistor is transmitted to the GPIO port of the controller for reception. When the controller receives the high-level signal, it determines that button 10 has been triggered and pressed.
[0058] Based on the above analysis, there is no need to distinguish whether the button structure uses mechanical axis 1 or optical axis 3. The button press status can be determined simply by detecting a high or low level via GPIO. This implementation allows the controller to use the same level detection method to detect whether a button has been triggered. Compared to the traditional approach of designing separate detection circuits for mechanical and optical axes, this saves GPIO port resources for the controller, simplifies the circuit structure, and reduces design costs.
[0059] like Figure 2 As shown, in some embodiments of this application, the button detection circuit further includes a first resistor R1; the first end of the first resistor R1 is connected to the power supply, and the second end of the first resistor R1 is connected to the first end of the connection point and the first end of the light-emitting device 6. The first resistor is used to limit the operating current of the light-emitting device 6 or the connection point to prevent overcurrent damage.
[0060] like Figure 2 As shown, in some embodiments of this application, the voltage detection circuit includes a second resistor R2, a third resistor R3, and a controller; the first end of the second resistor R2 is connected to the power supply, and the second end of the second resistor R2 is connected to the first end of the photosensitive switch and the first end of the third resistor R3; the second end of the third resistor R3 is grounded; the first end of the photosensitive switch is also connected to the controller, and the second end is grounded; the controller is used to determine the pressing status of the button 10 based on the voltage change at the first end of the photosensitive switch.
[0061] Specifically, the second resistor R2 is a pull-up resistor, and the third resistor R3 is a pull-down resistor. Through the voltage division of the second resistor R2 and the third resistor R3, when the photosensitive switch 7 is off, the first terminal of the photosensitive switch is pulled up to 5V through the second resistor R2, so that the GPIO detects this signal as high level; when the photosensitive switch 7 is on, the second resistor R2 limits the conduction current of the photosensitive switch 7 to prevent overcurrent damage.
[0062] In some embodiments of this application, the controller is also connected to a filtering circuit. The filtering circuit includes a filtering capacitor C1; the first end of the filtering capacitor C1 is connected to the controller, and the second end is grounded. The filtering capacitor C1 can filter out high-frequency noise from the controller's GPIO pins, making the signal more stable.
[0063] According to one aspect of the embodiments of this application, an electronic device 100 is provided, including a key detection circuit as described above.
[0064] Electronic devices 100, such as keyboards and game controllers, rely on keys 10 for input. With the aforementioned key detection circuit, keys 10 can flexibly accommodate both mechanical switches 1 and optical switches 3. Specifically, users can freely change the switches of one or more keys 10 on the electronic device 10 according to their usage scenarios, such as preferring the tactile feedback of mechanical switches 1 or the faster response of optical switches 3, or according to personal preference. The electronic device 100 does not need to design separate detection circuits for mechanical switches 1 and optical switches 3. Using the aforementioned key detection circuit, it can simultaneously accommodate both mechanical switches 1 and optical switches 3, simplifying the circuit structure and reducing design costs.
[0065] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A key detection circuit, characterized in that, A key structure applied to assembling mechanical or optical axes, wherein the key detection circuit includes: A pair of connection points, having a first end and a second end, the first end being connected to the power supply and the second end being grounded; A light-conducting component includes a light-emitting device and a photosensitive switch; the light-emitting device has a first end connected to the first end of the connection point and a second end grounded; the photosensitive switch has a first end connected to the power supply and a second end grounded; the first end of the photosensitive switch is also connected to a voltage detection circuit; the voltage detection circuit is used to determine the button press status based on the voltage change at the first end of the photosensitive switch. Specifically, when the button structure is assembled with a mechanical shaft, the connection point is connected to the mechanical shaft, and the connection point is conductive when the mechanical shaft is in a depressed state; otherwise, it is disconnected. The photosensitive switch is conductive when the light-emitting device is working and there is no obstruction between them. When the button structure is assembled with an optical axis and the optical axis is in a depressed state, the optical axis forms an obstruction between the light-emitting device and the photosensitive switch.
2. The key detection circuit according to claim 1, characterized in that, The button detection circuit further includes a first resistor; the first end of the first resistor is connected to the power supply, and the second end of the first resistor is connected to the first end of the connection point and the first end of the light-emitting device.
3. The key detection circuit according to claim 1, characterized in that, The voltage detection circuit includes a second resistor, a third resistor, and a controller; the first end of the second resistor is connected to a power supply, and the second end of the second resistor is connected to the first end of the photosensitive switch and the first end of the third resistor; the second end of the third resistor is grounded; the first end of the photosensitive switch is also connected to the controller, and the second end is grounded; the controller is used to determine the button press status based on the voltage change at the first end of the photosensitive switch.
4. The key detection circuit according to claim 3, characterized in that, The controller is also connected to a filter circuit.
5. The key detection circuit according to claim 4, characterized in that, The filtering circuit includes a filtering capacitor; the first end of the filtering capacitor is connected to the controller, and the second end is grounded.
6. The key detection circuit according to claim 1, characterized in that, The light-emitting device is an infrared light-emitting diode; the photosensitive switch is a phototransistor.
7. The key detection circuit according to claim 6, characterized in that, The phototransistor is an NPN type phototransistor.
8. The key detection circuit according to any one of claims 1-7, characterized in that, The optical axis includes a light-shielding component; when the optical axis is in a depressed state, the light-shielding component of the optical axis forms a barrier between the light-emitting device and the photosensitive switch.
9. An electronic device, characterized in that, Includes the key detection circuit as described in any one of claims 1-8.