Keyboard detection circuit suitable for electric energy meter
By designing a six-button control loop and four I/O interfaces, the problem of excessive MCU I/O port resources occupied by the traditional keypad detection circuit of the energy meter is solved, thereby optimizing the MCU's expandability and hardware design flexibility.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN TECHRISE ELECTRONICS
- Filing Date
- 2025-11-28
- Publication Date
- 2026-04-17
AI Technical Summary
Traditional energy meter keypad detection circuits consume too many MCU I/O port resources, limiting the MCU's expandability.
The design employs a six-button control loop and four I/O interfaces, using an MCU control chip to scan and detect the buttons, thus reducing the use of I/O ports.
It saves I/O port resources, improves the MCU's expandability, and optimizes the flexibility of hardware design.
Smart Images

Figure CN121878591A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of power equipment technology, and more specifically, to a keypad detection circuit suitable for electricity meters. Background Technology
[0002] An electricity meter is an instrument used to measure electrical energy. It is widely used in power plants, power supply systems, and user terminals as the basis for economic accounting and electricity bill collection. The keypad of the electricity meter is the core component of the human-machine interaction of the electricity meter, and its reliability directly affects the overall performance of the electricity meter. The keypad detection circuit is an important part of realizing the keypad function of the electricity meter. However, traditional keypad detection circuits usually adopt a matrix scanning method, such as a 4×3 keypad detection circuit. This structure requires 7 GPIO pins of the MCU (4 row lines + 3 column lines) to realize the detection function of 12 keys. This design greatly consumes the MCU's IO port resources, and when IO port resources are insufficient, it greatly restricts the MCU's expansion capabilities.
[0003] Therefore, the present invention provides a keyboard detection circuit suitable for electricity meters, which can save I / O port resources, improve the expansion capability of MCU, and optimize the flexibility of hardware design. Summary of the Invention
[0004] To overcome the shortcomings of existing technologies, this invention provides a keyboard detection circuit suitable for electricity meters, which can save I / O port resources, improve the expansion capability of MCU, and optimize the flexibility of hardware design.
[0005] The technical solution adopted by this invention to solve its technical problem is: a keypad detection circuit suitable for electricity meters, the improvement of which includes: The MCU control chip has four I / O interfaces: KEY1, KEY2, KEY3 and KEY4. The system includes six button control loops: a first button control loop, a second button control loop, a third button control loop, a fourth button control loop, a fifth button control loop, and a sixth button control loop. Each button loop has a button terminal and a control terminal. The control terminal of the first button control loop is electrically connected to the button terminal of the fourth button control loop and the KEY1 interface. The button terminal of the first button control loop is connected to the button terminal of the second button control loop, the KEY3 interface, and the control terminal of the third button control loop. The control terminal of the second button control loop is electrically connected to the control terminals of the sixth button control loop, the fifth button control loop, and the KEY2 interface. The button terminal of the third button control loop is electrically connected to the KEY4 interface, the button terminal of the fifth button control loop, and the control terminal of the fourth button control loop. The button terminal of the sixth button control loop is electrically connected to the button terminal of the fourth button control loop.
[0006] Furthermore, the first button control loop includes a button K1, a button K2, and a switching diode D1. One end of the button K1 is connected to one end of the button K2, the button terminal of the second button control loop, and the control terminal of the third button control loop. The other end of the button K1 is connected to the output terminal of the switching diode D1. The other end of the button K2 is connected to the input terminal of the switching diode D1. The common terminal of the switching diode D1 is connected to the KEY1 interface and the button terminal of the fourth button control loop.
[0007] Furthermore, the second button control loop includes a button K3, a button K4, and a switching diode D2. One end of the button K3 is connected to the output terminal of the switching diode D2, and the other end of the button K3 is connected to one end of the button K4 and one end of the button K1. The other end of the button K4 is electrically connected to the input terminal of the switching diode D2. The common terminal of the switching diode D2 is connected to the control terminal of the sixth button control loop.
[0008] Furthermore, the third button control loop includes button K5, button K6, and switching diode D3. One end of button K5 is connected to the KEY4 interface, one end of button K6, the control terminal of the fourth button control loop, and the button terminal of the fifth button control loop. The other end of button K5 is connected to the output terminal of switching diode D3. The other end of button K6 is connected to the input terminal of switching diode D3. The common terminal of switching diode D3 is connected to the KEY3 interface, one end of button K1, and the other end of button K3.
[0009] Furthermore, the fourth button control loop includes button K7, button K8, and switching diode D4. One end of button K7 is connected to one end of button K8, the KEY1 interface, and the button terminal of the sixth button control loop. The other end of button K7 is connected to the output terminal of switching diode D4. The other end of button K8 is connected to the input terminal of switching diode D4. The common terminal of switching diode D4 is connected to one end of button K6 and the button terminal of the fifth button control loop.
[0010] Furthermore, the fifth button control loop includes button K9, button K10, and switching diode D5. One end of button K9 is connected to one end of button K10, one end of button K6, and the common terminal of switching diode D4. The other end of button K9 is connected to the output terminal of switching diode D5. The other end of button K10 is electrically connected to the input terminal of switching diode D5. The common terminal of switching diode D5 is connected to the KEY2 interface and the control terminal of the sixth button control loop.
[0011] Furthermore, the sixth button control loop includes button K11, button K12, and switching diode D6. One end of button K11 is electrically connected to one end of button K8 and one end of button K12, and the other end of button K11 is connected to the output terminal of switching diode D6. The other end of button K12 is connected to the input terminal of switching diode D6. The common terminal of switching diode D6 is connected to the common terminal of switching diode D5 and the common terminal of switching diode D2.
[0012] The beneficial effects of this invention are as follows: By designing the keypad matrix of the energy meter into six keypad control loops, and scanning each keypad control loop through the KEY1, KEY2, KEY3, and KEY4 interfaces of the MCU control chip, this invention achieves scanning of each key. Compared with the prior art, the circuit design of this invention only requires four I / O port resources, thus enhancing the MCU's expandability. Therefore, this invention can save I / O port resources, improve the MCU's expandability, and optimize the flexibility of hardware design. Attached Figure Description
[0013] Figure 1 This is a circuit diagram of a keypad detection circuit for an electricity meter according to the present invention. Detailed Implementation
[0014] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0015] The following will clearly and completely describe the concept, specific structure, and technical effects of the present invention in conjunction with embodiments and accompanying drawings, so as to fully understand the purpose, features, and effects of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, not all of them. Other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are all within the scope of protection of the present invention. Furthermore, all connections / linkages involved in the patent do not simply refer to direct contact between components, but rather to the ability to form a better connection structure by adding or reducing connecting accessories according to specific implementation conditions. The various technical features in this invention can be combined interactively without contradicting each other.
[0016] This invention provides a keypad detection circuit suitable for electricity meters, comprising: The MCU control chip has four I / O interfaces: KEY1, KEY2, KEY3 and KEY4. The system includes six button control loops: a first button control loop, a second button control loop, a third button control loop, a fourth button control loop, a fifth button control loop, and a sixth button control loop. Each button loop has a button terminal and a control terminal. The control terminal of the first button control loop is electrically connected to the button terminal of the fourth button control loop and the KEY1 interface. The button terminal of the first button control loop is connected to the button terminal of the second button control loop, the KEY3 interface, and the control terminal of the third button control loop. The control terminal of the second button control loop is electrically connected to the control terminals of the sixth button control loop, the fifth button control loop, and the KEY2 interface. The button terminal of the third button control loop is electrically connected to the KEY4 interface, the button terminal of the fifth button control loop, and the control terminal of the fourth button control loop. The button terminal of the sixth button control loop is electrically connected to the button terminal of the fourth button control loop.
[0017] Specifically, the first button control loop includes a button K1, a button K2, and a switching diode D1. One end of button K1 is connected to one end of button K2, the button terminal of the second button control loop, and the control terminal of the third button control loop. The other end of button K1 is connected to the output terminal of switching diode D1. The other end of button K2 is connected to the input terminal of switching diode D1. The common terminal of switching diode D1 is connected to the KEY1 interface and the button terminal of the fourth button control loop. The second button control loop includes a button K3, a button K4, and a switching diode D2. One end of button K3 is connected to the output terminal of switching diode D2, and the other end of button K3 is connected to the output terminal of button K4. One end of button K4 is connected to the input terminal of switch diode D2; the other end of switch diode D2 is connected to the control terminal of the sixth button control loop; the third button control loop includes button K5, button K6, and switch diode D3. One end of button K5 is connected to the KEY4 interface, one end of button K6, the control terminal of the fourth button control loop, and the button terminal of the fifth button control loop. The other end of button K5 is connected to the output terminal of switch diode D3; the other end of button K6 is connected to the input terminal of switch diode D3; the common terminal of switch diode D3 is connected to the KEY3 interface, one end of button K1, and the other end of button K3. Connections; the fourth button control loop includes button K7, button K8, and switching diode D4. One end of button K7 is connected to one end of button K8, the KEY1 interface, and the button terminal of the sixth button control loop. The other end of button K7 is connected to the output terminal of switching diode D4. The other end of button K8 is connected to the input terminal of switching diode D4. The common terminal of switching diode D4 is connected to one end of button K6 and the button terminal of the fifth button control loop. The fifth button control loop includes button K9, button K10, and switching diode D5. One end of button K9 is connected to one end of button K10, one end of button K6, and the common terminal of switching diode D4. The other end of button K10 is connected to the output terminal of switching diode D5; the other end of button K10 is electrically connected to the input terminal of switching diode D5; the common terminal of switching diode D5 is connected to the KEY2 interface and the control terminal of the sixth button control loop; the sixth button control loop includes button K11, button K12 and switching diode D6, one end of button K11 is electrically connected to one end of button K8 and one end of button K12, and the other end of button K11 is connected to the output terminal of switching diode D6; the other end of button K12 is connected to the input terminal of switching diode D6; the common terminal of switching diode D6 is connected to the common terminal of switching diode D5 and the common terminal of switching diode D2.
[0018] It should be noted that, in this embodiment, the keyboard detection circuit for the energy meter consists of an MCU control chip, twelve buttons (K1-K12), and six switching diodes (D1-D6). Each pair of buttons and one switching diode forms a button control loop, thus creating the aforementioned six button control loops. Each button control loop leads to four I / O connection terminals via the circuit connection described above. These four I / O connection terminals are connected to the KEY1, KEY2, KEY3, and KEY4 interfaces of the MCU control chip, respectively. The MCU control chip detects whether each button is pressed based on the different states of the four I / O ports (KEY1, KEY2, KEY3, and KEY4). The specific principle of detecting whether each button is pressed is as follows: The MCU control chip's I / O ports have four states: low output, high output, input internal resistor pull-up signal, and high impedance. The MCU control chip determines whether each button is pressed by controlling the states of the four I / O ports and reading their levels. Specifically: When the KEY1 interface is an input terminal and the internal resistor pulls the signal high, the KEY2 interface outputs a low level, and the KEY3 and KEY4 interfaces are in a high impedance state, the MCU control chip reads the level state of the KEY1 interface. If it is low, it means that the button K12 has been pressed; if it is high, it means that the button K12 has not been pressed. When the KEY2 interface is an input terminal and the internal resistor is pulled high, the KEY1 interface outputs a low level, and the KEY3 and KEY4 interfaces are in a high impedance state, the MCU control chip reads the level state of the KEY2 interface. If it is low, it means that the button K11 has been pressed; if it is high, it means that the button K11 has not been pressed. When the KEY4 interface is an input terminal and the internal resistor is pulled high, the KEY2 interface outputs a low level, and the KEY1 and KEY3 interfaces are in a high impedance state. The MCU control chip reads the level state of the KEY4 interface. If it is low, it means that the button K10 has been pressed; if it is high, it means that the button K10 has not been pressed. When the KEY2 interface is an input terminal and the internal resistor pulls the signal high, the KEY4 interface outputs a low level, and the KEY1 and KEY3 interfaces are in a high-impedance state. The MCU control chip reads the level state of the KEY2 interface. If it is low, it means that the button K9 has been pressed; if it is high, it means that the button K9 has not been pressed. When the KEY1 interface is an input terminal and the internal resistor pulls the signal high, the KEY4 interface outputs a low level, and the KEY2 and KEY3 interfaces are in a high impedance state. The MCU control chip reads the level state of the KEY1 interface. If it is low, it means that the button K8 has been pressed; if it is high, it means that the button K8 has not been pressed. When the KEY4 interface is an input terminal and the internal resistor pulls the signal high, the KEY1 interface outputs a low level, and the KEY2 and KEY3 interfaces are in a high impedance state. The MCU control chip reads the level state of the KEY4 interface. If it is low, it means that the button K7 has been pressed; if it is high, it means that the button K7 has not been pressed. When the KEY4 interface is an input terminal and the internal resistor pulls the signal high, the KEY3 interface outputs a low level, and the KEY1 and KEY2 interfaces are in a high-impedance state. The MCU control chip reads the level state of the KEY4 interface. If it is low, it means that the button K6 has been pressed; if it is high, it means that the button K6 has not been pressed. When the KEY3 interface is an input terminal and the internal resistor pulls the signal high, the KEY4 interface outputs a low level, and the KEY1 and KEY2 interfaces are in a high impedance state. The MCU control chip reads the level state of the KEY3 interface. If it is low, it means that the button K5 has been pressed; if it is high, it means that the button K5 has not been pressed. When the KEY3 interface is an input terminal and the internal resistor pulls the signal high, the KEY2 interface outputs a low level, and the KEY1 and KEY4 interfaces are in a high impedance state. The MCU control chip reads the level state of the KEY3 interface. If it is low, it means that the button K4 has been pressed; if it is high, it means that the button K4 has not been pressed. When the KEY2 interface is an input terminal and the internal resistor pulls the signal high, the KEY3 interface outputs a low level, and the KEY1 and KEY4 interfaces are in a high-impedance state. The MCU control chip reads the level state of the KEY2 interface. If it is low, it means that the button K3 has been pressed; if it is high, it means that the button K3 has not been pressed. When the KEY3 interface is an input terminal and the internal resistor is pulled high, the KEY1 interface outputs a low level, and the KEY2 and KEY4 interfaces are in a high impedance state. The MCU control chip reads the level state of the KEY3 interface. If it is low, it means that the button K2 has been pressed; if it is high, it means that the button K2 has not been pressed. When the KEY1 interface is an input terminal and the internal resistor pulls the signal high, the KEY3 interface outputs a low level, and the KEY2 and KEY4 interfaces are in a high impedance state. The MCU control chip reads the level state of the KEY1 interface. If it is low, it means that the button K1 has been pressed; if it is high, it means that the button K1 has not been pressed. Based on the above detection principle, the MCU control chip can scan each button through four IO ports (KEY1, KEY2, KEY3 and KEY4). Compared with the existing technology with seven IO ports, this embodiment can save IO port resources, improve the MCU's expandability, and optimize the flexibility of hardware design.
[0019] The above is a detailed description of the preferred embodiments of the present invention. However, the present invention is not limited to the embodiments described. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present invention. All such equivalent modifications or substitutions are included within the scope defined by the claims of this application.
Claims
1. A keypad detection circuit suitable for electricity meters, characterized in that, include: The MCU control chip has four I / O interfaces: KEY1, KEY2, KEY3 and KEY4. The system includes six button control loops: a first button control loop, a second button control loop, a third button control loop, a fourth button control loop, a fifth button control loop, and a sixth button control loop. Each button loop has a button terminal and a control terminal. The control terminal of the first button control loop is electrically connected to the button terminal of the fourth button control loop and the KEY1 interface. The button terminal of the first button control loop is connected to the button terminal of the second button control loop, the KEY3 interface, and the control terminal of the third button control loop. The control terminal of the second button control loop is electrically connected to the control terminals of the sixth button control loop, the fifth button control loop, and the KEY2 interface. The button terminal of the third button control loop is electrically connected to the KEY4 interface, the button terminal of the fifth button control loop, and the control terminal of the fourth button control loop. The button terminal of the sixth button control loop is electrically connected to the button terminal of the fourth button control loop.
2. The keypad detection circuit for an electricity meter according to claim 1, characterized in that, The first button control loop includes a button K1, a button K2, and a switching diode D1. One end of the button K1 is connected to one end of the button K2, the button terminal of the second button control loop, and the control terminal of the third button control loop. The other end of the button K1 is connected to the output terminal of the switching diode D1. The other end of the button K2 is connected to the input terminal of the switching diode D1. The common terminal of the switching diode D1 is connected to the KEY1 interface and the button terminal of the fourth button control loop.
3. The keypad detection circuit for an electricity meter according to claim 2, characterized in that, The second button control loop includes button K3, button K4, and switching diode D2. One end of button K3 is connected to the output terminal of switching diode D2, and the other end of button K3 is connected to one end of button K4 and one end of button K1. The other end of button K4 is electrically connected to the input terminal of switching diode D2. The common terminal of switching diode D2 is connected to the control terminal of the sixth button control loop.
4. A keypad detection circuit for an electricity meter according to claim 3, characterized in that, The third button control loop includes button K5, button K6, and switching diode D3. One end of button K5 is connected to the KEY4 interface, one end of button K6, the control terminal of the fourth button control loop, and the button terminal of the fifth button control loop. The other end of button K5 is connected to the output terminal of switching diode D3. The other end of button K6 is connected to the input terminal of switching diode D3. The common terminal of switching diode D3 is connected to the KEY3 interface, one end of button K1, and the other end of button K3.
5. A keypad detection circuit for an electricity meter according to claim 4, characterized in that, The fourth button control loop includes button K7, button K8, and switching diode D4. One end of button K7 is connected to one end of button K8, the KEY1 interface, and the button terminal of the sixth button control loop. The other end of button K7 is connected to the output terminal of switching diode D4. The other end of button K8 is connected to the input terminal of switching diode D4. The common terminal of switching diode D4 is connected to one end of button K6 and the button terminal of the fifth button control loop.
6. A keypad detection circuit for an electricity meter according to claim 5, characterized in that, The fifth button control loop includes button K9, button K10, and switching diode D5. One end of button K9 is connected to one end of button K10, one end of button K6, and the common terminal of switching diode D4. The other end of button K9 is connected to the output terminal of switching diode D5. The other end of button K10 is electrically connected to the input terminal of switching diode D5. The common terminal of switching diode D5 is connected to the KEY2 interface and the control terminal of the sixth button control loop.
7. A keypad detection circuit for an electricity meter according to claim 6, characterized in that, The sixth button control loop includes button K11, button K12, and switching diode D6. One end of button K11 is electrically connected to one end of button K8 and one end of button K12, and the other end of button K11 is connected to the output terminal of switching diode D6. The other end of button K12 is connected to the input terminal of switching diode D6. The common terminal of switching diode D6 is connected to the common terminal of switching diode D5 and the common terminal of switching diode D2.